How to make an LED ring chaser using the Attiny85 Microcontroller
Hello and welcome back! In this project, we will learn how to make an LED ring chaser using the Attiny85 microcontroller. I used three 74HC595 shift registers to control 24 LEDs, which allowed us to create smooth and exciting light patterns. I designed five different LED patterns for this circuit, but feel free to customize them as you like. Additionally, I created a printed circuit board (PCB) with JLCPCB to make assembly easier and more organized. To program the Attiny85, you can use any Arduino board, including the Arduino UNO. I’ll provide step-by-step instructions on how to upload the program. Finally, I want to say this project is perfect for beginners and anyone interested in electronics and programming.
- How To Use ATtiny85 Microcontroller – Click Me
OK let’s do this project step by step. The required components are given below.
- ATtiny85 Microcontroller x 1 — Our store / Amazon
- LED bulb x 24 — Our store / Amazon
- 180 ohm Resistor x 24 — Our store / Amazon
- 74HC595 Shift register x 3 — Our store / Amazon
- 8 Pin IC socket x 1 — Our store / Amazon
- DC power barrel jack — Our store / Amazon
Disclosure: These Amazon links are Affiliate links. As an Amazon Associate, I earn from qualifying purchases.
Step 1
Firstly, identify these components.
Step 2
Secondly, let’s order PCBs for this project.
- First, go to the JLCPCB official website and log in to your account.
- Also, you can get the $125 OFF coupons, Bulk order discount, and the chance to win a $150 Amazon gift card with the JLCPCB Engineers Day — Click on me (September 5 to October 5, 2024)
- Now, click the instant quote button and upload the Gerber file. You can download it using the link below.
- Gerber file — Download
- I ordered 10 PCBs in red. You can change it as you like. Then, select the build time and shipping. Finally, click the save to cart button.
Step 3
Thirdly, unbox your PCB package and solder the SMD ICs. For that, I used a hot air gun.
Step 4
Now, solder the IC socket, power socket, and resistors to the PCB.
Step 5
Then, solder the LEDs using the images below.
Step 6
Now let’s program the ATtiny85 Microcontroller. For that Follow the instructions below.
- First, place it on the breadboard and connect it to the Arduino UNO board. Use the circuit diagram below for that.
- Now connect the Arduino UNO board to the computer and open the Arduino ISP program in Arduino Examples.
- Next, select the Arduino UNO board and port. After, click the upload button.
- Now, select the correct ATtiny85 board settings and burn the bootloader. For that use the images below. If the ATtiny85 board is not yet installed on your Arduino IDE, please read this article.
- Next, copy and paste the following program to the Arduino IDE.
- 74HC595.h Library — Download
- Code and circuit diagram — Download
#include <ShiftRegister74HC595.h>//include library
ShiftRegister74HC595<3> led(1, 2, 3);//<number of shiftregisters>object name(data pin,clock pin,latch pin)
void setup() {
}
void loop() {
pattern1(3);
pattern2(2);
pattern3(2);
pattern4(2);
pattern5(3);
pattern6(3);
}
void pattern1(int a) {
for (int x = 0; x < a; x++) {
led.setAllHigh();
delay(300);
led.setAllLow();
delay(300);
}
}
void pattern2(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 24; a++) {
led.set(a, HIGH);
delay(50);
led.set(a, LOW);
}
for (int b = 23; b > 0; b--) {
led.set(b, HIGH);
delay(50);
led.set(b, LOW);
}
}
}
void pattern3(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 24; a++) {
led.set(a, HIGH);
delay(50);
}
for (int b = 23; b > 0; b--) {
led.set(b, LOW);
delay(50);
}
}
}
void pattern4(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 24; a++) {
led.set(a, LOW);
delay(50);
led.set(a, HIGH);
}
for (int b = 23; b > 0; b--) {
led.set(b, LOW);
delay(50);
led.set(b, HIGH);
}
}
}
void pattern5(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 24; a++) {
led.set(a, HIGH);
delay(50);
led.set(a, LOW);
}
}
}
void pattern6(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 24; a++) {
led.set(a, HIGH);
led.set(a + 4 , HIGH);
delay(50);
led.set(a, LOW);
led.set(a + 4, LOW);
}
}
}
- Now install the library file and check the ATtiny85 board settings again. If everything is correct, click the upload button.
Step 7
Afterward, remove the Microcontroller and connect it to the IC socket on the PCB. Then connect the 5v power supply to this circuit. Now you can see the LED patterns.
OK, enjoy this project. The full video guide is below. So we hope to see you in the next project.
Troubleshooting
- Identify the health of components.
- Select the correct ATtiny85 board settings.
- Include the shift register library file.
- Check the power source.
How to make an LED ring chaser using the Attiny85 Microcontroller