IR Sentinel KiwisIoT: ESP8266-Based Real-Time Object Detection
Introduction
Hello Dev Community! ๐
I built IR Sentinel KiwisIoT, a simple IoT-based object detection project using an ESP8266 NodeMCU, an IR sensor module, and the KiwisIoT platform.
The system detects nearby objects using an infrared sensor, processes the sensor's digital output through the ESP8266, and sends the object status to a KiwisIoT dashboard over Wi-Fi.
This project helped me explore sensor interfacing, embedded programming, wireless communication, and IoT dashboard monitoring.
๐ ๏ธ Components Used
- ESP8266 NodeMCU development board
- IR obstacle detection sensor module
- Jumper wires
- USB cable for power and programming
- Arduino IDE
- KiwisIoT account and dashboard
- Wi-Fi connection
๐ Circuit Diagram and Connection Explanation
The IR sensor module is connected to the ESP8266 NodeMCU using three main connections:
| IR sensor pin | ESP8266 connection | Purpose |
|---|---|---|
| VCC | Suitable power pin | Powers the sensor |
| GND | GND | Common ground |
| DO | D7 (GPIO13) | Digital detection signal |
| AO | Not connected | Analog output is unused |
The digital output pin sends a signal to the ESP8266 whenever the sensor detects an object according to its sensitivity setting.
Important: The circuit illustration shows D6 in its simplified connection table, while the code below uses D7. For this code, connect DO to D7. If your actual hardware uses D6, change the pin definition in the code to D6. Also, verify the sensor's voltage requirements and ensure its output is safe for the ESP8266's 3.3 V GPIO.
โ๏ธ How It Works
The project follows these steps:
- The IR sensor monitors the area in front of it.
- The ESP8266 reads the sensor's digital output.
- The program converts the signal into DETECTED or NOT DETECTED.
- The ESP8266 sends the status to KiwisIoT through Wi-Fi.
- The dashboard displays the received object detection status.
The code checks the sensor periodically and sends an update approximately every two seconds.
๐ป Arduino Code
The following Arduino sketch uses the ESP8266 NodeMCU, the IR sensor's digital output, and the KiwisIoT library.
Before uploading, replace the Wi-Fi and dashboard placeholders with your own settings. Never publish your Wi-Fi password in a public post.
/*
* Project: IR Sentinel KiwisIoT
* Project ID: KIWISIOT-002
* Board: ESP8266 NodeMCU
* Sensor: IR Obstacle Detection Module
*/
#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 IR_PIN D7
KiwisIoT kiwisiot(ssid, pass, topic);
void sendObjectStatus() {
int irState = digitalRead(IR_PIN);
String objectStatus;
// Many IR modules output LOW when an object is detected.
if (irState == LOW) {
objectStatus = "DETECTED";
} else {
objectStatus = "NOT DETECTED";
}
Serial.println("\\n--- IR SENTINEL MONITORING ---");
Serial.print("IR Sensor Value: ");
Serial.println(irState);
Serial.print("Object Status: ");
Serial.println(objectStatus);
// Send the status to KiwisIoT Channel 0.
kiwisiot.send("0", objectStatus);
Serial.println("Status sent to KiwisIoT");
}
void setup() {
Serial.begin(115200);
pinMode(IR_PIN, INPUT);
Serial.println("\\nIR Sentinel KiwisIoT");
Serial.println("Initializing KiwisIoT...");
kiwisiot.begin();
}
void loop() {
kiwisiot.run();
static unsigned long lastSend = 0;
if (millis() - lastSend >= 2000) {
lastSend = millis();
sendObjectStatus();
}
delay(100);
}
โ๏ธ KiwisIoT Dashboard Configuration
I configured a KiwisIoT dashboard to display the object detection status received from the ESP8266. The program sends the status string to Channel 0 using the KiwisIoT library.
The dashboard screenshot shows DETECTED in green. This demonstrates the status displayed by the dashboard during my test.
To reproduce the setup:
- Create or open your KiwisIoT dashboard.
- Configure the topic ID used by your ESP8266 program.
- Add a suitable text or label widget.
- Configure the widget to display the data from Channel 0.
- Upload the program and verify that the displayed status changes when an object enters or leaves the sensor's detection range.
The exact dashboard configuration may depend on the KiwisIoT interface and widget settings.
๐งช Live Test Result
I connected the IR sensor module to the ESP8266 NodeMCU and powered the board through USB. The sensor's digital output was used to determine the detection status.
The KiwisIoT dashboard screenshot captured during testing displays DETECTED in green.
Expected observations:
- Object detected: DETECTED
- No object detected: NOT DETECTED
- Wi-Fi unavailable: New remote dashboard updates may stop
The results depend on sensor sensitivity, object distance and surface, sensor output logic, and Wi-Fi connectivity.
๐ System Architecture
IR Sensor โ ESP8266 NodeMCU โ Wi-Fi โ KiwisIoT Dashboard
The IR sensor provides the input, the ESP8266 processes the signal, and KiwisIoT displays the received status for remote monitoring.
๐ Possible Applications
- Basic object presence monitoring
- Educational IoT experiments
- Proximity detection demonstrations
- Entry or passage monitoring prototypes
- Learning embedded systems and wireless communication
This is an educational project and is not intended to replace safety-certified detection systems.
๐ Future Improvements
- Add an LED or buzzer alert.
- Send notifications when an object is detected.
- Record detection events over time.
- Add multiple sensors for monitoring different locations.
- Build a compact enclosure for the electronics.
๐ References
- KiwisIoT Projects Repository: https://github.com/Kiwistron/KiwisIoT-Projects
- ESP8266 Arduino Core: https://github.com/esp8266/Arduino
- ESP8266 Documentation: https://arduino-esp8266.readthedocs.io/
- Arduino IDE: https://www.arduino.cc/en/software
Conclusion
IR Sentinel KiwisIoT demonstrates how a low-cost IR sensor and ESP8266 NodeMCU can be combined with an IoT dashboard for remote object detection monitoring.
Building this project provided practical experience with sensor interfacing, Arduino programming, Wi-Fi communication, and dashboard integration.
Thanks for reading! Feel free to share your suggestions and ideas for improving this project. ๐



Top comments (2)
...._....
Hi