Smart Street Light Using LDR and NodeMCU ESP8266 With KiwisIoT

by ananthi rk in Circuits > Sensors

96 Views, 0 Favorites, 0 Comments

Smart Street Light Using LDR and NodeMCU ESP8266 With KiwisIoT

ChatGPT Image Sep 7, 2026, 05_42_18 PM.png

About This Project

  1. In this project, we are going to build a simple Smart Street Light using an LDR sensor and NodeMCU ESP8266 using KiwisIOT cloud platform.
  2. The LDR detects whether the surrounding environment is bright or dark. Based on the detected condition, the NodeMCU automatically turns the built-in LED ON or OFF.
  3. The sensor status and street light status are also displayed on the KiwisIoT IoT dashboard using Wi-Fi.
  4. This is a simple beginner-friendly IoT project that demonstrates sensor monitoring, automatic control, Wi-Fi communication, and KiwisIoT dashboard visualization.

Supplies

Supplies_832x551.png

Hardware

  1. NodeMCU ESP8266
  2. 3-Pin LDR Sensor Module
  3. Jumper Wires
  4. USB Cable

Software

  1. Arduino IDE
  2. ESP8266 Board Package
  3. KiwisIoT Platform
  4. Library - KiwisIoT

CIRCUIT CONNECTION

Gemini_Generated_Image_7i1ov67i1ov67i1o.png

Connect the LDR module to NodeMCU as follows:


LDR MODULE NODEMCU ESP8266:

VCC → 3V3
GND → GND
DO → D5


  1. The NodeMCU built-in LED is controlled using D4.

HOW THE PROJECT WORKS

This Smart Street Light automatically controls the street light using an LDR Sensor and NodeMCU ESP8266.


During Dark Conditions :


LDR detects darkness
↓
LDR State = 1
↓
NodeMCU ESP8266 processes the sensor data
↓
Street Light ON
↓
Status sent to KiwisIoT Dashboard


During Bright Conditions :


LDR detects light
↓
LDR State = 0
↓
NodeMCU ESP8266 processes the sensor data
↓
Street Light OFF
↓
Status sent to KiwisIoT Dashboard


KiwisIoT Dashboard:

The dashboard displays:

  1. LDR Status
  2. Street Light Status
  3. Real-time IoT Monitoring


SET UP KIWISIOT

Screenshot (2156).png
topic_id_blurred_832x551.png
ChatGPT Image Sep 9, 2026, 12_27_11 PM.png

Create Your KiwisIoT Account

  1. open the KiwisIoT platform and log in to your account.
  2. https://kiwisiot.in/login

Open Your Dashboard

  1. After successfully logging in, you can access your KiwisIoT dashboard.


Create a New Panel

  1. Go to My Panels and create a new panel.
  2. Panel Name: Smart Street Light


Create two widgets.


  1. Widget 1 – LABEL

Name : LDR STATUS

Channel ID : 0

This widget displays the current status of the LDR sensor.


  1. Widget 2 – LED

Name : STREET LIGHT

Channel ID : 1

This widget displays whether the Street Light is ON or OFF.

ARDUINO CODE

#include <ESP8266WiFi.h>
#include <KiwisIoT.h>

// WiFi Details

const char* ssid = "YOUR_WIFI_NAME";
const char* pass = "YOUR_WIFI_PASSWORD";

// KiwisIoT Panel Topic ID

const char* topic = "dash_xxxxxxxxxxxxx";

KiwisIoT kiwisiot(ssid, pass, topic);


// Pin Configuration

#define LDR_PIN D5
#define LED_PIN D4

// SETUP
void setup()
{
Serial.begin(115200);

// LDR input
pinMode(LDR_PIN, INPUT);

// Built-in LED
pinMode(LED_PIN, OUTPUT);

// Initially LED OFF
digitalWrite(LED_PIN, HIGH);

// Start KiwisIoT
kiwisiot.begin();

Serial.println();
Serial.println("==============================");
Serial.println("SMART STREET LIGHT");
Serial.println("==============================");
Serial.println("KiwisIoT Starting...");
}

// LOOP
void loop()
{
// Read LDR
int ldrState = digitalRead(LDR_PIN);


// BRIGHT
// LDR = 0
// Street Light = OFF


if (ldrState == LOW)
{
// Built-in LED OFF
digitalWrite(LED_PIN, HIGH);

Serial.println("------------------------------");
Serial.println("LDR State : 0");
Serial.println("Condition : BRIGHT");
Serial.println("Street Light : OFF");

// KiwisIoT
// Channel 0 = LDR Status
kiwisiot.send("0", 0);

// Channel 1 = Street Light
kiwisiot.send("1", 0);
}

// DARK
// LDR = 1
// Street Light = ON

else
{
// Built-in LED ON
digitalWrite(LED_PIN, LOW);

Serial.println("------------------------------");
Serial.println("LDR State : 1");
Serial.println("Condition : DARK");
Serial.println("Street Light : ON");

// KiwisIoT
// Channel 0 = LDR Status
kiwisiot.send("0", 1);

// Channel 1 = Street Light
kiwisiot.send("1", 1);
}

// KiwisIoT communication
kiwisiot.run();

// Update every 2 seconds
delay(2000);
}

TEST THE PROJECT

arduino_screenshot_832x551.png


After uploading the code to the NodeMCU ESP8266, test the Smart Street Light by changing the light condition around the LDR sensor.


Test 1: Bright Condition

  1. Expose the LDR Sensor to light.

Expected Output:

LDR State: 0
Condition: BRIGHT
Street Light: OFF


Test 2: Dark Condition

  1. Cover the LDR Sensor to create darkness.

Expected Output:

LDR State: 1
Condition: DARK
Street Light: ON


KIWISIOT DASHBOARD RESULT

ChatGPT Image Sep 9, 2026, 12_20_20 PM.png
ChatGPT Image Sep 9, 2026, 12_17_21 PM.png

After connecting the NodeMCU ESP8266 to KiwisIoT, the dashboard displays the real-time status of the LDR sensor and Street Light.


Bright Condition

  1. When the surrounding environment is bright:

LDR STATUS → 0

STREET LIGHT → 0 (OFF)


Dark Condition

  1. When the surrounding environment is dark:

LDR STATUS → 1

STREET LIGHT → 1 (ON)

RESULT

  1. The Smart Street Light was successfully built using an LDR sensor and NodeMCU ESP8266.
  2. The system automatically turns the light OFF during bright conditions and ON during dark conditions.
  3. The LDR status and street light status are also monitored through the KiwisIoT dashboard.

CONCLUSION

  1. This project demonstrates a simple and practical IoT application using an LDR sensor, NodeMCU ESP8266, and KiwisIoT.
  2. It is a good beginner project for understanding IoT sensors, automatic control, Wi-Fi communication, and cloud dashboards.