Introduction
The Internet of Things (IoT) allows physical devices to collect and exchange data through the internet. In this project, an LDR (Light Dependent Resistor) sensor is used to monitor changes in surrounding light intensity.
The sensor reading is collected by a microcontroller and monitored through the KiWiS IoT platform.
Objective
The main objective is to monitor light intensity in real time and display the sensor readings on an IoT dashboard.
Components Required
- LDR sensor
- Microcontroller with Wi-Fi capability
- Resistor
- Breadboard
- Jumper wires
- Power supply
- Wi-Fi connection
Software and Platform
- Arduino IDE
- KiwisIoT platform
Working Principle
- The LDR sensor detects the light falling on its surface.
- The sensor's electrical response changes according to the surrounding light.
- The microcontroller reads the sensor signal.
- The microcontroller sends the reading to the KiwisIoT platform through Wi-Fi.
- The dashboard displays the received sensor data.
- The displayed reading changes when the surrounding light conditions change.
Circuit Diagram
System Flow
Light Source → LDR Sensor → Microcontroller → Wi-Fi → KiwisIoT Dashboard
Realtime Image
LIGHT MONITORING CODE
#include <ESP8266WiFi.h>
#include <KiwisIoT.h>
const char* ssid = "XXX";
const char* pass = "YYY";
const char* topic = "dash_1234";
#define LDR_PIN A0
KiwisIoT kiwisiot(ssid, pass, topic);
void sendLightData() {
int rawValue = analogRead(LDR_PIN);
int lightLevel = 1023 - rawValue;
String lightStatus;
if (lightLevel >= 700) {
lightStatus = "BRIGHT";
}
else if (lightLevel >= 300) {
lightStatus = "MEDIUM";
}
else {
lightStatus = "DARK";
}
Serial.println();
Serial.println("---------- LIGHT MONITORING ----------");
Serial.print("Raw LDR Value: ");
Serial.println(rawValue);
Serial.print("Light Level: ");
Serial.println(lightLevel);
Serial.print("Light Status: ");
Serial.println(lightStatus);
kiwisiot.send("0", String(lightLevel));
kiwisiot.send("1", lightStatus);
Serial.print("Sent to KiwisIoT Channel 0: ");
Serial.println(lightLevel);
Serial.print("Sent to KiwisIoT Channel 1: ");
Serial.println(lightStatus);
}
void setup() {
Serial.begin(115200);
Serial.println();
Serial.println(" LDR LIGHT MONITORING ");
pinMode(LDR_PIN, INPUT);
Serial.println("LDR initialized");
Serial.println("Connecting to KiwisIoT...");
kiwisiot.begin();
Serial.println("KiwisIoT initialized");
Serial.println("Starting light monitoring...");
}
void loop() {
kiwisiot.run();
static unsigned long lastSend = 0;
if (millis() - lastSend >= 2000) {
lastSend = millis();
sendLightData();
}
delay(100);
}
Applications
- Smart lighting systems
- Indoor light monitoring
- Smart classrooms
- Energy-saving automation
- IoT-based environmental monitoring
Future Enhancements
- Automatic light ON/OFF control
- Mobile notifications
- Sensor data logging
- Historical data analysis
- Automatic brightness control
Conclusion
This project demonstrates how an LDR sensor and a Wi-Fi-enabled microcontroller can be used for IoT-based light monitoring. By connecting the system to KiwisIoT, sensor readings can be viewed through an online dashboard.
The project provides a foundation for developing more advanced smart lighting and environmental monitoring applications.
Project Category
IoT | Embedded Systems | Sensor Monitoring
Feedback
Have you worked on a similar IoT project? Share your ideas and suggestions in the comments!



Top comments (0)