Picture of Arduino Light Sensitive Bar Graph
This is a project for Arduino to make a Light Sensitive Bar Graph, aimed at beginners.

Arduino measures the voltage on a voltage divider composed of a resistor and an LDR (light dependant resistor).
A bar of LEDs are illuminated corresponding to the measured voltage.

* Learn how to use an LDR
* Learn how to illuminate a bar of LEDs according to a measured voltage
Remove these adsRemove these ads by Signing Up

Step 1: What you need

Picture of What you need
You will need:
* Arduino UNO
* Some LEDs
* A 560 Ohm resistor for each LED  (or a value similar to that)
* A 10k Ohm resistor
* An LDR
* Breadboard for wiring up e.g. (http://www.oomlout.co.uk/prototyping-bundle-for-arduino-ardp-p-186.html)
* Some Wires

Step 2: Wire it up

Picture of Wire it up
Wire up the circuit as shown in the diagrams.

Step 3: How to Illuminate the LEDS in a Bar

Converting the analogue value to a bar display is accomplished pretty easily with the map function:

sensorValue = analogRead(analogInPin);                   // read the analog in value
ledLevel = map(sensorValue, 0, 700, 0, NbrLEDs);    // map to the number of LEDs

The sensorValue range is 0 to 1023 theoretically. Practically it goes between about 0 and 700 for daylight and the chosen component values.

ledLevel will be 0 to 6 for example (if NbrLEDs = 6), over that same input range.

All you have to do then is use a for loop to turn ON the LEDs based on the ledLevel.
KurtRoesener5 months ago

Thanks for this, I built it and because I am just starting my Arduino journey this taught me some valuable things.

Serjien1 year ago

This is was part of a project I had in one of my classes. It was really helpful.

Thanks a bunch for putting this up!

emikayee1 year ago
I just made this, great instructable, thanks!