The 74HC595 integrated circuit is an 8 bit serial shift register. This allows a single data pin to output data that can be used to drive 8 output pins by "shifting" them into a storage component (a "register"). This is great for use with low frequency items that need a lot of output pins to drive them - such as the 8x8 bi-colour LED matrix.
To make this operate, we shift the 8-bits of data required, one bit a time into the register. When we have loaded all the bits in, we then transfer the stored data to the output. For the example below, we will connect two of the shift registers in series, which allows us to turn a single Arduino data bit into 16 outputs (8 to drive the Red LEDs and 8 to drive the Green LEDs). Actually, we also require a couple of additional Arduino pins to control the shift register, so we actually control 16 data bits using 3 Arduino outputs.
- Connect VCC (Pin 16) of each shift register to +5V
- Connect GND (Pin 8) of each to 0V
- QA..QH (Pins 15, 1, 2, 3, 4, 5, 6, 7) of the first to the Red cathodes (matrix pins 23, 20, 17, 14, 2, 5, 8, 11)
- QA..QH(Pins 15, 1, 2, 3, 4, 5, 6, 7) of the second to the Green cathodes (matrix pins 24, 21, 18, 15, 1, 4, 7, 10)
- Matrix common anodes (Pins 12, 9, 6, 3, 13, 16, 19, 22) through 330Ω resistors to Arduino pins 0, 1, 2, 3, 4, 5, 6, 7
- Connect QH' (pin 9) of first shift register to SER (Pin 14) of the second. This shifts the data from the first to second.
- Connect SER (Pin 14) of the first to Arduino pin 8. This is the data input pin
- Connect SRCLK (Pin 11) of BOTH shift registers to Arduino Pin 9. This is signal to shift each data bit into the shift register
- Connect RCLK (Pin 12) of BOTH shift registers to Arduino Pin 10. This is the signal to transfer the stored data to the output
- Connect OE~ (Pin 13) of BOTH to 0V
- Connect SRCLR~ (Pin 10) of BOTH to +5V
The ColourChars example sketch outputs characters alternately in Red and Green then Orange.
NB: For the orange to display correctly, the Green and Red LEDs must be balanced. This means that we can't use a standard set of 330Ω resistors in the common anodes. Instead connect the common anodes from the matrix (Pins 12, 9, 6, 3, 13, 16, 19, 22) DIRECTLY to Arduino pins 0, 1, 2, 3, 4, 5, 6, 7. You will then need to insert 330Ω resistors in between each of the Red cathode connections and 220Ω resistors in between each of the Green cathode connections.
|