Arduino 74hc595 Shift Register | 16 Led Chasers With 18 Effects
I am thinking about how to control more than 20 led with Arduino Uno because Arduino Uno only has 13 digital pins. So how It's possible? That's why I came with the shift register 74hc595. We need only 3 Arduino digital pins to control LEDs using 74hc595 shift registers. There are 3 part of shift register tutorial.
Control 8 leds. Control leds brightness. Control 2 shiftRegister with led effects. I will explain coding too.
1. Arduino Uno to the control shift register.
2. Two shift registers 74hc595 for controlling the LEDs.
3. 16 LEDs as an output.
4. 16 resistors to protect the LEDs.
5. Breadboards to build the circuit on it.
6. Jumper wires for connection.
If you want to learn how shift register work? Click on this Link
Step 2: Let's Build the Circuit to Control 8 Led With Arduino and 74hc595
Pin connection:
Let's build the led chaser.
First, pick up the breadboard and connect both sides of the breadboard with the jumper wire it will use to power the shift register.
After that, attach the LEDs one by one and make sure that the led GND pin is connected to the ground side of the breadboard and, also don't forget to add a 220 ohms resistor to protect the led from high current.
Now attach the shift register on a breadboard.
Next, connect shift register pin 16 to 5v.
Next, connect shift register pin 8 to GND.
Next, connect shift register pin 10 to 5v.
Next, connect shift register pin 13 to GND.
Now we have to connect shiftRegister to Arduino so connect shiftRegister pin 11 to Arduino digital pin 2.
Connect shift Register pin 12 to Arduino digital pin 3.
Connect shift Register pin 14 to Arduino digital pin 4.
After that, connect the output pin of shift Register to the LEDs.
Connect ShiftRegister pin 15 to LEDs 1.
Connect ShiftRegister pin 1 to LEDs 2.
Connect all the LEDs one by one up to ShiftRegister pin 7.
After that, connect the positive side of the breadboard to the Arduino 5v pin.
Next, connect the negative side of the breadboard to the Arduino GND pin.
Now the circuit is complete let's jump to the coding part.
Open the Arduino IDE.
Plug your Arduino into your computer.
First, we have to define the controller pin of the shift Register.
clock pin is connected to Arduino pin 2.
The latch is connected to Arduino pin 3.
The data pin is connected to Arduino pin 4.
byteleds = 0; Its hold the location of led is turned on or off.
In void setup() now Set all pins of shiftRegister as OUTPUT
In void loop() LEDs = 0 Mean all the led is off.
updateShiftRegisterR(); This function is used to update the shiftRegister we define below.
First, we have to set the latch pin low means No update.
After that call, the Arduino function shiftOut().
Shifts out a byte of LEDs one bit at a time to the serial data pin after the clock pin goes high to low and the led bit is stored in shiftRegister.
Set the order of bits LSB FIRST (Least Significant Bit) Mean we want to start turn on the LEDs from the right direction. MSBFIRST (Most Significant Bit) Mean we want to start turn on the LEDs from the left.
Now we have a location of which led is turned on so set the latch pin high means to update the outputs.
Wait for half a second. for loop to count from 0 to 7.
bitSet(); Its Arduino function to Sets a bit of particular LEDs at the location I too high.
Now update the ShiftRegister and wait a half sec.
The process is repeating, and one by one led is turned on.
Now upload the code.
The led is start turning on from the right to left direction.
There is a way to control the led brightness.
We can send the PWM signal to the shift register OE pin via Arduino PWM pin.
Remove the jumper wire from shift register pin 13 and Connect shift Register pin 13 to Arduino PWM pin 5.
Arduino 74hc595 Shift Register | 16 Led Chasers With 18 Effects
I am thinking about how to control more than 20 led with Arduino Uno because Arduino Uno only has 13 digital pins. So how It's possible? That's why I came with the shift register 74hc595. We need only 3 Arduino digital pins to control LEDs using 74hc595 shift registers. There are 3 part of shift register tutorial.
Control 8 leds. Control leds brightness. Control 2 shiftRegister with led effects. I will explain coding too.
1. Arduino Uno to the control shift register.
2. Two shift registers 74hc595 for controlling the LEDs.
3. 16 LEDs as an output.
4. 16 resistors to protect the LEDs.
5. Breadboards to build the circuit on it.
6. Jumper wires for connection.
If you want to learn how shift register work? Click on this Link
Step 2: Let's Build the Circuit to Control 8 Led With Arduino and 74hc595
Pin connection:
Let's build the led chaser.
First, pick up the breadboard and connect both sides of the breadboard with the jumper wire it will use to power the shift register.
After that, attach the LEDs one by one and make sure that the led GND pin is connected to the ground side of the breadboard and, also don't forget to add a 220 ohms resistor to protect the led from high current.
Now attach the shift register on a breadboard.
Next, connect shift register pin 16 to 5v.
Next, connect shift register pin 8 to GND.
Next, connect shift register pin 10 to 5v.
Next, connect shift register pin 13 to GND.
Now we have to connect shiftRegister to Arduino so connect shiftRegister pin 11 to Arduino digital pin 2.
Connect shift Register pin 12 to Arduino digital pin 3.
Connect shift Register pin 14 to Arduino digital pin 4.
After that, connect the output pin of shift Register to the LEDs.
Connect ShiftRegister pin 15 to LEDs 1.
Connect ShiftRegister pin 1 to LEDs 2.
Connect all the LEDs one by one up to ShiftRegister pin 7.
After that, connect the positive side of the breadboard to the Arduino 5v pin.
Next, connect the negative side of the breadboard to the Arduino GND pin.
Now the circuit is complete let's jump to the coding part.
Open the Arduino IDE.
Plug your Arduino into your computer.
First, we have to define the controller pin of the shift Register.
clock pin is connected to Arduino pin 2.
The latch is connected to Arduino pin 3.
The data pin is connected to Arduino pin 4.
byteleds = 0; Its hold the location of led is turned on or off.
In void setup() now Set all pins of shiftRegister as OUTPUT
In void loop() LEDs = 0 Mean all the led is off.
updateShiftRegisterR(); This function is used to update the shiftRegister we define below.
First, we have to set the latch pin low means No update.
After that call, the Arduino function shiftOut().
Shifts out a byte of LEDs one bit at a time to the serial data pin after the clock pin goes high to low and the led bit is stored in shiftRegister.
Set the order of bits LSB FIRST (Least Significant Bit) Mean we want to start turn on the LEDs from the right direction. MSBFIRST (Most Significant Bit) Mean we want to start turn on the LEDs from the left.
Now we have a location of which led is turned on so set the latch pin high means to update the outputs.
Wait for half a second. for loop to count from 0 to 7.
bitSet(); Its Arduino function to Sets a bit of particular LEDs at the location I too high.
Now update the ShiftRegister and wait a half sec.
The process is repeating, and one by one led is turned on.
Now upload the code.
The led is start turning on from the right to left direction.
There is a way to control the led brightness.
We can send the PWM signal to the shift register OE pin via Arduino PWM pin.
Remove the jumper wire from shift register pin 13 and Connect shift Register pin 13 to Arduino PWM pin 5.
No comments:
Post a Comment