Coming up, I have some possible projects in mind that would require using a shift register to drive many LEDs. I don’t have a lot of experience with shift registers, so I thought I would start with a smaller 16 LED project. This post will explain how I created a small 3d printed Christmas tree to sit on my desk.
I should note I don’t consider this a finished project. Instead, it is just purely a development prototype. I didn’t even take build pictures for this post as I usually would. I never planned to do this post. But a friend who is getting started with projects like this. He wanted a post done to show what went behind make the tree he noticed in a zoom meeting.
Going into the 2021 Christmas season, I’ll probably make something a bit better designed. For 2020 this works fine, however.
Here is the list of parts I used in this project.
- Arduino Nano without headers
- Small prototype PCB board.
- 4 red 5mm LEDs.
- 4 yellow 5mm LEDs.
- 4 green 5mm LEDs.
- 4 blue 5mm LEDs.
- 16 270 Ohm resistors.
- 2 – 74HC595 shift registers.
- 2 – 16 pin DIP IC sockets.
- 2 – 10uf electrolytic capacitors.
- 2 pin PCB terminal block.
- DC barrel jack with pigtail.
- 22 AWG wire.
- Various size shrink tubing.
- 3 – 6 pin JST-XH female connectors.
- 3 – 6 pin JST-XH male connectors.
- 5V DC wall wart.
Additionally, I had prototyped this all on the breadboard ahead of time. Plus, I used tons of solder getting this all connected.
Here is a Fritzing file showing how I hooked this all up on the breadboard. Additionally, I used this exact setup to solder everything together on the PCB.
Soldering it all together
I originally intended to use this with a small Christmas tree I found on Thingiverse. I went with a small PBC, thinking I could get it fit in there. But I was wrong. More on that later. I just wanted to explain now why I put so much on a little prototyping PCB.
I forgot to take pictures during this step. But basically, I just transferred the Fritzing design to the PCB as I soldered.
Here is the order I went in:
- Soldered the IC sockets to the PCB.
- Soldered the male JXT-XH connectors to the PCB.
- Connected the JXT-HX pins to the IC socket pins with small jumpers.
- Soldered a capacitor next to each socket.
- Ran the positive and negative connections from the IC sockets to the appropriate leg of the capacitor. Bent the pins and soldered them to make these connections.
- Soldered 2 pin terminal to the PCB.
- Connected used jumpers to connect each capacitor to the appropriate pin on the 2 pin terminal.
- Soldered the connections from the ICs to the Arduino.
- Only the first shift register is hooked directly to the Arduino.
- The latch and clock pins are jumpered over to the second shift register on the PCB, where those pins connect to the first shift register.
- I also soldered the data connection to the second shift register at this time.
- Soldered the power and ground from the Arduino in line with the 2 pin terminal on the PCB.
- Connected the DC barrel pigtail to the 2 pin terminal.
The above isn’t as bad as it sounds. The only part of it that was bad is that I was doing it on the way too small of a PCB. The future version will have some breathing room.
The other half of the electronics build was to get the LEDs all hooked up. Here are the steps I took to do that.
- Cut the anode of each LED short. (I only did the Anodes at this time to ensure I didn’t get any reversed).
- Cut both ends of each resistor short.
- Cut red wire for each LED about 6 inches long.
- Soldered the resistor to the anode of the LED.
- Soldered the red wire to the other end of the resistor.
- Soldered each red wire to the appropriate pin of the JST female connector.
- Put shrink tube over each resistor and LED anode leg.
- Cut the cathode of each LED short.
- Soldered a few inches of black wire to each cathode.
- The first one I soldered actually had about six inches of black wire.
- Created 15 black wires about six inches long.
- The black wire from the first LED and one of the black jumpers I created were soldered to the 2nd LED cathode. A shrink tube was used to cover those solder joints.
- This whole process was continued one by one. Each LED’s ground lead connects to the ground lead before and after it in the order.
- The last LED was soldered into the last pin of the third JST connector. That left one free pin in the JST connector (I should have used a 5pin housing instead of a 6pin housing).
- The JST female connectors were connected in place to their male partner on the PCB.
That basically sums up the electronics part of this project. At this point, a 5V DC wall wart can be plugged into it, and it will work (with Arduino programming uploaded). When I make a better prototype, I can write up much better instructions if anyone is interested.
Here is a look at the PCB when completed.
Here is a closer look at the LEDs connected to each other.
Printing out the tree
As I noted previously, I had planned to use a nice little tree I found on Thingiverse. But even with the small PCB, I simply didn’t have enough room. So I opened Fusion360 and designed a tree.
Below is a view of the CAD drawing. I tried to use parametric concepts and variables in case I needed to make changes. Actually, the picture below shows the second version of the tree, which I used to make the green cover.
I then printed the case using my Ender 5 Plus using some old white PETG. I’m not sure of the brand of that roll. It was a no-name one I got a while back and have had nothing but problems trying to use. Perfect for printing out a prototype.
After printing it out, I decided the back would not work. Yes, it fit perfectly, but I didn’t leave myself enough room to close it comfortably. But I proceeded to put each LED in its place. The fitting was perfect!
Testing it all out
I then uploaded the code to the Arduino. Actually, over the last few weeks, I’ve uploaded dozens of different code variations to the Arduino. Some of the early ones were pieces of code I found on the internet. Then I started to write bits of code myself. Currently, there is a mixture of found and created code on the Arduino. In the future, I’ll post about the various methods I found to program the shift register. Using shift registers isn’t quite as standardized on the Arduino as I thought it would be.
At the time I was doing this test, I happened to get my November MakerBox. I went back into Fusion360 and redesigned the front to act as a cover for the current print. That worked out quite well. This new front cover was printed with a sample of Venom Green Biofusion from Extrudr.
Here is a video of me testing the code. The new green front has also been added.
That’s all for this tree.
I’ll leave this tree at my desk for the remainder of the year. But I am not happy with certain aspects of this design and will work on something better next year. The hardware from this one will probably go into my used scrap electronics bin. It can maybe be recycled into a future project.
Song of the Day: Trees
I know this is a post about a Christmas tree. But I couldn’t help but get this classic Rush song in my head, which doesn’t have to do with Christmas. This song is probably the most political I’ll ever get on this blog…
Bonus Song: Red Barchetta
My favorite song from Rush is about pure freedom! For me, these geek projects are my Red Barchetta.