Control a lamp using an IR remote and ESP8266 NodeMCU

ESP8266 09-10-25
38 0

Tutorial plan

1- Objective of the tutorial

2- The necessary components

3- Assembly of the electronic system

4- Program ESP8266 NodeMCU with MicroPython

 

 

Objective of the tutorial

The objective of this tutorial is to control a lamp remotely using an infrared (IR) remote and an ESP8266 NodeMCU. The system allows you to turn the lamp ON or OFF by pressing specific buttons on the IR remote control. The ESP8266 NodeMCU receives the IR signals through an IR receiver, decodes them, and activates or deactivates a relay module connected to the lamp.

This project demonstrates how to:

- interface an IR receiver with the ESP8266 NodeMCU.

- decode the signals sent by an IR remote control.

- use the decoded IR codes to control a relay module.

- switch a lamp connected to a 220V power source safely through the relay.

 

The necessary components

1- ESP8266 NodeMCU Board

The main microcontroller that receives IR signals, processes them, and controls the relay module.

2- IR Receiver Module (KY-032)

KY-032 infrared sensor module

It detects and receives infrared signals sent by the IR remote control.

3- IR Remote Control

Télécommande infrarouge

It is used to send IR signals to the receiver to turn the lamp ON or OFF.

4- Relay Module

It acts as a switch to safely control the 220V AC lamp using the low-voltage signal from the ESP8266.

5- Lamp (220V)

The electrical load that will be turned ON or OFF by the relay.

4. Power Supply (220V AC)

It provides the electrical power needed to operate the lamp.

Wiring:

They safely connect a 220V AC lamp to a relay module that is controlled by the ESP8266 NodeMCU board.

6- Breadboard

plaque d'essai

It is used for making easy and temporary connections between components.

7- Jumper Wires

Fils de connexion

It is used for connecting the ESP8266 NodeMCU to the IR receiver and relay module.

 

Assembly of the electronic system

1- Connect the KY-032 infrared sensor to the ESP8266 board:

- Connect the VCC pin of the KY-032 sensor to the 3V pin on the ESP8266 board.

- Connect the GND pin of the KY-032 sensor to the GND pin on the ESP8266 board.

- Connect the OUT pin of the KY-032 sensor to a digital pin D1 (GPIO5) on the ESP8266 board.

2- Connect the Relay to the ESP8266 board:

- Connect the relay's control pin (S) to pin D0 (GPIO16) of ESP8266 board.

- Connect the pin (+) of relay to pin 3.3V of ESP8266 board.

- Connect the relay's ground pin (GND) to the ESP8266 board's GND.

3- Connect the Lamp and the power supply to the Relay:

- Connect one of the power supply's wires to the relay's common (COM) terminal.

- Connect the phase wire of the the lamp to the normally open (NO) terminal of the relay.

- Connect the neutral wire of the power supply directly to the neutral wire of the lamp.

 

Program ESP8266 NodeMCU with MicroPython

Here's a sample MicroPython code to read data from the KY-032 sensor and control the lamp based on its output:

You must install this library ir_rx to use for infrared remote signal reception and decoding.

0 comment

Leave a comment

Veuillez noter s'il vous plaît*

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Purpose of this website

Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.

Contact details

Zaouiet Kontech-Jemmel-Monastir-Tunisia

+216 92 886 231

medaliprof@gmail.com

Pictures of the articles

Robotic site created by MedAli-Teacher info