Interface IR sensor with ESP8266

Empower Your Innovation: Unleashing the Potential of Robotics, UAVs, IoT, and Beyond!

Interface IR sensor with ESP8266

How to interface IR sensor with ESP8266 (Node MCU)

An infrared sensor (IR sensor) is a radiation-sensitive optoelectronic component with spectral sensitivity in the infrared wavelength range of 780 nm … 50 µm. IR sensors are now widely used in motion detectors, which are used in building services to switch on lamps or in alarm systems to detect unwelcome guests. In a defined angle range, the sensor elements detect the heat radiation (infrared radiation) that changes over time and space due to the movement of people.

Let’s Start

Connect IR Sensor with esp

✘ Connect Vcc pin of sensor to 3V3 pin of Node MCU.

✘ Connect GND pin of the sensor to GND pin of Node MCU.

✘ Connect signal pin of the sensor to D1 pin of Node MCU.

ESP 8266 WITH IR Sensor

Coding Part

Program for IR Sensor 
int IR = D1;
//Definethe pin Name.
void setup() {
Serial.begin(9600); //Begin the serial communcation between Node MCU and Serial monitor. 
pinMode(IR, INPUT); // Declare the sensor as Input.
}
void loop() { int s = digitalRead(IR); //This will read the sensor data and store it in a variable. Serial.println(s); //This will print the sensor data to serial monitor.
} 
Arduino Code

Tags: , ,

Leave a Reply

Your email address will not be published. Required fields are marked *