So now the sensor unit rests under my pillow and the main box on my bedside table (and the printer on the floor beside it). In the end I had to create my own with a MAX232 and a few caps. I invested in a couple of “level shifter” boards but none of them worked. I quickly found that the Arduino couldn’t drive the RS232 levels appropriately. I found a relatively cheap thermal-transfer printer online (an NCR Receipt Printer, $NZ31) and hooked it up. SleepyTimer - Graphs by funnypolynomial, on Flickrįrom day one I had the idea of producing a hard-copy of a night’s session. The banding also fits well with printing. Rather than allocate enough RAM for the entire image I create an 8-pixel high band and repeatedly render the the graph into it, and send the bands to the LCD. I display the movement as a bar graph with some simple stats: the Total time asleep (the number of bins with no movement) and the Max period of uninterrupted sleep (I have yet to see more than an hour). The bins, along with some header information (date, start and end time etc), are recorded as a rolling list of 8x 128-byte “pages” in EEPROM.Ī simple menu system driven by two buttons lets me navigate through settings etc and view a monitoring session (i.e. Motion within a bin is considered “wakefulness”. The motion spikes are averaged within each bin. The monitoring session is binned in to 120 6-minute periods. Motion is detected when a new reading spikes more than a threshold amount from the rolling average. When in sleep-monitor mode all three IMU axes are sampled regularly and the values are added to independent rolling averages. SleepyTimer - LCD Driver by funnypolynomial, on Flickr Four of the 595’s outputs are data, two are control (SCLK & CS) and one is used to drive the backlight (one output is unused). So I eventually got the LCD working with just 3 Arduino pins by driving it with a 74HC595. Dropping down to 4-bit parallel still requires 7 precious Arduino pins and, just as important because I wanted the LCD to be a separate module, 7 connections (plus Gnd and VCC!). Parallel did work but pin-use resentment kicked in. I could not for the life of me get it to work with the serial interface (grounding PSB always seemed to reset everything). The graphics LCD is this ST792-based one: (“QC12864”). It’s connected to the main unit in a cheap plastic container (oh joy, tons of space!) with the Arduino, a graphics LCD, a DS1307 RTC, buttons etc. SleepyTimer - Bedside by funnypolynomial, on Flickr SleepyTimer - Interior by funnypolynomial, on FlickrĪ tiny 3-axis accelerometer board sits in a small case at the end of a ribbon cable. SleepyTimer - Assembling by funnypolynomial, on Flickr SleepyTimer was my project-a-month ( ) for May: Not sure exactly how it works, and I didn’t find out (where’s the fun in that?). You leave the phone under your pillow at night and it uses the built-in IMU to sense movement and produce a graph and stats about your sleep patterns. So, when a co-worker showed me a sleep monitoring tool on her smartphone a few months ago I thought “Arduino Project!”. Not sure what it is, perhaps mild apnoea, but I never seem to wake up refreshed. I’m a terrible sleeper – always have been.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |