Jun 03

Smart Timer gets a GUI!

By popular demand, I’m making Smart Timer easier to work with. The first step on this process is adding a graphical user interface. This will provide a one glance overview of the currently selected Smart Timer configuration file.

[notice]At the moment this GUI only updates when the config is saved.


Smart Timer Graphical interface

Consider the image above. It shows a working smart timer with 9 smart timer events, corresponding to expected REM episodes.

  • Green lines show activated events – these will play the reminders associated with them.
  • Gray lines are inactive events – they will not play event, but are still used to estimate when the subsequent events will take place. In the image above, the events at 1:40,9:20 and 11:00 are inactive and will not produce any reminders

[notice]For example, here’s the default smart timer configuration file with no events active. Because REM events are personal, the default config has all events disabled by default![/notice]

Default Smart Timer config

Above the lines are the reminder markers, corresponding to sound, vibration and light reminders.

[important]The colored cross markers appear when that type of reminder is active, and  audio file for the reminder is present, the vibration text is present and vibration duration is not 0.[/important]

If one of these is not

  • Red mark means that a voice reminder is ready to be played for that event
  • Purple mark = vibration reminder
  • Teal mark = light reminder

The position of the markers indicates when reminders would be played:

  • to the left of the REM event: on REM event start (like the events at 5:40 and 6:40)
  • Middle of REM event – after movement threshold was reached (like the event at 4:30 above)
  • To the right of the REM event: at the end of the REM event

When I delete the default reminder from the SDCard, the sound reminder marker disappears:

Deleting the reminder file removes the sound reminder marker

The Smart Timer is smart because it uses fuzzy logic to determine when events start and end! This is represented by the yellow and orange line under the event. Here’s how they work:

Yellow line represents user event logic, used to preserve spacing between events. Any user event (gesture drawn on screen) during that period would mean that the user is awake, and the REM event that was taken place before would be either cut short, or extended to end exactly when the gesture was drawn.  This means that if it takes you longer to fall asleep and enter REM, the Smart Timer would account for that.

For example I have an REM event set to start after 2 hours and 57 minutes after going to bed, and is set to last for 24 minutes. The next event is set to start 28 minutes later. Let’s say I’m thinking about the next release of the Lucid Dreaming App and it takes me longer than usual to fall asleep. So the REM event, instead of taking place from 168 to 192 minutes takes place from 178 to 202 minutes, and I report the dream by drawing a gesture at 202 minutes. Using normal timers, all subsequent timer events would be wrong – either too early or too late. But the Smart Timer recognizes my gesture and preserves spacing between the events – the next event would start 28 minutes later. Assuming that REM events occur at predictable time intervals, such method of adjustment is more accurate than blindly setting timers to go off after  a certain period of time.

Orange line uses actigraphy to estimate if the REM event should start prematurely. It looks for low intensity movements (Sleep score <4)  occuring within 12 minutes of the REM start time. If the sum of such sleep scores reaches 12 or more, the event is started prematurely due to low level user activity. Unlike the user event logic, this kind of logic is automatic and does not require user intervention. Currently the parameters are hard wired in: Threshold of 4, 12 minutes, 12 activity count.

Together, these two kinds of logic move the REM events over throughout the night, attempting to deliver the reminders in REM!


I intend to make all these parameters editable by user in the future.