• Sunday10AM–7PM
  • Monday10AM–7PM
  • Tuesday10AM–7PM
  • Wednesday10AM–7PM
  • Thursday10AM–7PM
  • Friday10AM–7PM
  • Saturday10AM–7PM
Call Us:    9404844825

Work Desk Mood Lighting – Follow Up

  • Difficulty Easy Moderate Difficulty
  • Share
  • Steps 5
  • Time Required 3


Hi! Welcome to this follow up instructable. I will be covering few points and ideas which I think I might have missed in the previous instructable. If you don’t have a clue of what I am talking about please click on the link here to see the instructable.

Step 1: Barebone Arduino

First let me explain about my Barebone Arduino build. This is a simple perf board which has a zif socket mounted in. Ideally I should just be a 28pin zif socket but I was in a hurry and the shop did not have the one I required. So I had to buy this one instead and just use the top 28 pins.

I also have these screw terminals here in which I have connected the crystal and the pico farad capacitors. I have used these instead of soldering them directly because if I want to experiment some day with a 8MHz crystal then I should be easily able to swap it.

Why use screw terminals you may ask? I could have simply used female headers. Well I tried but it wasn’t making contact properly because the thin legs of these capacitors. So I swapped them with these. Now I can be sure that these are always connected.

Step 2: Board Design

In my previous video I showed you the schematic of Elco Jacobs. But I split that into two modules. One is the ‘Controller Board’ and the other is the ‘Shift register board’ which connect to the LED.

I split them into two for easy troubleshooting and mass production. Well not mass production but just 5 boards. Anyway! Here is the controller board which has the Atmega328 chip and the rotary switch. Because I will be using a DC Socket and external switch like these ones I kept them as screw terminals in the design. Also after the code is processed I need to send them to the Shift Registers. For that I have used some more screw terminals which are +5V and GND and the Data, Latch and Clock pins. So a bit of pre planning before you print your board design is very much helpful.

From here I will be connecting these terminals to the shift registers with the help of ribbon cables. This board has just the shift registers that are connected to the RGB LEDs. Here are the incoming 5v, GND, and other three signal connections which are connected in parallel. Here you can see them connected in parallel. Because my board design is only single sided not always you get 100% routing. So i try my best to reach 100% if not then I make it as close to as possible. Here you can see that these leads are not connected so after I print the circuit I use some wires to manually connect them. This is one drawback of in-house PCB production. But the other controller board does not have this issue. It was a 100% routing and worked out well.

Now here is the Data cable that is fed into the first Shift Register and the output of the last is connected to the output lead. The rest of the connections are in parallel but just because of this one line you cannot connect this board in reverse or it wouldn’t work. So I marked all my boards are In and Out.

Step 3: Frequency and the Power of Atmega328

Elco Jacobs in his code has suggested that we keep the signalling through SPI pins so that it’s much faster. But I am using about 15 shift registers and this really long setup. So even with SPI the Arduino started having issues to send signals to all. Luckily Jacobs has the solution to this problem.

Here it is. Here he suggests that by changing the values and if it turns green then it means that we have a functioning code. So lets turn up the Crystal. I changed it to 32MHz and it seemed to solved the problem. Well not actually. Because when I put it together on the breadboard the Arduino did not accept the crystal. Infact thats why I built my barebone Arduino board. To test with different crystals.

Changing the brightness did not do much so I changed the frequency. As it is defined here frequency defines the speed at which the colours change and I found 50 to be the best frequency. Any less than this then I was able to see the flickering happening. So remember to dial in these settings and make those changes in your arduino program.

Step 4: How Does the Rotary Switch Works?

In my last video explained the inner working of the rotary switch. What I forgot to explain was why are there so many resistors. These are called as pull down resistors and they are connected to Ground. When Arduino tries to read the value of the switch it needs to be either zero or one. One being the on state and zero being off. Much like 5V being 1 and ground being zero. So what these resistors do is pull down the value to zero. And when the switch is turned because the reading end is connected to the resistor instead of ground the positive 5volts is pushed into to arduino thus giving a one. Without this resistor all you will get is floating value.

Optionally we can use a potentiometer instead of the switch. But here we will be connecting the reading pin to Analog input pin instead of Digital. Because analog gives us values between 0 to 1024 we can divide into 5 in our code and use that to change state of these 5 LEDs like this.

You can download the code from here.

Step 5: Conclusion

Finally why the count of 5 boards. Because each board was designed to take in just 3 shift registers with a total of 8 LEDs I needed 5 boards to make the forty LEDs. And for the power supply I could have totally gone away without using a voltage regulator and instead used a 5V 2amps power supply. But I had the 12v laying around and its very common so I used that.

Thanks for reading the instructable and please subscribe if you haven’t. Follow me on instragram to see my latest builds. Until next time. Happy learning.