5 LED RGB Box Using 2 8-bit Shift Registers and Bluetooth

by t_Jongman in Circuits > Arduino

92 Views, 0 Favorites, 0 Comments

5 LED RGB Box Using 2 8-bit Shift Registers and Bluetooth

image_2024-03-25_134207508.png

The goal of this project was to make an array of RGB LEDs and control them with Bluetooth.

The reason for undertaking this project was to create more "Rainbow Barf" for my gaming setup.

Supplies

For this project I used an android device, but it can be also done with a windows device.

Electronics:

1x lighter

1x scissor

1x soldering iron (I used one with 25W)

1x soldering tin (I used 0.8mm thick, 60%SN 40%PB with 2% flux resin core)

1x Arduino Uno

1x HC-05 Bluetooth module

2x 8 Bit-shift register 74HC595

5x RGB LED common cathode

10x 100 ohm resistor

5x 150 ohm resistor

1x 1k ohm resistor

1x 2.2k ohm resistor

1x USB-B male to USB-A male 2.0

Heat shrink tubing

A LOT of jumper wires(to strip and solder to LEDs/resistors)

5x male-female jumper wire to attack on Bluetooth module.


Box: (MDF and Perspex 3mm thick)

1x hot glue gun

1x wood glue

1x acrylic adhesive

2x clamp

MDF:

3x 120x3x80mm planks

1x 120x3x80mm plank with a 40x20mm hole in the middle of it.

1x 80x3x74mm plank

1x 80x3x74mm plank with a 20x40mm hole centered and 2mm above the bottom edge

2x 60x3x10mm planks

1x 54x3x10mm plank

1x piece of MDF that can fit 5 LEDs on it, and fit inside a 40x20mm hole

Perspex:

3x 34x3x20mm planks

2x 14x3x20mm planks

Setting Up the Bluetooth

image_2024-03-25_000429887.png

Attach the Bluetooth module to your Arduino as seen in the picture above. And power up the Arduino.

The Bluetooth module will be blinking at this moment, this means it is not connected yet.

Search for the module(named HC-05 by default) on the device you want to control your Arduino with, in my case I used an Android Tablet.

Most likely the module will have a passcode, it is normally set to 1234 or 0000. Try both to see which one it is. If these don't work you should contact the manufacturer of your module.


On your android device install the app "Serial Bluetooth Terminal" from the playstore, via this app you can communicate with your Arduino.

Once in the app, go to devices and select the module.

Setting Up the LEDs

image_2024-03-27_171820999.png
image_2024-03-25_010315804.png

The picture above shows how to wire up the 8-bit shift registers(IC).

A shift registers is technically an IC(integrated circuit) consisting of 2 registers. In this section I will refer to them as IC instead of "shift register". For more information on this, visit the link at the bottom of this section.

To summarize:

Arduino pin = AP

IC pin = ICP

ICP Qa-Qh are for connecting the LEDs. It is very important to connect them in the right order, A -> B -> C etc.

ICP 16 and 10 need to be connected to the 5V+ line.

ICP 8 and 13 need to be connected to ground.

AP 13 to ICP 11 on both registers.

AP 11 to ICP 14 on the first IC only.

AP 8 to ICP 12 on both IC.

ICP 9 on the first IC to ICP 14 on the second IC.


Shift registers are very handy tools, but to explain how they exactly work is not in the scope of this project.

What a shift register does in short:

The shift-registers function is to use a few pins on the Arduino to control a larger amount of output pins for the LEDs.

It does this by converting a single serial-output into multiple parallel outputs.


A more detailed explanation of how it exactly works can be found here

The Code

Most of the code that is being used was written by Elco Jacobs

I did some very minor modification to include the Bluetooth functionality.

Included is the .ino file for the code. While Elco has written very inclusive comments in the code some highlights for extra attention:

```

unsigned char maxBrightness = 100; turn this up or down to make the LEDs brighter or less bright. max: 255

unsigned char pwmFrequency = 100; turn this up or down to make the LEDs flash faster(PWM)

unsigned int numRegisters = 2; Make this the amount of shift registers you are using, in this project we are using 2, but its possible to use a lot more!

```

Elco's GitHub with the ShiftPWM repository can be found here



Soldering the Registers

image_2024-03-25_014423386.png
image_2024-03-25_015519918.png
image_2024-03-25_014909925.png
image_2024-03-25_015603138.png

Start of with cutting of the tips of some wires and stripping the cables to the bare metal in side like shown in the picture.

This can be done by carefully cutting into the wire but not all the way through. Went there is a dent in the wire after the cut, move it around a bit/bent it at the place of the cut. This will break the outer layer and reveal the metal inside. Do this until you have enough wires to solder onto the legs of the registers.


It is advised to keep a colour code in place so you remember what wires needs to go where. Once you have soldered a wire onto the register place some heat shrink tubing on it and warm it by holding a lighter under it(DO NOT hold the tubing in the fire itself!), this is to prevent you from shorting the circuit when soldering the other legs. repeat this until you have wired both registers completely.


Work from right to left on one side and then the other side. Soldering a leg between 2 other legs that are already soldered is significantly harder then when one side is still unsoldered.

It is also advised to use some sort of vise/grip to hold the register in place while soldering the wires unto it.

Soldering the LEDs

image_2024-03-25_015744846.png
image_2024-03-25_015651861.png

The LEDs we are using are common cathodes, this means that the negative pin is shared by all 3 LEDs inside. The negative leg is the longest of the 4, as shown in the picture.

Start by soldering the resistors in the R,G and B legs. The red LED gets a 150 ohm resistor the other 2 get a 100 ohm resistor. After you soldered the resistors, solder a wire on the cathode and put heat shrink tubing on it.


The reason why the resistors don't need tubing on them is because these wont be getting all tangled up inside the box and are therefor very unlikely to short the circuit.

Soldering the LEDs to the Registers

Now solder all the wires coming from the registers on pins Qa-Qh unto the ends of the resistors that are connected to the LEDs. Important: Keep in mind that this needs to be in the correct order (Qa-Qh of first register then Qa-Qh of the second one) otherwise it will mess up the colouring of the LEDs when it turns on.

This means that register 1 will have the first and second RGB LED + the red and blue LED of the third RGB LED.

Wiring Multiple Wires Togheter

image_2024-03-25_021136517.png
image_2024-03-25_021209497.png

Some wires connections have multiple wires, like the 5V+ line and the ground line. To wires these easily do the following:

Grab all the wires that need to be wired together and twist all the ends together.

Put some solder against it so it will stay together.

Then grab a larger piece of heat shrink tubing and put it over the connection.

Heat the tubing and pinch the part where the wires are close.


Make sure to include the 5V+ line for the Bluetooth module now as well, otherwise you will have to add it to the group later on!

Wiring the Bluetooth Module

image_2024-03-25_022156135.png
image_2024-03-25_023420987.png
image_2024-03-25_023032389.png

I did not solder the wires onto the module itself, instead I used female-male jumper wires. This is because the legs on my module are thick enough to not get lose. If your legs are smaller, you might have to solder them on instead.


The only soldering done is on the RDX and ground wire. These were a bit funky, I provided picture for clarity

Make sure to always cover the messy soldering with heat shrink tubing so nobody will see it.

Testing the Code

With all the wires soldered, plug the wires correctly into the Arduino. When starting up all LEDs should be off. In the serial monitor in the Arduino IDE there is a menu with numbers. Depending on what number you put in, the LEDs will light up differently. Now type a number into the serial monitor of your android device and the LEDs should turn on with the selected preset if everything is soldered correctly.

If this is not the case, look at what is wrong. Is it just a single LED that isn't working, are multiple not working, is everything on a register not working etc. Try to determine what is piece of the puzzle isn't working. Check those connections, and re-solder if they broke lose or remove excess solder, clean the connections and re-solder if they are shorting.

Once everything works you can move on to making the box.

Making the Box

image_2024-03-25_023714012.png
image_2024-03-25_024723757.png

To make the box, add wood glue on the pieces and put it together. Start with the 2 longer sides. Put a royal amount of glue on the bottom of the long sides and clamp them on the bottom piece. If there is glue on the outside of the box you can wipe it away with a piece of paper. If you have only 1 clamp do them 1 at the time.

Wait long enough for the glue to harden, this is different from glue to glue. Make sure you check what the curing time is for the glue you use!

Once both long sides are on and secure, put in the smaller sides. Put glue on the bottom and sides of the piece and slide it in, it should fit in snugly. Then clamp it tight

Once both small sides are in place, get the hot glue gun put some on the bottom side of the small pieces. Make a square around the side with the hole in it, your Arduino will sit here. You can fill the empty space between the outer and inner wall with hot glue, this will add some structural strength but is not necessary.

Attach LEDs to a Plank

image_2024-03-25_024952927.png

Glue the LEDs on the top a small plank that can fit inside the top hole. put the plank between the 2nd and 3rd leg and use a royal amount of glue to make sure it stays put. Wait for the glue to cooldown before attaching another LED.


Glue the Perspex

image_2024-03-25_030047516.png

Sand the edges the Perspex where you are gonna put the glue then glue the pieces of Perspex together into a open box as shown above with acrylic adhesive, do not round the edges. and let it cure for a few hours to make sure the bond is strong

Warning: you dont want this glue on your hands or eyes. It is recommended to wear gloves and eye protection.

Gluing the Top Part

image_2024-03-25_133123310.png

Again, sand the Perspex on the place where you are going to glue.

Put glue on the edges of the Perspex box and place into the hole. Wait for it to harden, then place the top with the Perspex on the box. Put wood glue on the edges of the box and push the top down on the other part.

Once its in place clamp it down on two opposite sides.

Once its dry and secure you can put some hot glue around the Perspex to strengthen the bond with between it and the box.

Final Test

RGB Box

With everything now in the box and everything glued tight, power up the Arduino and test it out!