Saturday, June 6, 2015

DIY Bedroom clock

Before I continue with my rants, let's change the subject and brag a bit.
Here is the first useful thing I did with arduino:






 It is a night clock for the bedroom, with the following features:
- Auto brightness, so it is very dim when the lights are off and bright enough when the lights are on (or just during the day)
- Remote controlled (I use an AppleTV remote to control it)
- Can show room temperature (at a touch of the button on the remote)
- Night light (2 white LEDs, toggled on/off from the remote), bright enough so you can see in the dark, not too bright to be uncomfortable when you turn it on in the middle of the night

Yes, that is a sword on top of the TV. It was already there before I made the clock :)

Parts list (with links to buy and approximate price):
Arduino nano clone, ~$3
4x 8x8 dot matrix panels, $9 for 5 pieces (and I managed to screw one up)
Real time clock module, $1.86
Temperature sensor, $1 ($0.70 if you buy 3)
Light sensor, ~$0.07 (20 pieces for $1,35)
Infrared sensor, $1.60
- Proto board, jumper cables, resistors, headers - maybe $5 (I had these lying around already)
Total parts cost: less than $22
This is without the Apple TV remote (but I could use any IR remote, the Apple TV remote is very nice though and I didn't use it anyway)

Making it was pretty straight-forward. The only problem was dimming the LEDs as much as possible (so they are not too bright when it is pitch black). When soldering the led matrix kits, I used 100K resistors (instead of the provided 10K), which helped reduce the brightness, but not enough. The chip which drives the LEDs has brightness control, but even at the lowest setting they were still too bright. So i had to do a kind of software PWM on the chips' enable pins to dim them further. If you don't know what PWM is - basically you turn something (like an LED) on and off very fast and it appears dimmed. In my case, there was a limit on how long I can keep the chips disabled (off) without getting a visible flicker. But for now it is ok.
The other problem was that reading temperature from the temperature sensor is quite slow. It wouldn't be a big deal if I didn't have to manually turn the LED driver chips on and off every millisecond or so. So I ended up disabling the PWM while displaying the temperature. The side effect is that when it is dark, the temperature is displayed brighter than the time. Not a problem, really.

I am thinking of using some kind of dark film in front of the LED matrices to physically make them dimmer, which would allow me to get rid of the software PWM voodoo and achieve even lower brightness. All this is because my son doesn't like when things glow too bright in the bedroom. But even now it is good enough. I even added an "on/off" button on the remote, so he can just turn it off, but he doesn't use it, so it must be OK.

In the future I might add some wireless capabilities to the clock (like a WiFi or bluetooth chip) and have the clock connected. I just don't have any good idea what I'd use it for, so for now it is just an unclear plan for the future.

That's it, it is not much, but it works, it is complete and it was the first thing I have done with arduino that is actually useful (not just experiments).

And I am loving it! :)

No comments:

Post a Comment