background preloader

74HC595 - Shift register

Facebook Twitter

Output up to 768 PWM signals from one Arduino. Control many PWM outputs with only 3 Arduino pins ShiftPWM is a software PWM library for Arduino that uses shift registers to expand the number of PWM outputs.

With only 3 data pins, you can control an almost unlimited amount of PWM outputs. Because ShiftPWM is a software PWM library, it is not limited by the number of hardware PWM outputs on the Arduino. Shift registers are also a lot cheaper than dedicated hardware PWM IC’s, like the TLC5940. Easy to use The library is written to be as easy to use as possible: It provides intuitive functions like SetRGB and SetHSV to directly set an LED to a certain color. To SPI or not to SPI You can use ShiftPWM with the hardware SPI or without. Demo For a quick demonstration of ShiftPWM, see the video below. To give you an idea of how easy it is to use ShiftPWM, the movie below shows the result of this example code. ShiftPWM support topic. Latest update: Support not using the SPI. Update August 9 2012:I finally had the time to completely rewrite the documentation.

ShiftPWM support topic. Latest update: Support not using the SPI

You can now find schematics for normal RGB LED's, LED strips and high power LED's on I also updated the library to include load balancing and made the initialization much cleaner. Switching between SPI and no-SPI has become a lot easier. And I added Arduino Leonardo compatibility. Old stuff: Update May 9 2012:Support for NOT using the SPI pin. 2.5x slower, but the freedom to use your SPI port for something else.Download here: files to libraries/ShiftPWM/ and open one of the examples.

Update May 8 2012:Led setup flexibility: Based on some great suggestions that I got in this thread I have updated ShiftPWM to use the SPI bus.That took down the number of clock cycles per shift register from 108 to 43. I have created a page for ShiftPWM on my website where you can find more info and download the newest version. Even Older stuff: Video of ShiftPWM_example1: ExtraCore running Shiftpwm. Multiple rgb leds with shift registers. Yes, I've made a thing using 96 RGB LEDs with 12 shiftregisters for the LEDs.

multiple rgb leds with shift registers

Actually I'm not finished programming the thing yet (TTT), but the display works :-) In my case it's organized as 6 matrices of 4 by 4 LEDs each, hence 2 shiftregisters per matrix. Using 4 bits as row multiplexers, which really is identical in all of them, so I could have saved some shiftregisters (two or three). But I wanted to have them identical. Besides it fitted nicely with 2 bytes. I haven't really tested the limits yet, but I have tested with 8 PWM levels with no problem (no flicker), probably could up it to 16 at the cost of slowing down processing power for everything else.

Like MikMo says, there are PWM LED driver chips, but they are not as cheap (don't remember price right now). So yes, it's possible with shiftregisters. ShiftOut. Learning Examples | Foundations | Hacking | Links Started by Carlyn Maw and Tom Igoe Nov, 06 Shifting Out & the 595 chip At sometime or another you may run out of pins on your Arduino board and need to extend it with shift registers.


This example is based on the 74HC595. The datasheet refers to the 74HC595 as an "8-bit serial-in, serial or parallel-out shift register with output latches; 3-state. " How this all works is 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. The "serial output" part of this component comes from its extra pin which can pass the serial information received from the microcontroller out again unchanged. "3 states" refers to the fact that you can set the output pins as either high, low or "high impedance.

" Here is a table explaining the pin-outs adapted from the Phillip's datasheet. Example 1: One Shift Register.