๐ MotionGuard IoT: Building a Real-Time PIR Motion Detection System Using ESP8266 and KiwisIoT
Have you ever wanted to monitor human movement remotely using IoT technology?
In this project, I built MotionGuard IoT, a smart motion detection system using an ESP8266 NodeMCU and a PIR (Passive Infrared) sensor.
The system detects human movement and sends the sensor information to the KiwisIoT Platform through Wi-Fi.
The dashboard displays the motion status in real time:
- True โ Motion Detected
- False โ No Motion Detected
Let's see how this project works!
๐ก 1. Project Overview
The main objective of MotionGuard IoT is to detect human movement and monitor the status remotely.
The PIR sensor detects changes in infrared radiation caused by movement. The ESP8266 processes the sensor signal and sends the result to the KiwisIoT dashboard.
๐งฐ 2. Components Required
| Component | Quantity |
|---|---|
| ESP8266 NodeMCU | 1 |
| PIR Motion Sensor | 1 |
| Jumper Wires | As required |
| USB Cable | 1 |
| Computer | 1 |
Software and Tools
- Arduino IDE
- ESP8266 Board Package
- KiwisIoT Arduino Library
- KiwisIoT Platform
- Wi-Fi Connection
๐ 3. Circuit Connections
The PIR sensor is connected to the ESP8266 NodeMCU using jumper wires.
| PIR Sensor | ESP8266 NodeMCU |
|---|---|
| VCC | Suitable power supply |
| GND | GND |
| OUT | D7 |
The OUT pin sends the motion detection signal to the ESP8266.
Important: Check your PIR module's voltage requirements. Some PIR modules require 5V power. Make sure the signal reaching the ESP8266 GPIO does not exceed 3.3V.
โ๏ธ 4. How Does It Work?
The working process is simple:
- The PIR sensor monitors its surroundings.
- When a person moves in front of the sensor, it detects infrared changes.
- The ESP8266 receives the sensor signal.
- If movement is detected, the status becomes True.
- If there is no movement, the status becomes False.
- The ESP8266 sends the information through Wi-Fi.
- The KiwisIoT dashboard displays the motion status.
๐ป 5. Arduino Programming
I used Arduino IDE to program the ESP8266 NodeMCU.
The program reads the PIR sensor through digital pin D7 and sends the motion status to KiwisIoT Channel 0.
Before uploading, configure your Wi-Fi name, password, and KiwisIoT topic ID.
#include <ESP8266WiFi.h>
#include <KiwisIoT.h>
const char* ssid = "YOUR_WIFI_NAME";
const char* pass = "YOUR_WIFI_PASSWORD";
const char* topic = "YOUR_DASHBOARD_TOPIC_ID";
#define PIR_PIN D7
KiwisIoT kiwisiot(ssid, pass, topic);
void sendMotionStatus() {
int pirState = digitalRead(PIR_PIN);
String motionStatus;
if (pirState == HIGH) {
motionStatus = "True";
}
else {
motionStatus = "False";
}
Serial.println();
Serial.println("---------- PIR MONITORING ----------");
Serial.print("PIR Sensor Value: ");
Serial.println(pirState);
Serial.print("Motion Status: ");
Serial.println(motionStatus);
if (pirState == HIGH) {
Serial.println("Motion: DETECTED");
}
else {
Serial.println("Motion: NOT DETECTED");
}
kiwisiot.send("0", motionStatus);
Serial.print("Sent to KiwisIoT Channel 0: ");
Serial.println(motionStatus);
}
void setup() {
Serial.begin(115200);
pinMode(PIR_PIN, INPUT);
Serial.println("PIR MOTION MONITORING");
kiwisiot.begin();
Serial.println("Starting motion monitoring...");
}
void loop() {
kiwisiot.run();
static unsigned long lastSend = 0;
if (millis() - lastSend >= 2000) {
lastSend = millis();
sendMotionStatus();
}
delay(100);
}
โ๏ธ 6. KiwisIoT Dashboard Integration
One of the important features of this project is its integration with the KiwisIoT Platform.
The ESP8266 sends the motion status to Channel 0 through Wi-Fi.
Dashboard Configuration:
- Platform: KiwisIoT
- Widget Name: Motion Detection
- Widget Type: Label
- Channel ID: 0
The dashboard displays the received motion status as True or False.
๐งช 7. Live Testing and Results
I tested the project under two different conditions.
Test 1: Motion Detected
When someone moves in front of the PIR sensor:
PIR Sensor Value: 1
Motion Status: True
Motion: DETECTED
Dashboard Result: True
๐ 8. Real-World Applications
MotionGuard IoT can be used in:
- Smart Home Monitoring
- Room Movement Detection
- Smart Lighting Systems
- Entry Monitoring
- Office Security
- IoT-Based Monitoring Systems
๐ฎ 9. Future Improvements
In future versions, I would like to add:
- LED indicators
- Buzzer alerts
- Mobile notifications
- Automatic light control
- Multiple PIR sensors
- Motion activity history
๐ 10. What I Learned
Through this project, I learned:
- How to interface a PIR sensor with ESP8266.
- How to detect human movement.
- How to connect ESP8266 to Wi-Fi.
- How to send sensor data to KiwisIoT.
- How to monitor sensor information through an IoT dashboard.
๐ Conclusion
MotionGuard IoT demonstrates how a PIR sensor, ESP8266 NodeMCU, and KiwisIoT Platform can work together to create a simple remote motion monitoring system.
This project was a great learning experience that helped me understand sensor interfacing, Arduino programming, Wi-Fi communication, and IoT dashboard integration.
Thanks for reading!
I hope this project inspires other beginners to explore IoT technology.
Built With: ESP8266 NodeMCU | PIR Sensor | Arduino IDE | KiwisIoT Platform



Top comments (0)