For our Physical Computing mid term project we were tasked with developing a piece of our choosing, over the course of three weeks, that would usefully apply the fundamental principles we’d learned to date.
After exploring new sensors we’d not encountered yet in class, we decided to use a 3-axis accelerometer (ADXL335) to monitor sleep patterns, and represent sleep in a physical way (as opposed to on screen). We would use Servo motors to control wooden dowels, with their position related to the depth of sleep. The more restless the sleeper, the more the accelerometer would move, representing lighter sleep. The vice versa would also be true, representing deep sleep.
Before determining the physical form, we experimented with the sensor, motors and code. The challenge was to capture movement over time, and map this to the Servo angle. We would need to monitor time since the Arduino program was started, and progress from one Servo to another as each hour passed (we used a variable to make an hour pass in just 30 seconds for demo purposes).
With the code mostly complete and proven, we began building the wooden box from plywood. We would house the Arduino and a PCB board, onto which we would migrate the circuit from the breadboards, under a shelf. The motors would go on the shelf, with dowels pointing vertically through the roof.
Here’s a diagram of the board:
We recognized a small design problem. On waking, you wouldn’t know the length of your sleep as the dowels would have to be in one position or another. If the seventh and eighth dowel were at 90 degrees, this could mean moderate sleep or that the program had not reached those motors yet. We added LEDs to gently uplight the currently moving dowel, so if the fifth dowel was lit you’d be in the fifth hour since the program began.
The project was mostly successful. Unfortuntately the small Servos have a tendency to vibrate or make noise, which is clearly undesirable for something that should sit quietly and stably on your night stand. We also had a lot of wires to squeeze below the shelf, we could perhaps have managed the space a little better. The project validated the concept of a physical sleep sensor, as a prototype, but it would be good – if we were to progress further – to refine the physical form.
Arduino code can be found here.
My partner on this project is Sam Wander.