Childs Sunshine Alarm Clock
Eli sleeps with a little Gro Clock in his bedroom, for those that don't know it's an alarm clock the switches between a day and a night image so children who can't tell the time know when it's acceptable to get up in the morning. I would recommend them. Sadly I left ours at Grannies after the weekend and Eli wasn't keen to sleep without it. So I rummaged round the garage, found some parts I knew were out there and knocked together this arduino based version of the same clock. Being Arduino relied on the existing libraries to write the code quickly.
Components:
- Arduino Nano V3.0
- 16 LED NeoPixel Ring
- DS1307 Real Time Clock
- Mobile Phone Charge power supply
Wiring:
- Power for the whole arrangement comes through the USB connection
5V, GND from both the RTC and the Neopixel Ring are connected to the Arduino. - Data in from the Neopixel Ring connects to Digital input 2 on the Arduino
- SCL of the RTC goes to Analogue input 5 on the Arduino
- SDA of the RTC goes to Analogue input 4 on the Arduino
Libraries:
- Wire Library - for connecting to the RTC with I2C
- DS1307RTC Library - for understanding what the RTC says over I2C
- Time Library - lets the Arduino understand times
- TimeAlarms Library - executes functions at specific times/intervals
- FastLED Library - for communicating with the NeoPixel ring
Code:
Full source is available for download from here
- The first lines of the setup function define the time that the alarm will go off
- The RTC and Neopixel ring are initialised
- Two alarms are created, one at the time previously specified another an hour later
- The main loop of the program does nothing except create a delay that keeps the timer ticking
- LightsOn function, creates the short sunshine animation when the alarm goes off
- LightsOff function, switches the LED's back to night time colour