draft0 - a shared blog by just some people

Menu

Entries tagged 'cat:Projects' (Page 4)

Automatic backups with rsync under Linux

There is a newer version of this entry: 'Backup Shell Script'.

This is a very primitive and bad script. I've posted a new version here.

"No backup no pity!"

I don't agree. But I like the saying for reasons that I shall not analyse here right now.

I don't always have proper backups of my data, let alone off-site backups. I have no backup at all of a large portion of my hoarded data. But I did at some point take the time to create scripts that back up important stuff automatically. Here is a simple one using rsync and a mounted share as a target.


#!/bin/bash

NAME="usershomedir"
SRCDIR="/home/user"
BUDIR="/mnt/backup/"

rm -rf $BUDIR$NAME.8
mv $BUDIR$NAME.7 $BUDIR$NAME.8
mv $BUDIR$NAME.6 $BUDIR$NAME.7
mv $BUDIR$NAME.5 $BUDIR$NAME.6
mv $BUDIR$NAME.4 $BUDIR$NAME.5
mv $BUDIR$NAME.3 $BUDIR$NAME.4
mv $BUDIR$NAME.2 $BUDIR$NAME.3
mv $BUDIR$NAME.1 $BUDIR$NAME.2
cp -al $BUDIR$NAME.0 $BUDIR$NAME.1
NOW=$(date)
echo >> $BUDIR$NAME.log
echo >> $BUDIR$NAME.log
echo >> $BUDIR$NAME.log
echo "##### STARTING INCREMENTAL BACKUP AT $NOW" >> $BUDIR$NAME.log
echo >> $BUDIR$NAME.log
rsync --archive -L --delete $SRCDIR  $BUDIR$NAME.0/ 2>&1 | tee -a $BUDIR$NAME.log

You would create one of these scripts per directory you want to backup. BUDIR is the directory where you want to backup to be stored. This will probably be the same for every script if you have only one backup drive/server. SRCDIR is the directory you want to backup. NAME is the name you want the backup to be stored under. It can be a sub-directory if you want, so you can sort the backups into directories on the target.

Comment via email

SBWG 0.5.12

Large leaps of progress are being made with SBWG. The feature set is growing satisfyingly rapid, some not so great ideas have been scrapped and as I'm learning more about Bash the code quality is also improving. I'm behind on writing a proper introduction, README and so on.

You can download version 0.6.17 here and I'll write something about it later.

See how large the leaps are? The version changed before I finished writing this entry.

Comment via email

LED Pictures

An unremembered number of years ago I started wanting to make at least one picture like this. A picture engraved into a transparent polymer sheet, lit by LEDs from the side. The light gets scattered in the rough places of the sheet. If the LEDs are hidden, e.g. in a frame, this makes it look like the transparent picture itself is glowing. I liked the idea - probably seen it somewhere. And I knew I'm not good at making pictures - be it with paint or an engraving cutter. So I didn't do it. Usually this is the end with ideas like this of mine.

I couldn't get rid of the idea for years though. And some day I made one. It didn't look good but I liked it. I made a few more and added more efford this time.

I saw a potential to become better at this (and still do) so I made more and more. And about 7 years later I have made hundrets of them. Here are a few I like best:

File Attachments (27 files)

Comment via email

The WILD Ball

WILD Ball - electronic DIY aid in WILD induction

What is a WILD Ball?

WILD Ball is the name I have given my little project to build a device that aids a person in falling asleep more consciously and possibly experience waking-initiated lucid dreams.

It is a tennis ball sized device that you hold in your hand while trying to fall asleep consciously (usually after a WBTB). WILD (waking-initiated lucid dream) is referring to my preferred way to experience dream consciousness.

(How) Does it work?

The most common reason why WILD attempts fail is that the critical moment - the exact moment where you start to perceive the dream instead of your physical surrounding enough to control the dream consciously - is simply missed. You stay awake for a while, and when/if you finally fall asleep, you don't notice it. It is important to stay aware until or become aware right at that moment where you already perceive a dream but are still conscious enough to control it. There is a variety of mental and a few physical techniques that are supposed to help one to accomplish just that. This device is an additional aid to mental techniques. As with other electronic devices made to aid lucid dream (LD) induction, it is expected to work best if you already have experience in successful LD induction. Of course it is not necessary to have experienced LDs before in order for this device to help accomplish this goal. I suggest its usage as a part of the WILD induction training of anybody who sees it as a fitting addition to their WILD practice. If you already have the ability to explore hypnagogic hallucinations extensively or sometimes experience the beginning of a dream without becoming lucid, this device might fill a gap in your LD practice.

The WILD Balll has two different usage modes. (More might be added in the future.) Both aim to remind its user of their intention to fall asleep consciously by sounding a buzzer whenever the muscle contraction of the hand that is holding it drops below a certain threshold. It is an old technique to hold something in one hand and let it fall on something that makes a noise, thus waking one up right at the moment where muscle contraction is too weak to hold the object. This technique is seldomly discussed in the lucid dreaming community though and I have found only a handful of reports of people experimenting with or using it. Using an electronic device instead of a heavy object and a noisy underground has some advantages which might overcome the limitations that the classical approach has.

  • The type of sound can be altered in software. The built presented here only provides a simple piezo buzzer. But the design can easily be extended to play more complex sounds or music.
  • The length and volume of the sound can be altered in software, making it easier to tune it to your personal requirements.
  • The device can be used at any sleeping place and does not need to be set up before use when travelling.
  • By using headphones or a speaker pillow a loud alarm sound can be played for the user without disturbing other sleepers in the same room.
  • Obviously it is cooler to do it this way than to rely on simple physics.

Mode 0 imitates the classical approach of letting the object fall when the muscle contraction becomes weak. The alarm sound is triggered when the device is moving at a certain speed or above. Movement is detected in three axes independently. The speed threshold can be simply set in software. If you want to move your hand or otherwise adjust your body during a WILD attempt without triggering the alarm, you can simply squeeze the device, which disables the sound until you let go and only hold it lightly again. For more uses of mode 1, see Ideas/modifications below.

Mode 1 follows a different approach to achive the same result. You steadily squeeze the device during your WILD aatempt. As soon as the pressure drops below a certain threshold the alarm sounds for the defined duration. Right now this a implemented with a binary switch which means the threshold can not be adjusted in software but only changing the the way the switch is built, by using a different pre-manufactured switch or by changing (the hardness of) its surrounding (the ball itself). The switch could be replaced with a preassure sensor to allow more gradual detection of preassure loss.

How to build one

(tba)

Challenges/known problems

(tba)

Getting used to holding the object, alarm sound too loud, getting used to the sound

The code

If you have a device built according to the above pictures then you can use the below Arduino sketch (download .ino file) as it is. Otherwise it should give you an idea of how to program the microcontroller used in your DIY built.

/*
    This is the Arduino sketch for the WILD Ball, a simple device that aids a person in falling asleep more
    consciously and possibly experience waking-initiated lucid dreams.
    More information at: https://steeph.de/projects/wildball/
*/

#include<Wire.h>
const boolean usageMode = 0; /*
    There are two different usage modes:
    0: The alarm is triggered when the device is moved unless the button is pressed. (The button can be pressed
       while adjusting the hand or lying position. When the button is let go the alarm is active again.)
    1: Movements are ignored. The alarm is triggered and will sound for toneDuration milliseconds when the button is not pressed. */
const boolean debugMode = 0; // Print messages to serial port if debugMode is enabled
int buzzerPin = 5;
int buttonPin = 4;
int threshold = 1000; // The smaller this value the more sensitive the device will be to movement
const int MPU=0x68;
int16_t AcX,AcY,AcZ,Tmp,GyX,GyY,GyZ;
int toneDuration = 300; // Minimum duration of alarm sound in milliseconds
int toneFrequency = 250; // The frequency of the alarm sound
void setup(){
  Wire.begin();
  Wire.beginTransmission(MPU);
  Wire.write(0x6B);
  Wire.write(0);    
  Wire.endTransmission(true);
  if (debugMode) { Serial.begin(9600); }
  pinMode(buzzerPin, OUTPUT);
  pinMode(buttonPin, INPUT);
}
void loop(){
  if (!usageMode) {
    Wire.beginTransmission(MPU);
    Wire.write(0x3B);
    Wire.endTransmission(false);
    Wire.requestFrom(MPU,14,true);
    AcX=Wire.read()<<8|Wire.read();
    AcY=Wire.read()<<8|Wire.read();
    AcZ=Wire.read()<<8|Wire.read();
    Tmp=Wire.read()<<8|Wire.read();
    GyX=Wire.read()<<8|Wire.read();
    GyY=Wire.read()<<8|Wire.read();
    GyZ=Wire.read()<<8|Wire.read();
  }

  if (debugMode && !usageMode) {
    Serial.print("Accelerometer: ");
    Serial.print("X = "); Serial.print(AcX);
    Serial.print(" | Y = "); Serial.print(AcY);
    Serial.print(" | Z = "); Serial.println(AcZ);
  
    Serial.print("Gyroscope: ");
    Serial.print("X = "); Serial.print(GyX);
    Serial.print(" | Y = "); Serial.print(GyY);
    Serial.print(" | Z = "); Serial.println(GyZ);
    Serial.println(" ");
  }

  if (usageMode) {
    if (debugMode) { Serial.println("Usage Mode 1"); Serial.println(); }
    if (!buttonPressed()) {
      tone(5, toneFrequency, toneDuration);
    }
  } else {
    if (debugMode) { Serial.println("Usage Mode 0"); Serial.println(); }
    if (moved(GyX,GyY,GyZ) && !buttonPressed()) {
      tone(5, toneFrequency, toneDuration);
      if (debugMode) { Serial.println("Ha! You moved!"); Serial.println(); }
    }
  }

  delay(100);
}



boolean buttonPressed() {
  if (digitalRead(buttonPin)) {
    if (debugMode) { Serial.println("Button is pressed."); Serial.println(); }
    return true;
  } else {
    return false;
  }
}

boolean moved (int16_t x, int16_t y, int16_t z) {
  if(x > threshold || y > threshold || z > threshold || x < -threshold || y < -threshold || z < -threshold)
  {
    return true;
  }
  else {
    return false;
  }
}

Ideas/modifications

(tbc)

The device does not have to be placed inside a ball. You can built a case and place the components according to your personal needs. Because it does not have to drop on anything but only move it is also possible to use mode 1 with the device strapped to the hand if you prefer to hold up an arm instead of holding something in your hand. If you usually experience muscle twitches while falling asleep, e.g. in your legs or feet, as many people do, you can also experiment with the device strapped to your foot or leg.

Instead of sounding a buzzer for a pre-defined duration, you can experiment with different signals, be it blinking LEDs a playing an MP3 file from a different device or extension module. By adding a wave module the variety of sounds can be increased so that you can choose the best sound to make you aware quickly without waking you up completely. You yourself probably know best what sound that might be. But as with the rhythm nappping technique, short loud sounds are most likely to lead to a successfull LD induction attrempt.

FILD mode (tba)

Comment via email

Traumtagebuch-Software

Die eigenen Träume aufzuzeichnen ist ein wichtiger Teil des Klartraum-Trainings. Das ist der Haupt-Grund, wieso ich daran interessiert bin. Aber es kann auch aus anderen Gründen interessant sein, Traum-Erinnerungen aufzuschreiben oder sonstwie aufzuzeichnen.

2017 habe ich mir mal fast alle Software für Android und Windows, die für diesen Zweck gedacht ist, angeschaut. Die Idee war, Features und Funktionsweisen aller möglicher Apps in einer filterbaren Tabelle geordnet und vergleichbar zu sammeln und anderen mit Google Docs zu ermöglichen, die Tabelle zu erweitern und zu ergänzen. Allerdings habe ich in meiner aktiven Zeit in der Klarträumer-Community niemanden gefunden, der interessiert war, mitzumachen. Deshalb lege ich jetzt einfach die Tabelle mit Stand von Oktober 2017 in seiner gänzlichen Unvollständigkeit hier ab.

Da sich die persönlichen Vorlieben und Bedürfnisse stark unterscheiden, wage ich es nicht, Empfehlungen auszusprechen. Unter den >100 getesteten Apps sind sehr unterschiedliche Apps dabei. Hoffentlich hilft die Tabelle, Interessierten die Auswahl zu erleichtern.

Comment via email
Mastodon