Dark Sensitive Interactive Light Using 20 Segment Bar-Graph and Arduino

The Project is based on 20 Segment Bar Graph (2X10 LED PCB), Arduino Mega and LDR, The project converts darkness in to number of LEDs, number of LEDs will glow proportional to darkness falls on LDR. Circuit works with 12V DC and draw 4 Amps while all LEDs are ON. Digital pin D22 to D41 of Arduino used to driver LEDs.

Download Arduino Code

Download PDF Schematic

Watch Video Of This Project

Arduino Code


/*
* Dark Sensitive interactive LED Light , The project consist 20 segment Bar-graph white LEDs ,
* Driver transistors for LEDs, LDR, Pull Resistor for LDR and arduino mega
* Code writen for arduino mega, Arduino code, schematic, PCB layout
available at our website www.twovolt.com, This also can be used as dark senst

*/

// these constants won’t change:
const int analogPin = A0; // the pin that the potentiometer is attached to
const int ledCount = 20; // the number of LEDs in the bar graph

int ledPins[] = {
22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41
}; // an array of pin numbers to which LEDs are attached

void setup() {
// loop over the pin array and set them all to output:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
pinMode(ledPins[thisLed], OUTPUT);
}
}

void loop() {
// read the potentiometer:
int sensorReading = analogRead(analogPin);
// map the result to a range from 0 to the number of LEDs:
int ledLevel = map(sensorReading, 350, 950, 0, ledCount);

// loop over the LED array:
for (int thisLed = 0; thisLed < ledCount; thisLed++) {
// if the array element’s index is less than ledLevel,
// turn the pin for this element on:
if (thisLed < ledLevel) {
digitalWrite(ledPins[thisLed], HIGH);
}
// turn off all pins higher than the ledLevel:
else {
digitalWrite(ledPins[thisLed], LOW);
}
}
}

Dark Sensitive LED Light

Dark activated LED light is a simple project which operates a LED when the light falling on the LDR goes below a set point.  The circuit is built using LM393 comparator, LDR as light sensor, preset (potentiometer) for sensitivity adjustment, transistor to drive the LED. The project can also be considered for use in energy saving application.

Features
  • Input – 12 V @ 1A
  • LED 12V 500mA Maximum (6W)
  • Onboard Preset for Level Adjust
  • Operation LED Indicator
  • On Board Power LED
  • Header Connector for Power Supply and LED
  • PCB dimensions 55.45MM X 12.70 MM

Dark-Activated-LED-Light-SCH

SCHEMATIC

Dark-Activated-LED-Light-BOM

PARTS LIST

Dark-Activated-LED-Light-Wiring

CONNECTIONS

Dark-Activated-LED-Light-001

PROJECT PICTURE

Dark-Activated-LED-Light-002

PROJECT PICTURE BACK SIDE