Najad
Published © GPL3+

Motion Activated Light With Automatic Brightness Adjust

We are going to make a circuit for Motion Sensor Activated Light With Automatic Brightness Adjustment using Arduino, PIR & LDR

BeginnerProtip4,258

Things used in this project

Hardware components

Arduino Nano R3
Arduino Nano R3
×1
Darlington High Power Transistor
Darlington High Power Transistor
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 10k ohm
Resistor 10k ohm
×1
PIR Motion Sensor (generic)
PIR Motion Sensor (generic)
×1
LDR, 5 Mohm
LDR, 5 Mohm
×1

Software apps and online services

Arduino IDE
Arduino IDE

Hand tools and fabrication machines

PCB, For DMB-4775
PCB, For DMB-4775
Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Schematics

circuit_fMmuAlUxIR.jpg

Code

Code

Arduino
#define LDR A7
#define PIR 2
#define Light 3
 
int LDRvalue;
long counter;
 
void setup() {
  pinMode(PIR, INPUT);
  pinMode(Light, OUTPUT);
}
 
void loop() {
  if (digitalRead(PIR) == HIGH)
  {
    counter =0;
    LDRvalue = map(analogRead(LDR), 0, 1024, 254, 0);
    delay(50);
    analogWrite(Light,LDRvalue);
  }
  else
    counter++;
  if (counter >= 10000)
    digitalWrite(Light, LOW);
    }

Credits

Najad

Najad

30 projects • 96 followers
Just crazy stuff​

Comments