Sunday, November 8, 2015

Serial to Parallel Shifting-Out with a 74HC595

 Using the 74HC595 to control 8 leds (outputs) without giving up 8 ports on the arduino uno. Three outputs from the arduino are used to shift the data out in serial to the 74HC595 were it is then parceled out to each of its individual pins. You can link multiple registers together to extend your output even more, without giving up any more pins on the arduino.
Note: The shift register is not what gives the appearance of the led going back and foth...ie shifting. All the shifting happens prior to the output states changing. The led appears to be shifting because it is in a loop writing int 1, 2, 4, 8, 16, 32, 64, 128, 64, 32, 16, 8, 4, and 2.
Next, I will be connecting four of the  74HC595s together to experiment with controlling 32 outputs with 3 pins from the arduino.  Then modify the circuit to control four seven segment leds with 3 pins.  Why do this instead of using the low cost I2C interface?  Speed.  I2C runs at 100k where these shift registers can be clocked as fast as for for loop that shifts the data out, which is well over 1mb/sec.



This is the code used in the video above.  Pin out for the 74HC595 along with a short tutorial by Simon Monk can be found here.

Source Code Here:

2 comments:

  1. Would the shifting work without the resistors?

    ReplyDelete
  2. The resistors are for limiting the current through the leds. Shifting would still work but you would probably burn up the leds.

    ReplyDelete