For this lab, I learned about shift registers. I learned what to do when I run in to the problem of running out of pins on my Arduino board: use a shift register! A shift register controls multiple outputs at a time while only taking up a few pins on the Arduino.
According to Arduino’s tutorial for shift registers, a shift register “works through something called “synchronous serial communication”, i.e. you can pulse one pin up and down thereby communicating a data byte to the register bit by bit. It’s by pulsing second pin, the clock pin, that you delineate between bits.”
Multiple shift registers can be linked, allowing for control of hundreds of outputs while still only using a few pins on the Arduino.
I learned how to use the shift register by connecting it to a seven segment LED.
First, I connected the H-bridge to my Arduino. I followed the following diagram:
|PINS 1-7, 15||Q0 ” Q7||Output Pins|
|PIN 8||GND||Ground, Vss|
|PIN 9||Q7″||Serial Out|
|PIN 10||MR||Master Reclear, active low|
|PIN 11||SH_CP||Shift register clock pin|
|PIN 12||ST_CP||Storage register clock pin (latch pin)|
|PIN 13||OE||Output enable, active low|
|PIN 14||DS||Serial data input|
|PIN 16||Vcc||Positive supply voltage|
I then connected the seven segment LED to the H-bridge. The following is a diagram similar to the seven segment LED I used:
Notice that pins 3 and 8 are Common Anode. This simply means all of the LEDs are connected and brought to a common anode pin.
I made sure to keep track of each pin I connected from the seven segment LED to the shift register. I used these pin numbers in my code to correspond with creating the numbered and lettered display.
Here is the result:
The LED displays numbers 0-9 and letters A-F (some are lower case).
This lab was a great way for me to learn how a shift register works. I know that I may need to use a shift register in upcoming projects. I ran in to one frustrating, although comedic, problem in attempting to get this project to work. I spent nearly an hour trying to figure out why the seven segment LED was not displaying anything. After exchanging multiple seven segment LED displays and checking over all my connections for a third and fourth time, I came to realize that the shift register I was using was bad! I exchanged it with a new one and the circuit worked immediately!