43 – LED bars




    • Introduce the LED bars.
    • Show a sample circuit.
    • They are an elegant solution to display something as a percentage.



Arduino UNO Arduino UNO or equivalent.
BreadboardJumper wires A solderless Breadboard  plus some jumper wires.
330 Ohm resistor 8 x 330 Ω resistors.
LED bar A FJB10R chip with 10 LED arranged in a line.


The LED bars


Very often, we want to show the relative level of something. Either based on the value of a potentiometer, a light sensor, a temperature sensor, or any other variable.

It is not unusual to find reasons to use an indicator like this in this kind of tutorials and very often it is done by using, let’s say, 8 LEDs. The percentage of something is showed with respect to its maximum value.

The system works, but it is impractical and even less effective as an indicator, so we will introduce a very nice integrated circuit: FJB10R. LEDs are encapsulated in a single chip, ready to do those things. I am sure that you have seen them in more than one device out there and it is very nice to see how they dance following audio signals.

LED bar

They are small, cheap and very effective in showing this kind of percentage signals previously mentioned and, moreover, they are also designed to be able to work in cascade, just in case 10 LEDs are not enough. They are also available in several colors.

The connection is quite simple, because in the end they are just 10 LEDs arranged as parallel bars, but we can handle them exactly like a normal LED.

From now on, you must get into the habit of searching in Internet the data sheet of the components that you are going to use. So look for the FJB10R data sheet in Google, to find the information of the manufacturer.

We are interested, above all, in the description of the pins of the chip (which in this case is obvious, but do not trust)

  • Making assumptions about which is the pin out of a chip, will turn into another assured trip to the electronics store to find a replacement for the precious chip we have just grilled.
  • Do not assume anything. Test it. And the only sensible way is to look for the data sheet. Get accustomed to searching the data sheets in Google.

Let’s see the manufacturer’s diagram:

FJB10R data sheet

As expected, the manufacturer has placed the anodes (positive) diodes on one side and the cathodes (negative) in the other …
The connection of these chips is trivial, we need simply to connect a 330 Ω limiting resistor to each LED and connect the positive sides to 10 Arduino gates.

  • If you have followed the course up to this point, you know we are allergic to use so many resistors (we are too lazy), but in this case we have not any other option. We can only place the chip in the center lane of the breadboard and that forces us to choose between placing 10 resistors or one resistor and 10 jumper wires. (of course, I opted for the choice with less components, as you could expect).

The only trouble I see is that I am not able to find in the chip any mark indicating which is the pin number 1, so you have to guess it. To do it, connect the positive and negative pins of a single LED and check that it lights before connecting the rest.



Here we have the circuit wiring diagram:

Chapter 42, wiring diagram

The chip encapsulates the 10 LEDs and must be connected in parallel with their resistors to the Arduino pins from 3 to 12.



We have written a basic sketch to show the function of these displays. We read the potentiometer and map its value to a range between 3, the first pin, and 14, because we want 13 to be the last number.

The program turns on the LEDs below the value and turns off the rest.
Sketch 43.1


void setup()
       for (int i= 3; i<14 ; i++)
            pinMode(i, OUTPUT);

void loop()
       int v = analogRead(A5);
       int k = map ( v, 0, 1000, 3 , 13);
       for ( int j=3 ; j < 14 ; j++)
             if (j <= k)
                 digitalWrite(j, HIGH);
                 digitalWrite(j, LOW);





    • We have introduced the LED bars, a nice and very useful component in any project that requires to show a percentage.
    • We will use it in more chapters in the future.
    • They are very comfortable to use, although they are just 10 standard LEDs encapsulated in a block.



No Comments

Give a Reply