LED Progress Bar


    LED Progress Bar: I purchased this LED array from Amazon with the intention of making a level indicator for my sailboat battery (deep-cycle lead-acid type). Afterward I realized that a small panel meter of the right range, such as one already in the parts box, would be simpler and probably better. Still I wanted to try out the LEDs and decided to construct a Arduino-based test rig. This is a very simple project because LEDs are the same no matter how they are packaged.

    I couldn’t find a datasheet for the specific array that I bought from Amazon, but guessed its layout would be the same as other similar arrays, with each LED on a pair of facing pins: 1-20, 2-19, 3-18, and so on. Pins 1, 2, 3, etc. are the plus side, and 20, 19, 18, the cathodes. It wasn
t immediately clear which end of the package was pin 1, but that question is easily answered with an ohmmeter, or by trying to light any of the LEDs.

Circuit board (front)Color-coded cable end    Luck was definitely a factor in scrounging exactly one 20 pin DIP socket from among the hundred or so sockets in the parts box. I soldered this socket to a small PCB along with a bunch of 330 ohm resistors, one per LED (on the ground side). To the other side of the board I soldered a female header strip. My thought was that at some point the display might actually be used, and if so it would be best to have the connecting cable at the back. The header has two power supply pins, although only the ground side is used. The middle 10 pins are aligned with the socket. For a connecting cable I cut an old computer IDE cable and peeled off a 12-wire piece. Finally, to make it easier to remember what was what, I used colored heat shrink tubing to code the wire ends to match the LED colors. Later I added a 2K potentiometer for adjusting display brightness. The potentiometer is wired as a variable resistor in series with ground. [Only the wiper and one end are connected.]



Arduino pins    My original plan, when purchasing the LED array was to use an LM3914 or a bunch of Zener diodes to construct a circuit, which on pressing a button would display the no-load voltage (correlates to capacity remaining), with red indicating imminent exhaustion. Since abandoning that idea I haven’t thought of anything useful to do with the display. One idea is to make an S-meter for the WWVB receiver, but that is surely contrived. Meanwhile, I created a simple Arduino test sketch to demonstrate how the array emulates a bar graph or progress indicator. The sketch uses Arduino digital I/O pins 12 to 8 and 7 to 3, as shown in the photo. Once again, color-coding wire ends helps to keep everything straight. The corresponding sketch array is:



Arduino pins

Of course, any Arduino DIO pins can be used. It is only necessary to preserve consistency of wiring and sketch definitions.

    Test sketch demo: progress_bar_demo.mp4




Low voltage indicator circuit

    
Battery low-voltage indicator: After reading at least a dozen articles on battery level indicator circuits, some of which involve more than just a few components, or include IC’s such as comparators or op amps, I came across a YouTube video presenting a simple circuit that lights an LED when the voltage drops below a given design level: https://www.youtube.com/watch?v=SCejjZdbWwU. The particular Zener diode values specified in this video cause an LED to begin to glow at about 12.5 volts. However, another very similar presentation (https://www.youtube.com/watch?v=Z0cOO0TNjNA) suggests the diode values shown in the diagram above, which are roughly those appropriate to indicate depletion of a 12 volt lead acid battery.

LED indicator at 9 and 12 volts

    I first exercised a breadboard version of this circuit using a variable output power supply, as shown in the composite illustration above. At 12 volts the LED is not illuminated, while at 9 volts it is fully lit. Ordinary red LED
’s do not glow very intensely—blue might be better for seeing in daylight. After breadboard testing I reconstructed the circuit on a small bare PCB, and added a short power tail and Anderson Powerpole for easy connection to the battery:

Battery low indicator
 
    The PCB revision yields the same test results as the breadboard circuit, and indicates the charge state of a marine deep-cycle battery on the garage bench. It remains to be seen whether a binary indicator will prove practical for on-the-water use. Next time out I will have this PCB in my pocket, for what it’s worth. A panel voltmeter or low end VOM could also be tossed in the seabag, and would likely be more informative as to the exact battery level.
 



Projects Home







Project descriptions on this page are intended for entertainment only. The author makes no claim as to the accuracy or completeness of the information presented. In no event will the author be liable for any damages, lost effort, inability to carry out a similar project, or to reproduce a claimed result, or anything else relating to a decision to use the information on this page.