Introduction: Arduino Colorful Clock++ Using Neopixel Strip
Features of the clock
- Arduino micro-controller based
- Hardware & enclosure procured from local stores
- RTC controlled by battery
- All functions controlled via IR remote control.
- Multiple modes of Display: Dot mode, Seconds arc mode, Minutes arc mode, Hours Arc mode, All Arc mode, Night mode(Auto dim)
- Hour alerts and auto mode change every 15 minutes
- Senses low ambient light and dims the LEDs to very low light levels
- Ambient light level adjustment to go to night mode
Step 1: Parts Needed
- Arduino Mini/nano or clone
- RTC module::DS3231 module
- WS2812B controlled RBG flexible LED strip with 60 LEDs/metre (Neopixel strip or equivalent make)
- IR Receiver:TSOP1738 38Khz
- Any spare IR remote control to use for controlling functions
- PCB header
- 10K potentiometer/Variable resistor
- 1000MF 16v electrolytic capacitor
- General purpose PCB/Veroboard
- 230V ac to 5V DC power adaptor (I used a mobile charger's circuitry.)
- Flexible beading strip (used to line furniture edges):Should be bendable but should retain a clean circle when bent (Avaialble in general hardware stores in bangalore)
- Hot glue gun
- Quick fix/Adhesive-Fevicol
- USB cable
- AC cable with 2 pin plug
- Single core wire to use as binding wire tags(i used strands of cat5 cable innards)
- Photoframe nail holder for hanging the unit to on the wall
Step 2: Connectivity and Building the Hardware
Coding: Pls see details in last 2 steps and ensure you have updated your remote control hex codes into the code and that the code is burned onto your arduino.
Electrical: Using a general purpose PCB and wires, i soldered them all together as per the schematic (See picture of schematic). Make sure that the IR receiver is soldered with flexible wires rather than on to the PCB as it can be positioned in the convenient place to receive the IR signals
Mechanical: I needed a circular shape to wrap the RBG LED strip around, so that the light from the LEDs spread out in a radial fashion and give a diffused look onto the hanging wall. Looked around for simple solution and found that i could buy meters of beading strips from my local hardware store. These strips are an inch and a quarter wide and are quite firm when rolled into a circle. Just spread the RGB strip on the circle and adjust the needed size and giving slight overlap of the beading, cut off extra length. Using adhesive stick the overlap areas and allow to dry.
Using similiar process wind another circle of smaller diameter which is spacious enough to fit the electronics and the power supply inside this ring. Drill small holes at the bottom and top of the inner circle strip to allow wiring to pass thru between the circles (see picture). I got a square hardboard which is 1.5 inches bigger than the diameter of the outer circle and trimmed the square corners to make it a circular hardboard. This will be my base of the clock.Once this is done, i placed both the rings on the hardboard (size 1.5 inches bigger than the outer ring) and trace the outlines and mark the holes @ 90 degrees using small punch. I removed the rings and using small drill bit, made holes on both sides of the outlines. These holes are going to anchor the rings to the hardboard.
Now i place the outer ring on the board and using single strand wires (salvaged from an old CAT5 cable-you can use any strong single strand wire which has metal inside to support the weight and twisting, making a narrow u shaped piece of wire, inserted the wire into the guide holes drilled and twisted them from the backside to hold the ring in place. Repeated this for all the holes of the ring. I repeated this for the inner ring as well. Once i ensure that the rings are in their correct place, using hotglue, i seat the rings in their place. I am securing the rings and providing the physical support with both the wires and the hot glue so that the structure is rigid. I made a small hole in the center of the hardboard (will be used to cover the entire clock with the acrylic cut disc)
Making sure that the hot glue has cooled and ensuring that all the needed holes are there in the rings and aligned, i affix the circuitry inside the inner ring area and secure the same with wires and holes (same as i did to the rings but slightly apart) so that the circuitry holds it's place and doesn't move when the clock plate is mounted vertically. I ensure that the IR receiver is fixed to the board such that it's sensor window is clearly visible from the front of the clock.
I rolled the RGB LED strip carefully clockwise (noting the signalling direction on the LED strip) on to the outer circle and if everything fits fine , i remove the adhesive backing from the strip and stick the LED strip to the outer circle. i ensured that the strip end connector was ending up between the 2 circles (see picture).
Next step was the connect the USB cable to the circuitry and connect the LED strip to the circuit and finally power up the 5V supply via 230V AC mains. I used an old mobile charger's circuit after stripping it's outer shell. Pls be careful here as it will be lethal 230V AC on exposed terminals. Take care to put enough insulation once you solder the mains power cable to the circuit board.
I ensured that the entire thing is working fine(power supply, LED strip etc) and then fixed the the acrylic circular disc drilled with a middle hole (see pic). this acrylic cover helps two fold: Helps spread and diffuse the LED light very beautifully and also allows my remote signals to reach the IR receiver sitting behind this cover.
Step 3: Before the Code
Code for my clock is embedded in next step. Almost all the functions and variables are labeled in code comments. Feel free to experiment with your editions or customization.
Before burning the code into your Arduino, you need to do some important editions to some of the hardcodings done in my code for ensuring that your code works with your IR remote control. Basically i have used an IR remote control to manage the clock remotely since i did not want any buttons on the clock. I had a spare IR remote (used to control LED strips) which was not being used. You can choose any remote as long as it is working and is not used to control any other device in the same room where you are going to hang the clock (as it may erroneously switch multiple devices when used). Next steps is identify which keys will be used for these functions on your remote: You need to have an IR remote with minimum of 12 buttons to map the same to the functions we are going to assign to those keys.
Just to simplify, whenever you press an IR remote, an unique hex code is sent via IR waves to your equipment (TV/Set top box/Receiver etc). Here we want to identify 12 buttons on that remote that we are going to use for controlling our clock functions and learn the hex codes they generate when pressed. We need to edit our clock code to ensure that the function that reads the IR codes coming via the IR receiver on the clock has these hex codes mapped.
How to get the hex codes and write them down to edit our clock code:
Pls use the below instructable to read the hex codes from the IR remote that you have chosen for the clock control and write the codes down for the corresponding 12 buttons that you want to use to control the clock.Use the first program only to identify your remote buttons' hex values. Use only this piece "Arduino Code for Receiving IR as Hex code" inside the instructable.
Once you have found out the 12 hex codes for the corresponding 12 remote button presses, pls edit the clock code to change my hex codes with your respective hex-codes obtained from your remote
12 functions i have mapped to my remote control and their hexcodes are below and the naming convention is in the below template
MY REMOTE button::0X HEXCODE of 6 digits:: Function assigned to the button
- UP BRIGHTNESS button ::0XF700FF:: For increasing LED brightness in regular mode
- DOWN BRIGHTNESS button:0XF7807F:: For decreasing LED brightness in regular mode
- R button::0XF720DF::All dots mode ( H M S are shown as moving dots)
G button::0XF7A05F:: Seconds Arc mode: All dot except seconds which will be in circle
- B button::0XF7609F::Minutes Arc mode: All dot except minutes in circle mode
- W button::0XF7E01F:: Hours Arc mode: All dot mode except hours in circle mode
- Flash button::0XF7D02F:: All circles mode (H M S): All in circles
- ON RED button::0XF7C03F::To toggle night mode on/off
- Yellow button::0XF728D7:: Night value threshold increase to adjust the sensor to ambient light conditions to sense nightmode (advanced setting-you may not need to use)
- Blue button::0XF7A857:: Night value threshold decrease to adjust the sensor to ambient light conditions to sense nightmode (advanced setting-you may not need to use)
- FADE button::0XF7C837 :: Increase brightness setting of Night mode
SMOOTH button::0XF7E817::Decrease brightness setting of Night mode
Step 4: Here Is the Code
Attached is the arduino file for the code. Comments are self sufficient
Step 5: Evolution/Improvements/Enhancements
What started off as a simple circular LED clock evolved across few months with various ideas and changes coming into my mind as i sat down to code in my limited freetime and weekends. I started off with a push button for clock mode change and a potentiometer for adjusting LED brightness and later improvised functionality and started adding features. I removed the buttons and potentiometer and used a IR receiver and added code to allow all adjustments of brightness, mode and night sensitivity adjustments using IR remote keys. Added some auto features like auto mode change every 15th, 30th, 45th and 58th minute, night mode on low ambient brightness etc.
Other enhancements that can be done are : Time setting/changing using remote, syncing to any external timesource using additional circuitry (for US geo with time servers).
You can edit the code and make your customized clock!! Enjoy!