Arduino Shift Register

How to use shift registers to increase the number of ways you can use your Arduino board.

This page focuses on using them as tools to assist in animating scale models, dioramas or model train layouts.

The first thing to do is to go through the Arduino tutorials on shiftout.  Set up a board and go through the examples.

 

Arduino Tutorial on shiftout – This is really a necessary basic step. However, we feel that the examples shown in the tutorials are overly complex and their use to a modeler is limited. So we have other information below.

Sparkfun Shift Register Breakout Board –  A tutorial on using a plug and play breakout board plus good basic shift register information. The video in the page is particularly important.

By connecting your lights through a shift register, and powering the shift register externally, you totally remove the current load on your board.  So, for example, you can control 50 LEDs and more from a Nano and not burn it out.

So here are some basics

There are connections for 8 LEDs on the shift register.

They are coded as 1 for on and 0 for off.

So you code 00000000 for all to be off. 11111111 for all to be on.

The code 00000011 turns on the first two LEDs and the remainder will be off.

When you enter them in the sketch, the format would be, as an example, B11000111. The B prefix tells the computer to create a fixed value that is based on individual bits.

Think about the bits as black and white marbles. And think as the shift register as a trough with notches to hold the marbles.

MSB means the shiftout starts at the rightmost bit. It moves the rightmost marble to the trough first. Then it moves the second marble, which when it gets to the trough, shoves the first marble to the left. This continues until all the notches are filled. The colors represent on and off, or 1 and 0.

LSB means the shiftout starts at the leffmost bit.

If you daisy chain shift registers, the second shiftout will move this first group of marbles left. And so on.

 

 

 

Tell others about this information by using one of these services. Thank you for the support.
Scroll to top