Quite a while ago I had the idea to create a pillow with a Lilypad MP3 . The „Sleepy Pillow“ should play songs at random for approx. 45 minutes and then power down as good as possible to save battery.
The Lilypad MP3 is an Arduino board that takes an SD card with audible files and plays them with speakers attached.
This is how the Sleepy Pillow was realized:
make it happen
First I set up the main components with alligator clips before sewing. That way the source code could be conveniently tested.
I put something below the speakers to prevent them from vibrating too much while testing.
From my song collection I chose several songs in MP3 format and placed them on the mini SD card using an adapter. The filenames are consecutive numbers.
When the source code was working so far I started to sew the components on the fabric I selected as a pillowcase. For the LiPo I created a small bag.
I added a switch for turning the power completely off manually.
The Lilypad MP3 can not play songs when attached via USB to a computer. Only serial output can be seen! The player starts to play the files but the playback stops after a few seconds. The reason is that there is not enough power to drive the speakers via USB. An additional power supply such as a LiPo is required. The program can only be fully tested attaching a battery to the Lilypad.
The audio files on the SD card may be of the type MP3, WAV, MP4, FLA, OGG, WMA or AAC. The filenames should be in the format 8.3 which is up to 8 digits for the filename and 3 digits for the file extension. I went for consecutive numbers as filenames to ease random selection.
the source code
how it works
When the Sleepy Pillow is turned on it starts to play songs from the SD card at random. The music stops after the desired time limit is reached. Then the Lilypad MP3 is „put to sleep“ to save battery. Additionally it is possible to use the power switch…
The volume is automatically turned down approx. 10 s before the time limit is reached.