These nifty bargraph modules consist of 10 individual LEDs in a convenient 20-pin DIP (Dual Inline Plastic) package. You get four modules, one of each color (red, yellow, green, and blue), and enough resistors to light up every last one of them.
Along with what's provided in the kit, you will need the following for this guide:
Each module contains 10 independent LEDs. The pins are arranged so that the anode (positive) pins are on one side of the module, and the cathode (negative) pins are directly opposite. Since the packages are 0.3" wide, just like standard DIP ICs, they're easy to place in the center of a breadboard with the legs straddling the center gap. Pin 1 is indicated by a slight bevel on that corner of the package. (TIP: there may be a thin plastic film protecting the top of the module that you can peel off for a more crisp appearance).
As with normal LEDs, each of the 10 LEDs in the bargraph requires a series resistor to limit the current flowing through the LED. The kit comes with fifty 330-Ohm resistors, enough to light all of the LEDs in the kit.
Pin layout and typical connection (only the first LED is shown)
Wiring the bargraph to an Arduino, or any other microcontroller, is pretty straightforward. Using a breadboard and some jumper wires, connect each Arduino outputs (0-9) to the bargraph's anode pins (A-J in the schematic below). Then connect the cathode pins to ground with a 330Ohm resistor. Don't forget the resistor on any of the LEDs. Otherwise you may reduce the life of one or more of the LEDs, and no one wants a bargraph that is missing an segment.
The below Arduino code shows a few ways to directly drive these bargraphs. Hook everything up, upload the sketch, and see what happens. (If nothing happens, make sure the bargraph module is in the correct orientation, and that ground is connected back to a ground pin on the Arduino). Later on when you need to drive these with your own code, you can reuse these functions.
One thing you'll notice when driving these displays is that you can quickly run out of pins when each pin is dedicated to a single LED. To drive more LEDs with fewer pins, take a look at shift registers, which let you use the Arduino's Synchronous Serial Interface to control additional external output pins.
If you have any questions or suggestions, don't hesitate to contact us at firstname.lastname@example.org. Have fun with your new displays!