← Back to Basic Projects

πŸ“Š Analog LED Bar Graph Display

Map any analog sensor value to a 10-LED bar graph β€” build a visual voltmeter, audio meter, or fuel gauge for your projects.

πŸ“‹ Overview

An LED bar graph display converts a numeric value into a visual level indicator. It's the classic 'fuel gauge' or 'battery indicator' in electronics. You can map any sensor β€” potentiometer, LDR, temperature, microphone β€” to this display.

Technical Insight: We use map() to scale the ADC range (0–1023) to 0–10 LEDs. For each level, we turn on all LEDs from 1 up to that level (bargraph mode) OR only that specific LED (dot mode). The LM3914 chip does this in hardware, but this project teaches the software equivalent with full flexibility.

In simple terms: Think of it as a thermometer made of LEDs instead of mercury. The higher the sensor reading, the more LEDs fill up from bottom to top β€” a number converted to a visual length.

What you'll learn: Multi-LED sequencing, map() and constrain(), bar vs dot display modes, sensor-agnostic visualization, and practical UI design for embedded systems.

Estimated time: 35-45 minutes. Difficulty: ⭐ Beginner-friendly.

🧩 Components Needed

ComponentSpecificationQtyNotes
Arduino Uno R35V1
LEDs5mm β€” Green, Yellow, Red mix105G + 3Y + 2R for visual flair
Resistors220Ξ©10One per LED
Potentiometer10kΞ©1Demo input β€” swap for any sensor
Breadboard + WiresFull-size1

πŸ—ΊοΈ Component Pin Mapping

Analog LED Bar Graph Display Component Pin Mapping Infographic

πŸ“– Step-by-Step Tutorial

1

Place 10 LEDs in a Row

Insert LEDs in the breadboard with consistent spacing. Use green for positions 1–5, yellow for 6–8, red for 9–10 to mimic a professional level indicator.
2

Wire Anodes to Arduino

LED 1 anode β†’ Pin 2 via 220Ξ©, LED 2 β†’ Pin 3, ... LED 10 β†’ Pin 11. All cathodes to GND.
3

Wire the Potentiometer

Left pin β†’ 5V, Right β†’ GND, Center β†’ A0. This is your test input.
4

Upload and Turn the Knob

Upload code. Rotate the potentiometer β€” LEDs fill up as you turn clockwise.
5

Swap Input Sensor

Replace potentiometer with LDR, microphone, temperature sensor, or voltage divider. No code changes needed β€” it's sensor-agnostic!
πŸ’‘
The bar graph mode (all LEDs from 1 to level lit) uses more power but is easier to read. The dot mode (only current LED lit) is power-efficient but harder to see at a glance. This code defaults to bar mode; change the loop to dot mode for battery-powered projects.

πŸ’» Arduino Code

led_bargraph_display.ino
INO
// LED Bar Graph Display β€” Volt X
// 10 LEDs on pins 2-11, potentiometer on A0

const int NUM_LEDS  = 10;
const int LED_PINS[NUM_LEDS] = {2,3,4,5,6,7,8,9,10,11};
const int SENSE_PIN = A0;

void setup() {
  for (int i = 0; i < NUM_LEDS; i++)
    pinMode(LED_PINS[i], OUTPUT);
  Serial.begin(9600);
}

void showBar(int level) {
  // BAR MODE: light all LEDs from 0 up to level
  for (int i = 0; i < NUM_LEDS; i++)
    digitalWrite(LED_PINS[i], i < level ? HIGH : LOW);
}

void loop() {
  int raw   = analogRead(SENSE_PIN);          // 0-1023
  int level = map(raw, 0, 1023, 0, NUM_LEDS); // 0-10
  level = constrain(level, 0, NUM_LEDS);
  
  showBar(level);

⭐Reviews & Ratings

β€”0 reviews
5β˜…
0
4β˜…
0
3β˜…
0
2β˜…
0
1β˜…
0
...

Loading reviews...

volt-X / Analog LED Bar Graph Display β€” Arduino Tutorial