Arduino Colorful Clock++ Using Neopixel Strip

4,852

62

26

Published

Introduction: Arduino Colorful Clock++ Using Neopixel Strip

About: Working in a IT services based organization handling people weekdays and handling electronics and code on weekends

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

Electronics:

  • 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
  • LDR
  • 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.)

Hardware:

  • Hardboard
  • 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.

https://www.instructables.com/id/Arduino-IR-Remote...

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!

3 People Made This Project!

Recommendations

  • Clocks Contest

    Clocks Contest
  • Water Contest

    Water Contest
  • Oil Contest

    Oil Contest

26 Discussions

Thank you.Iprogrammed the RTC separetely AND EVERITHING WORKS FINE !

Mr Ravijag i am from Greece. I made this project with the old code from instructables and works fine.but if you like send me the latest code because the pdf is corrupted.We have the same remote control.Do you tell me the hex codes for time set buttons ?

nasos15

1 reply

Hi there is no new updated code available. There is no button to set time in this clock. The RTC has to have the correct time programmed into it before fixing it in the circuit.

Hi, nice work, i am about to make it my self, just waiting for missing parts to arrive, but i have a problems understanding your hand drawn schematic , can you please make easier to understand one? Like on a pc or one like GreatScot draws? Would really appreciate.

1 reply

sorry but could not get time do a formal schematic etc. Just let me know which part u did not follow or need help and i can sure guide you for that

exit status 1

Error compiling for board Arduino Nano.

how to solve this problem

1 reply

Pls check code again for errors while copy pasting. it works with nano or mini as well as uno

Hi Ravi,

I am very new to the programming and using of arduino. Though going with your instructions, I have made the whole project work just as you intended it to be. My issue here is that I want to change the colour of the LED's for H/M/S, as I am not well versed with the code, I am getting no clue about this. If you could tell me how to do that I would be really thankful.

Anyways would have to thank you to make my first project successful.

Thanks

2 replies

Dear Salil

Firstly congratulations on building this successfully on your maiden effort! That takes lot of effort and i really appreciate that!!

The code i have written uses 3 arrays to define Hours Mins & Seconds as hled[], mled[] and sled[] and use computation to put a 1 in the places where i want to light it up based on the current time and the mode.I use a function to just write these 3 arrays into the LEDs using writepixels() function.

you can tinker with the order of the same arrays being written in the below call and experiment to change the H M S colors:: write_pixels(&hled[60],&sled[60],&mled[60],bright); //Red=hour, Green=seconds, Blue=minutes order. Unfortunately i have not put a provision in my code to mix colors(say hours to be shown in orange or white etc) other than these 3 primary colors for simplicity.

Hope this helps move you forward in your endaevor to change and customize your clock

Thanks a lot Ravi. For now I am good with these colours. But will surely try to learn and make it customisable. Learning in the process.

Your instructable was pretty easy to understand, unlike many others. Thanks.

0
user
konux

1 year ago

He Ravijag,

Great project and nice animations. I got a question, is it possible to add an ESP8266 instead of the DS3231 module. Im currently using a simple version of the clock on my ESP8266. Like to add your animations into to it.

Let me know if you got plans to inplement an ESP8266.

Keep up the good work.


Kind regards,

Koen

1 reply

Hi Koen
Firstly thanks for your compliments!
Unfortunately i have not tinkered with 8266. Code is freely commented so feel free to experiment and cut and paste parts as needed as most parts are in functions
best wishes
Ravi

0
user
RaD0

1 year ago

sir, could you make short demo video?

3 replies

Thank you! Amazing!

Sure, will try to do this across a weekend!

thanks for pointing out my error which occured when i tried to paste code into a browser window.Code attached as .ino

any suggestions?

Please remove this ugly code unreadable and incorrect, which compiler will accept five include statement without any library declared ?

Which phone charger is able to deliver 3.6A / 5V, let's say 18W ?

Where's the schematic ?

2 replies

The code got corrupted when i did a copy paste into the instructables editor as it considered < > as special instructions and deleted them. Will be shortly giving a link to GitHub (just got an account created)

Phone charger i used was for a phone called micromax and since i don't switch on all LEDs at all times, i don't need the peak current to be drawn. it works fine with no heating issues.

Schematic is in pictures in step2. I presume you missed seeing the pictures.