How to Add Outputs to an #Arduino using a Shift Register - The Learning Circuit

element14 presents
26 Aug 202010:45
EducationalLearning
32 Likes 10 Comments

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
00:00
πŸ”Œ 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.

05:02
πŸ“ 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.

10:02
πŸ”„ 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
A shift register is a type of digital memory storage that is used to store and transmit data in a sequential manner. In the context of the video, it is used to expand the number of inputs or outputs available in a circuit. The 74HC595, a common shift register, is highlighted as it can take data in serially and output it in parallel, which is essential for adding more outputs to an Arduino.
πŸ’‘Arduino
Arduino is an open-source electronics platform that consists of a series of microcontroller boards and a development environment for creating software to run on the boards. In the video, an Arduino board is used as the central control unit to demonstrate how to interface with a shift register to add more outputs for controlling LEDs.
πŸ’‘Parallel and Serial Data
Parallel data refers to a method of data transfer where multiple bits of data are sent simultaneously over separate channels. Serial data, on the other hand, involves sending data one bit at a time, sequentially, over a single channel. The video discusses how shift registers can handle both types of data, with the 74HC595 accepting serial input and providing parallel outputs.
πŸ’‘74HC595
The 74HC595 is a specific type of shift register chip that is popular for its versatility and ease of use. It is mentioned in the video as the chip being used to demonstrate the concept of adding more outputs to an Arduino. It has a serial input and eight parallel outputs, with features like a shift clock and a latch clock for controlling data flow.
πŸ’‘Clock Pins
Clock pins are used in digital circuits to control the timing of data operations. In the context of the 74HC595 shift register, there are two clock pins: the shift clock (pin 11) and the latch clock (pin 12). The shift clock is used to move data into the storage registers, while the latch clock is used to transfer the data from the storage registers to the outputs.
πŸ’‘Output Enable Pin
The output enable pin is a control pin on the shift register that determines whether the data stored in the registers is allowed to be output. When the output enable pin is high, data can be shifted into and stored in the registers, but when it is pulled low, the data can be shifted out to the outputs. This concept is crucial in the video for controlling when the LED outputs update.
πŸ’‘Serial Data Input
Serial data input is the method by which data is fed into the shift register one bit at a time. In the script, the serial data input pin (pin 14) on the 74HC595 is connected to an Arduino pin to control the input of data. This is a fundamental part of the process of adding more outputs to the Arduino using the shift register.
πŸ’‘LEDs
LEDs, or light-emitting diodes, are used in the video as visual indicators for the output of the shift register. Each of the eight outputs from the 74HC595 is connected to an LED, demonstrating how the shift register can control multiple devices. The script describes how the LEDs light up in sequence as the shift register processes data, showing the binary count.
πŸ’‘Cascading
Cascading refers to the process of connecting multiple instances of a component in a series to increase functionality. In the video, it is shown how to cascade multiple 74HC595 shift registers to add even more outputs to the Arduino. This is done by connecting the serial output of one shift register to the serial input of another, allowing for an expansion of the number of controllable LEDs or other devices.
πŸ’‘Binary Count
Binary count is a method of counting using only two digits, 0 and 1, which is the basis of digital computation. In the video, the Arduino uses a binary count to light up LEDs in sequence, representing numbers in binary form. The script explains that the count goes up to 255, which is the highest 8-bit binary number, and then resets back to zero.
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
Rate This

5.0 / 5 (0 votes)

Thanks for rating: