Shift Register on TinkerCad
đĻ Shift Register Wiring: Safe & Simple Control
This guide shows you how to safely wire the 74HC595 shift register to an Arduino Uno on a virtual breadboard. We will set up the circuit to control the data flow with a slide switch and use only Digital Pin 13 for timing. Crucially, we use 470 ohm resistors to protect the chip from overcurrent.
In the preceding videos, I go over a shift register in CircuitVerse, TinkerCAD, and finally a physical version. However, this written guide is only for the TinkerCAD version.
đ Safety Disclaimer
Warning: Working with electronics and electricity can be dangerous if performed incorrectly.
By following these instructions, you acknowledge that you are working with electrical components and assume all risks associated with the assembly and use of this circuit.
- Always ensure your Arduino is unplugged from power (computer or wall adapter) before making any wiring changes.
- Do not substitute the resistor values: Using resistors smaller than 470 ohms may cause the 74HC595 shift register to overheat and fail.
- If you smell burning or feel a component getting hot, immediately unplug the Arduino and double-check your wiring against the instructions.
Proceed with caution and only if you are comfortable working with electronics.
Supplies
1x 8-Bit Shift Register (74HC595)
1x Arduino Uno
1x Slideswitch
8x 470 âĻ Resistors
8x Red LED
đ Part 1: Power and Constant Connections
We set up the constant power, ground, and pins that must be held ON or OFF.
Power the Breadboard
- Connect the 5V pin on the Arduino to the red (+) power rail.
- Connect the GND pin on the Arduino to the black (-) ground rail.
Power the Shift Register
- Connect the pin labelled POWER on the shift register to the red (+) power rail.
- Connect the pin labelled GROUND on the shift register to the black (-) ground rail.
Set Essential Control Pins
These pins must be tied to a permanent state for the chip to run correctly.
- Connect the pin labeled SHIFT REGISTER CLEAR to the red (+) power rail (5V). (This permanently disables the chip's reset function.)
- Connect the pin labeled OUTPUT ENABLE to the black (-) ground rail (GND). (This permanently turns the LED outputs ON.)
đšī¸ Part 2: Arduino and Switch Connections
We'll connect the three pins that control the shifting action: Clock, Latch, and Data.
Combine Clock and Latch on Pin 13
- Connect the pin labelled SHIFT REGISTER CLOCK to Arduino Digital Pin 13.
- Connect the pin labelled OUTPUT REGISTER CLOCK to the same wire or breadboard row as the SHIFT REGISTER CLOCK wire, connecting it to Arduino Digital Pin 13.
Wire the Data Switch
- Connect the center pin of the slide switch to the shift register pin labelled INPUT.
- Connect one outer pin of the switch to the red (+) power rail (5V). (Sets input to HIGH/1.)
- Connect the other outer pin of the switch to the black (-) ground rail (GND). (Sets input to LOW/0.)
đĄ Part 3: Safe LED Output Connections
This configuration is safe because the 470 ohm resistors limit the current to about 6.4 mA per LED, keeping the entire chip's current draw well below the 70 mA safety limit.
Connect LEDs and Resistors
- Connect the anode (long, positive leg) of the first LED to the shift register pin labelled OUTPUT 1.
- Repeat this for the remaining seven LEDs, connecting their anodes to OUTPUT 2 through OUTPUT 8.
- Connect the cathode (short, negative leg) of each LED to one side of a 470 ohm resistor.
- Connect the other side of all eight resistors to the black (-) ground rail (GND).
đģ Part 4: Arduino Code
This is the simplest code you can use. Since the Clock and Latch pins of your shift register are both wired to Arduino Digital Pin 13, this program automatically generates the timing needed to shift the data.
The Code
- Copy this code and upload it to your Arduino Uno:
// C++ code
//
void setup()
{
pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
digitalWrite(LED_BUILTIN, HIGH);
delay(1000); // Wait for 1000 millisecond(s)
digitalWrite(LED_BUILTIN, LOW);
delay(1000); // Wait for 1000 millisecond(s)
}
đ Part 5: How to Use the Circuit
Now that the circuit is wired and the simple blink code is uploaded, you can manually control the data that shifts across your line of eight LEDs.
Observe the Automatic Clock
- Click the start simulation button in the upper right hand corner of the screen.
- The onboard LED on the Arduino (connected to Pin 13) will immediately start blinking ON for 1 second and OFF for 1 second. This blinking is the Clock Pulse that is driving your shift register.
Set your slide switch to HIGH (5V). Every two seconds, the shift register will load a '1', and you will see the LEDs turn on one by one, forming a traveling light.
Set your slide switch to LOW (GND). Every two seconds, the shift register will load a '0', and you will see the LEDs turn off one by one.