Project Lucidity

 Transmitter

Project Lucidity connects and communicates with any smartphone or device by utilizing the ubiquitous headphone port. In order to properly interface with the headphone port, a transmitter module was created. The transmitter plugs into the smartphone and converts audio signals into usable information for Project Lucidity.

Design:

When constructing the transmitter module, I focused on designing it to be usable outside of the scope of my project. The transmitter and the sleep mask communicate using the affordable RFM12b radio frequency module. These modules communicate in various frequencies, but my project utilized the 433hz version of the chip. These chips offer robust communication with a fairly large transmission distance and has advanced features such as acknowledgements packets and network/node tree structure. 

 

 

 

The transmitter module also incorporates a opamp in order to amplify the signals coming from the headphone port, thus allowing it to work with a variety of devices. With the gain set at 11x, the audio signal does not have to be at maximum volume at the source and thus even works with old smartphones which did not have large amplification built in. The effects of the amplifier are shown on the left.

 

The transmitter module utilizes an ATMEGA-328p processor and can be reprogrammed by the ICSP pins or by using an external FTDI <--> USB board and connecting to the serial pins attached to the micro-usb port. The microusb port also can be used to recharge the transmitter through a Li-Ion charger circuit. The transmitter is powered by a 3.6v LiR2032 coin cell battery.

Implementation:

In order to communicate with smartphones, the transmitter module listens for specific audio signals which are encoded in binary. Although the module can technically receive and send any binary information, this current version is programmed to look for and interpret the data as integers of up to 16 bit. When the smartphone wants to send a specific integer value to the transmitter, the application will convert the integer into binary and then append three different audio files in a specific order to create the final audio signal. The three audio signals are oneBit, zeroBit, and nullBit.

 

The three audio signals are essentially the shortest pulse Audacity would let me generate followed by a microseconds of silence. The transmitter listens for these pulses and times how long between the next pulse. Using these timings, it can determine whether a 1, 0, or null was passed by the audio signal.

 

For example, lets say the smartphone wants to send the integer 1359. According the API on how to communicate with the mask, this integer would tell the mask to display pattern 13 at speed 5 (out of 9) and brightness 9 (out of 9). In order for the smartphone to send this message, it would convert the integer into binary: 10101001111. Then the application would take the three different audio bit files and concatenate them in the order of the binary number. oneBit+zeroBit+….+oneBit+oneBit+nullBit. The nullBit at the end allows for the transmitter to know that you have completely sent your message thus binary messages of shorter than 16 bits can be sent without having to fill in the zeros which allows the signal to be sent quicker. Messages longer than 16 bits are disregarded but this restriction could easily be modified in code.

I opted for a integer communication scheme as to keep the device usable for a multitude of projects in the future. By using simple integers to communicate, anyone can adapt this transmitter to communicate many different types of messages and can even use this as a central hub for communication with all RFM12b projects.


For testing purposes, I have written a quick python script which takes a integer as input and will create an audio file with the bit audio files concatenated properly. The audio file created loops the extremely short signal thousands of times in order to reach a audio file that would be playable. This can be useful as a resource but ideally this concatenation code will be implemented into smartphone apps. Because you only need those three bit files, implementing this will be negligible in terms of application size. For testing purposes, one could use the python script to create a premade signal file and simply play that file on their phone. Although this would not allow for on the spot customization of the signal, it will still allow the project to work.

Project Pictures:

Project Lucidity

Sleep Mask

The project's sleep mask is a direct signal to led interface sporting the same basics such as reprogrammability and rechargeability but also opens developers to red and daylight white leds.

Much of the mask circuit is derived from the transmitter circuit. The mask itself communicates with the transmitter using the RFM12b wireless chip. When it receives the integer command, it parses it for relevant information in terms of pattern, the pattern speed, and the brightness of the leds. By waiting until a smartphone has detected REM sleep, the mask ensures it only triggers at the most opportune times to trigger lucidity.

In addition to the red leds, the mask also contains daylight white leds which can be triggered by a specific command from the transmitter. These leds glow brighter over a longer period of time to ensure a calm and natural sunrise simulation. This light stimulation helps nudge your circadian rhythm out of entering a new sleep cycle and is also triggered at the proper time by sleep tracking applications.

In order to ensure that the light hits the eyes properly, the mask has four leds per eye which are paired up to expand the area the light penetrates. This allows for the mask to move around during the night and still ensures proper stimulation delivery.

Since the mask is triggered by any smartphone, I hope that this project will expand past just smartphone sleep tracking apps and will be expanded to include more sensors as data points to trigger lucidity. With the push of activity monitors and smart watches, all this extra data will help the project pinpoint the best time to trigger lucidity in all sorts of sleepers.

Project Pictures:

Show More

Demo Video:

Source:

The project source is completely viewable and downloadable on Github. I have attached my commented code, the circuit schematic, and a Eagle board file if you want to get the project printed yourself. In addition, I have attached a parts list which will help you assemble the project yourself. The purpose of this project is to better the maker community with a functional design and thus is free to be built on a personal scale.

 

All this information is being released under the Creative Commons. Feel free to adapt and upgrade my code and designs but please attribute your inspiration by placing a link to www.projectlucidity.com in your work. In order to continue the progress of this project for the community, any works derivative of Project Lucidity must be released under the same open license to ensure everyone shares alike.

 

Please contact me directly if you have any questions about the use of the information provided.

Help buy me some coffee?

This site was designed with the
.com
website builder. Create your website today.
Start Now