Skip to content
Shreyansh Singh edited this page Apr 19, 2021 · 12 revisions

Welcome to the Dream Hacker wiki!

Dream Hacker Logo

Basic information about Dream Hacker to get started

Dream Hacker is program designed to help you have better dreams. Our projects monitors our users heart rate and plays an audio file chosen by the user. Once Dream Hacker detects the user has entered sleep ie. when the beats per minute is below a certain threshold it will play the selected audio.

This setup takes data from pulse sensor and time of the day etc, to predict when the person has slept. Then after a while start the audio stimulus.

The Project Requirements

Hardware

Software

See Documentation

How to Setup.

Hardware

 - Set up the circuit as shown in the diagram.
 - Put a speaker with it's audio jack in the audio output of the raspberry pi.

Software

1. Use SSH, VNC or a monitor and a keyboard to login to raspberry pi.
2. Install the audio player mpg123
3. Clone the repository somewhere in the Raspberry Pi.
4. Run the following commands from inside the repository 
 - cmake .
 - make

Usage

  • Put your audio files inside the directory Audio/.
  • Edit the audio.txt file with the name of the audio you want to play when the sleep starts. For example if you want to play my_file.mp3 present in the Audio/ directory then write Audio/my_file.mp3. Make sure that the file has just one line.
  • Run ./main -h to explore what are the parameters which can be feeded as the input to the program.
  • Example: If you want to run the program as a simulation and set the beats per minute threshold to 70 then run ./main -s 1 -t 70.
  • To run in default mode run ./main

Parameters passed to the main program

The main program can be run with several parameters. To know them run the main program with -h parameters like this ./main -h. Output of the ./main -h is:

Usage:
-h for help-t [int] to put bpm threshold
-g [bool] 1 to plot in qtplot. Default: 1
-l [bool] 1 to play audio locally. Default: 1
-n [bool] 1 to set night time to now. Default: 0
-w [int] set waiting time to confirm sleep.
-s [bool, 0 or 1] 1 for simulated bpm. Default: 

Explanation of various Parameters

- -s is used to tell the program if it has to work on simulated bpm. This is a great way to test the system. Example:
./main -s 1
- -t is used to manipulate the threshold on the beats per minute in the program. Example:
./main -t 78
- -n is used to set the beginning of the night time to the current time. This way the user can use the system at any point of the day. It 
is very essential for testing the system. Example: ./main -n 1
- -l is used to play the music in the program itself. By default it is 1. But if you want to change it, use the program like this:
./main -l 1
Clone this wiki locally