How to Add Outputs to an #Arduino using a Shift Register - The Learning Circuit
TLDRThis video from Element 14 demonstrates how to use a 74HC595 shift register to add more outputs to an Arduino. It covers the basics of shift registers, their connection to an Arduino, and how they can control LEDs. The tutorial includes a detailed explanation of wiring, coding, and the practical application of shifting data to expand input/output capabilities. Additionally, it shows how to cascade multiple shift registers for even more outputs, all while using just three Arduino pins. The video encourages viewers to build their circuits and share results on the Element 14 community.
Takeaways
- π The video is a tutorial on using shift registers to expand the number of inputs or outputs in a circuit, specifically with the 74HC595 model.
- π The 74HC595 shift register has a single serial input and eight parallel outputs, with two clock pins for shifting data in and out.
- π The shift clock pin (11) is used to shift data bits into the register, while the latch clock pin (12) is used to shift data out to the outputs simultaneously.
- π¦ The 74HC595 is an 8-bit shift register, meaning it can store eight bits of data at a time, which are shifted in on each pulse of the shift clock.
- π© The output enable pin must be low for data to be shifted from the storage registers to the outputs, and high to prevent changes at the outputs even if the latch clock pulses.
- π To connect the shift register to an Arduino, three pins are needed: one for serial data input and two for the shift and latch clock signals.
- π‘ The tutorial demonstrates connecting eight output pins of the shift register to LEDs, with each pin going through a current-limiting resistor.
- π¨βπ» Arduino code is used to control the shift register, initializing pins as outputs and using a for loop to increment a shift count and shift out data bit by bit.
- π The clear pin can be used to reset the shift register, and in the example, it's connected to an Arduino pin to start counting from zero.
- π The serial output pin (9) of one shift register can be connected to the serial input pin (14) of another to cascade multiple shift registers for more outputs.
- π The video concludes by encouraging viewers to build their own circuits, experiment with the shift registers, and share their results on the Element14 community website.
Q & A
What is the purpose of using a shift register with an Arduino?
-A shift register is used with an Arduino to expand the number of inputs or outputs available in a circuit, allowing for more complex projects and additional functionality.
Which shift register is commonly used and featured in the video?
-The 74HC595 is a commonly used and popular shift register featured in the video, which takes data in a single serial input and sends it to eight parallel outputs.
How does the 74HC595 shift register handle data input and output?
-The 74HC595 shift register handles data input through a single serial input pin and sends it to eight parallel outputs. It uses two clock pins: one for shifting data into the registers and another for shifting data out to the outputs simultaneously.
What are the two types of clock signals used by the 74HC595 shift register?
-The two types of clock signals used by the 74HC595 are the shift clock, which triggers bits of data to be shifted into the registers, and the storage or latch clock, which triggers data to be shifted out at the eight outputs simultaneously.
How many bits of data can be stored at a time in the 74HC595 shift register?
-The 74HC595 is an 8-bit shift register, meaning it can store only eight bits of data at a time.
What is the role of the output enable pin in the 74HC595 shift register?
-The output enable pin in the 74HC595 shift register, when pulled low, allows data to be shifted from the storage registers to the outputs. When it is high, data may still be shifted into the storage registers, but the output data will not change.
How are the shift register and Arduino physically connected in the video?
-In the video, the shift register and Arduino are connected on a breadboard with the ground rail connected to the Arduino's ground pin and the power rail connected to the Arduino's 5V pin. Specific Arduino pins are used for serial data input, shift clock, and latch clock signals.
Why is the output enable pin of the shift register connected to ground?
-The output enable pin is connected to ground to hold it low, ensuring that the outputs are always enabled and data can be shifted out to the storage registers.
What is the purpose of the clear pin in the shift register, as demonstrated in the video?
-The clear pin is used in the video to reset all the LEDs to zero, making it easier to see the changes happening on the LEDs. It's not typically necessary for all applications but is helpful for demonstration purposes.
How does the Arduino code control the shift register to display a binary count on LEDs?
-The Arduino code uses a for loop to increment a shift count variable, shifts out the data bit by bit using the shiftOut function, and then uses the latch clock to transfer the data to the outputs. A delay is added to create a visible transition between shifts.
What is the significance of pin 9 on the 74HC595 shift register?
-Pin 9 on the 74HC595 is the serial output pin, which can be used to cascade multiple shift registers, thereby adding more outputs to the system without requiring additional control pins from the Arduino.
How can multiple shift registers be connected to an Arduino to increase the output count?
-Multiple shift registers can be connected to an Arduino by tying the shift clock pins and the latch pins of both shift registers together and connecting the serial output pin of the first shift register to the serial input pin of the second shift register.
What is the maximum number of shift registers that can be cascaded to an Arduino?
-The video does not specify a limit to the number of shift registers that can be cascaded, but it implies that there is a practical limit, which may depend on factors such as available Arduino pins and power supply.
How can the shift and latch clocks be used independently to control the outputs?
-The shift and latch clocks can be independently controlled to shift a number of bits into the storage registers before they are transferred to the outputs. This allows for the outputs to change completely with each latch clock pulse, enabling various LED patterns and behaviors.
Outlines
π Introduction to Shift Registers and Arduino
This video from Element 14's electronics community introduces the use of shift registers to expand the number of inputs or outputs in a circuit. The presenter explains how to use a 74HC595 shift register with an Arduino to add more outputs. The 74HC595 takes serial input and sends it to eight parallel outputs. It features two clock pins for shifting data into the registers and transferring it to the outputs. The process involves connecting the shift register to the Arduino, with specific pins dedicated to power, ground, serial data input, shift and latch clock signals, and output enable. The presenter also discusses the practical setup on a breadboard, including connecting the outputs to LEDs through current-limiting resistors.
π Arduino Code for Shift Registers
The second paragraph delves into the Arduino coding process for utilizing the 74HC595 shift register. It begins with setting up variables for the pins used and declaring them as outputs. The clear pin is set active low to reset the LEDs. The main program loop involves incrementing a shift count variable up to 255, which corresponds to the maximum 8-bit binary number, thus lighting all LEDs. The 'shiftOut' function is used to send data bit by bit to the shift register, followed by a latch clock pulse to update the outputs. A delay is added for visual effect. The video also covers cascading shift registers to expand outputs further, with the second register's serial output connected to the first's serial input, all controlled by the same three Arduino pins.
π Independent Control of Shift and Latch Clocks
The final paragraph emphasizes the independent control of shift and latch clocks, allowing for multiple bits to be shifted into storage registers before being transferred to outputs. This feature enables dynamic LED patterns and encourages creativity in circuit design. The presenter invites viewers to share their projects and ask questions on Element 14's community platform. The video concludes by reminding viewers of the flexibility and potential of shift registers in expanding Arduino projects and fostering learning and experimentation.
Mindmap
Keywords
π‘Shift Register
π‘Arduino
π‘Parallel and Serial Data
π‘74HC595
π‘Clock Pins
π‘Output Enable Pin
π‘Serial Data Input
π‘LEDs
π‘Cascading
π‘Binary Count
Highlights
Introduction to shift registers and their use in expanding inputs or outputs in a circuit.
Explanation of the 74HC595, a popular shift register with 8-bit storage and parallel outputs.
Description of the serial input and two clock pins (shift and latch) for data management.
How the shift register processes data with the shift and latch clocks.
The role of the output enable pin in shifting data to the outputs.
Practical demonstration of connecting the 74HC595 to an Arduino.
Connecting power and ground pins of the shift register to the Arduino.
Assigning Arduino pins for serial data input, shift clock, and latch clock signals.
Using the clear pin for resetting the count to zero for demonstration purposes.
Connecting the shift register outputs to LEDs with current-limiting resistors.
Arduino code setup for defining pin functions and initializing outputs.
Explanation of the for loop in the Arduino code for incrementing the shift count.
Using the shiftOut function to transfer data bit by bit to the shift register.
Demonstration of the LED count in binary and the delay for visibility.
Cascading multiple shift registers for more outputs with the same three Arduino pins.
Independence of shift and latch clocks for versatile LED output control.
Invitation to build circuits, share results, and ask questions on the Element14 community.
Transcripts
Browse More Related Video
![](https://i.ytimg.com/vi/Ys2fu4NINrA/hq720.jpg)
74HC595 & 74HC165 Shift Registers with Arduino
![](https://i.ytimg.com/vi/ameNT2MKDyE/hq720.jpg?sqp=-oaymwEmCIAKENAF8quKqQMa8AEB-AH-CYAC0AWKAgwIABABGGUgWihAMA8=&rs=AOn4CLDvWONbY8EKJH5YpuNDosds4k7TyA)
The Shift Register: Explained [74HC595]
![](https://i.ytimg.com/vi/Y4djl3oYqDQ/hq720.jpg)
How to Make a 4-bit Shift Register Circuit - The Learning Circuit
![](https://i.ytimg.com/vi/Rftc7yEGfKU/hq720.jpg)
How 74HC595 Shift Register Works ? | 3D animated π₯
![](https://i.ytimg.com/vi/3t9-rXceGkg/hq720.jpg)
How to make Chase Lights with a Decade Counter - The Learning Circuit
![](https://i.ytimg.com/vi/lK_LKo3MwgQ/hq720.jpg)
How Shift Registers Work - The Learning Circuit
5.0 / 5 (0 votes)
Thanks for rating: