Introduction: Arduino Colorful Clock++ Using Neopixel Strip

Picture of 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

Picture of 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

Picture of 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

Picture of 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!

Comments

SalilG2 (author)2017-09-02

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

ravijag (author)SalilG22017-09-03

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

SalilG2 (author)ravijag2017-09-03

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.

konux (author)2017-07-18

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

ravijag (author)konux2017-07-18

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

RaD0 (author)2017-05-15

sir, could you make short demo video?

ravijag (author)RaD02017-05-31

RaD0 (author)ravijag2017-06-02

Thank you! Amazing!

ravijag (author)RaD02017-05-15

Sure, will try to do this across a weekend!

HazemF (author)2017-04-22

you did a great job

I can't consider myself as a starter cause I'm beneath a starter and I don't have enough experience to judge your great work even I don't have enough experience to figure out what the problem with my own clock that I'm building

I'm hopefully asking to get the answer and the solution for my problem witch is : after uploading your code correctly without errors (that cost me a long time cause I faced errors with compiling but not anymore) when I connect the LEDs data wire to pin6 of the arduino pro mini nothing happen!!

there isn't any deference between connecting or disconnecting the data wire of the LEDs when I wire Vcc and GND to LEDs it works without programing

P.S: I didn't find LED strip sop I bought LED pixels

Thanks in advance

ravijag (author)HazemF2017-04-26

Hazem, your build looks quick good but am not sure if the wiring is right as there are too many wires in the only picture you have shared. Before you load my code, can u use the neopixel library example of strandtest and check if each LED is lighting up in sequence? Is power supply adequate? have u not by mistake looped the data in and the data out at the ends of the string?

Most of the time if you connect the strip to power supply with no signal, all LEDs will be off. In your photo i see almost all LEDs lit up...i may be wrong but pls check the wiring again.

I am sure with a bit of patience and simple debugging you will be able to solve the problem. Best of luck!

HazemF (author)ravijag2017-04-30

as i mentioned before i bought LED pixels cause i didn't find LED string unfortunately or I should say fortunately They came in pieces with 50 pixels I did as you said to try example of strandtest and I checked if LEDs are lighting up in sequence and I found out that the 50 pixels are not working properly with the code they are not usable anymore and here I want thank you so much cause I didn't know were the problem was until you suggested ... If you don't mind I'd like to know what is the 1000MF 16v electrolytic capacitor for ?? I couldn't see through your picture ..I know I'm asking alot I hope your generosity will make you answer me without anger about the ir remote after getting the hexa codes from the IR examples IRrecevDemo how and what should I do to include those codes into the sketch

Thanks in advance

ravijag (author)HazemF2017-05-02

HazemF

The 1000 MFD capacitor needs to be
placed across your 5V power supply to smoothen out the changing current needs
of the LED strip. It is optional. If your 5V power supply provides good power
regulation despite changing current needs you can ignore it. To be on the safer
side pls use it in your circuit. Connect the positive terminal of the capacitor
to the +5V rail and the negative (marked on the body of the capacitor with a
negative sign) to the ground rail of your circuit.

You can order your WS2812B strip
from Aliexpress (where i but a lot of electronics from) and they reach you in
1-2 months depending on the country you stay. Just search for the same in
aliexpress.com website or the aliexpress app.

https://www.aliexpress.com/item/DC5V-1m-4m-5m-WS28...

On the IR codes that you got for
your own remote: Pls identify which key on your remote you are nominating for
each of the clock function and note them down on a piece of paper. Against that
key, write down the code that you got from the IRrecevDemo experiment you
did. Then search for that function in my code and replace my hexcode with your
hexcode

Example:

In your setup, you decided to use button numbered “1” printed on
the remote and in your experiments using the IRrecevDemo code, you got a hex value
of say 0XFF1020 when you pressed the “1” button on the remote. Let’s presume
you have decided to allocate this button to increase the brightness of the LEDs
i.e the UP BRIGHTNESS function. All you now have to do is search for the key word
"UP BRIGHTNESS" in my code and you would have to replace my hexcode
i.e 0XF700FF with your code
which you have obtained earlier i.e 0XFF1020.

Do the same for all the key assignments and change the corresponding
values in the code and that should work.

This should do the work for you and if u still
have questions & clarifications, feel free to message me separately via the
profile page of mine.

HazemF made it! (author)ravijag2017-05-17

I really appreciate , I don't know what to say you really saved me with your helpful answers
thank you so much for your advice , I did it with digital output through LCD for people who can't read the LEDs time but unfortunately I wasn't able to use the LDR and the IR remote at the end it works !!

ravijag (author)HazemF2017-05-17

Great to see this!! You can publish that as a new instructable with the LCD display included!! way to go!

tytower made it! (author)2017-03-30

The code is good thanks . A lot easier to work with . I had to download the

https://github.com/PaulStoffregen/Time

library and also the

https://github.com/PaulStoffregen/DS1307RTC

libray to make it compile on my mini pro board.

I see you might get problems with the infa red library and the arduino distribution has RobotRemote library that someone has fiddled on there and it has to be removed first see here

https://github.com/z3t0/Arduino-IRremote/issues/98...

So mine is still messed up but by doing 3 changes like this

int RECV_PIN1 = 11; //connected to IR data pin
IRrecv irrecv1(RECV_PIN1);
decode_results results1;

and in all the places they are used I got it to run at least

ravijag (author)tytower2017-03-31

Great! the libraries i used were installed on my comp almost 6 months back for some other sketches. If u still have issues, pls let me know, i can share an offline copy of my library if needed

ravijag (author)2017-03-30

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

any suggestions?

rafununu (author)2017-03-28

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 ?

ravijag (author)rafununu2017-03-29

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.

ravijag (author)ravijag2017-03-30

Code attached as .ino

rafununu (author)ravijag2017-03-30

Thanxs. You well presumed. About Neopixel, they recommend putting a 470
ohm resistor in series with the data input, and it works. Regarding
power, on one of your pictures, at least half of the leds are white, a
quarter red and another yellow which makes 30*60 + 15*15 + 15*30 =
2475mA MIN with full brightness, arround 12W, a lot for a phone supply.

I perfectly know this feeling of "unaccomplished" when new ideas come to upgrade a product. The problem is that if you don't say "stop" at one moment, you'll never finish your work. There's always higher features available !

sumondigi (author)2017-03-28

what an idea Sir ji.good one

ravijag (author)sumondigi2017-03-29

thanks for your comments!

ravijag (author)2017-03-29

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)

MikeL90 (author)2017-03-27

I like the flexible bending strip idea, very neat and simple.

ravijag (author)MikeL902017-03-27

Mike, thanks for your comments! Yes i mulled over many options like laser cut acrylic strips, veneer strips etc for this ring structure and finally hit upon this simple & cheap solution ;)

About This Instructable

2,927views

59favorites

License:

Bio: Working in a IT services based organization handling people weekdays and handling electronics and code on weekends
More by ravijag:Recycled Razor Blades ClockArduino Colorful Clock++ Using Neopixel StripPure Binary LED Wall Clock With Arduino
Add instructable to: