I spent a bit of time over the weekend building a breadboard prototype of the design as well as writing the firmware. I've added the link to the firmware github repository over on the left hand side of the project page - MIT license.
The night lamp works like this:
- There are four buttons - dimmer, brighter, change colour, "random mode"
- You can change the brightness up and down with the first two buttons
- The third button cycles between white, red, green and blue light
- The fourth button does one of two things: (a) if the lights are dim it pulses a slow "sleepy time" pattern, or (b) if the lights are bright it does random colours for random periods of time.
- The colours and brightness values are "Lerped" http://en.wikipedia.org/wiki/Lerp_(computing) so that they gradually change rather than all at once
- I've set it up so that light shows can be "programmed" in as well as allowing random ones.
There are a couple of issues with the firmware still to be sorted out, a signed char somewhere is causing havoc with high brightness values and the time periods for programmed light shows aren't being correctly parsed. I'll sort these out eventually.
In the meantime my wife has been looking into the housing for the lamp. We are considering sculpting something from Polymorph plastic at this stage because its easy to use, relatively cheap and has a nice diffuse effect.
I've ordered some parts and boards so will return to this project once parts start arriving.