Off by day, dim at night, and full brightness when someone passes.
Built and tested by Drisya K S · Industrial Robotics Institute
Arduino IDE, Blynk (optional)
An energy-saving street light. An LDR detects whether it is day or night, and a PIR sensor detects people or vehicles. During the day the light stays off; at night it glows dim, and it switches to full brightness whenever motion is detected, using PWM through a MOSFET.
| Component | Qty |
|---|---|
| ESP8266 NodeMCU (or Arduino Uno) | 1 |
| LDR | 1 |
| Resistor 10kΩ | 1 |
| PIR Motion Sensor | 1 |
| MOSFET or Relay Module | 1 |
| LED / Bulb | 1 |
| Jumper Wires | As needed |
| Breadboard | 1 |
| Power Supply | 1 |
| From | Connect to |
|---|---|
| LDR one leg | 3.3V |
| LDR other leg | A0 |
| 10kΩ resistor | A0 to GND |
| PIR VCC | 5V (VIN) |
| PIR GND | GND |
| PIR OUT | D5 |
| MOSFET gate | D6 (PWM) |
| LED / bulb − | MOSFET drain |
| MOSFET source | GND |
Complete, tested Arduino C++ code for this project. Copy it into Arduino IDE and upload it to the ESP8266 NodeMCU.
int ldrPin = A0;
int pirPin = D5;
int ledPin = D6;
void setup() {
pinMode(pirPin, INPUT);
pinMode(ledPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
int lightValue = analogRead(ldrPin);
int motion = digitalRead(pirPin);
Serial.println(lightValue);
if (lightValue < 500) { // night
if (motion == HIGH) {
analogWrite(ledPin, 1023); // bright
} else {
analogWrite(ledPin, 300); // dim
}
} else {
analogWrite(ledPin, 0); // day: off
}
delay(200);
}An energy-saving street light. An LDR detects whether it is day or night, and a PIR sensor detects people or vehicles.
You need: ESP8266 NodeMCU (or Arduino Uno) (1), LDR (1), Resistor 10kΩ (1), PIR Motion Sensor (1), MOSFET or Relay Module (1), LED / Bulb (1), Jumper Wires, Breadboard (1), Power Supply (1). Software: Arduino IDE, Blynk (optional).
Yes. It is rated beginner and takes about 1–2 hours to build, using the ESP8266 NodeMCU. The guide on this page explains every connection and step.
The complete, tested Arduino C++ code is free on this page. Copy it into Arduino IDE and upload it to the board.
Yes. IRI sells a kit with the parts for this project (PRJ-152). Message IRI on WhatsApp at +91 86060 82634 for the kit price and delivery details.