An 8-Bit Waterfall using Arduino
So far my Arduino projects have all needed only a small number of output pins. In a previous post I talked about moving some of the logic off the Arduino and into other integrated circuits in order to free up pins on the Arduino. While this can help, I’m sure there will come a time when I’ll need more output pins then the Arduino Uno has to offer.
One solution would be to upgrade to an Arduino Mega as it has 54 digital output pins compared to the 14 digital pins on the Arduino Uno. The cost difference of around £15, however, doesn’t make this an attractive option. Fortunately there is a much cheaper way of adding extra output pins; 8-bit shift registers.
Whilst you don’t need to know the full details of how a shift register works an understanding of the basic principle will help. Essentially data is shifted into the chip one bit at a time using two pins; a data pin specifying the bit value and a clock pin that is triggered to show when the bit has been set. Once all the bits have been passed to the chip a third pin (known as the latch) is triggered at which point each bit is output on a separate pin of the chip. In the case of an 8-bit shift register (the 74HC595N for example) this allows us to control 8 pins (one for each bit) using just three pins on the Arduino (one each for data, clock and latch). In this way we can add five new digital output pins to an Arduino for just 70p (I got five chips for £3.50 from oomlout).
The 74HC595N is in fact such a common way to add extra pins to an Arduino that there is a simple tutorial already available, although I didn’t find this before I’d already wired up the circuit you can see to the left. Due to a shortage of space on my breadboard I only bothered to wire LEDs to three of the output pins, but it should be clear how to add LEDs to the other five output pins should you wish to. Also it’s worth noting that I haven’t needed to add a capacitor to the latch pin (a capacitor would ensure a smooth flow of power, but the Arduino on it’s own seems to work fine and I didn’t have any spare capacitors lying around). It’s important to make sure you pull the enable pin to ground otherwise you’ll find the lights flicker uncontrolably, if they come on at all.
Using this circuit I can cycle through all combinations of the three LEDs by writing the numbers 0 to 7 to the data pin. This works because we only need three bits to encode numbers 0 to 7 which will cause the relevant pins to go LOW/HIGH as appropriate. For those of you who aren’t so comfortable with binary the following table will help.
So to turn on the yellow LED we would write 2 to the chip or to turn on the green and orange LEDs we would write 5. The following simple sketch can be used to show that this does indeed work.
For more detail: An 8-Bit Waterfall using Arduino
JLCPCB – Prototype 10 PCBs for $2 + 2 days Lead Time
China’s Largest PCB Prototype Enterprise, 300,000+ Customers & 10,000+ Online Orders Per Day
Inside a huge PCB factory: https://www.youtube.com/watch?v=_XCznQFV-Mw
This Post / Project can also be found using search terms:
- 8 bit waterfall using arduino
- an 8-bit waterfall using arduino
- waterfall display using arduino
- 8 bit water fall using arduino