Controlling robot car using ESP32 board and IR Remote Control

ESP32 03-12-26
7 0

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- Micropython program for ESP32 board

 

 

Objective of the project

This project consists of building a four-wheel robot car controlled remotely using an ESP32 development board and an infrared (IR) remote control. The system is designed to receive infrared signals, process user commands, and control the movement of the robot car.

The infrared sensor KY-032 is used as the infrared receiver module in the system. When the user presses a button on the remote control, an infrared signal is transmitted and detected by the receiving circuit. The received signal is then processed by the ESP32 board to determine the requested movement.

The ESP32 controls the four DC motors through the L298N motor driver module. This module acts as a power interface between the ESP32 and the motors, allowing the board to control their rotation direction and speed.

Depending on the selected button on the remote control, the robot car can move forward, move backward, turn left, turn right, or stop. The ESP32 coordinates the operation of the motors to perform the requested movements.

This project provides an introduction to ESP32 programming, infrared communication, DC motor control, and motor driver applications in mobile robotics.

Required Components

1. ESP32 Boards

The ESP32 is the main control unit of the robot car. It receives the infrared signals from the receiver, processes the commands sent by the remote control, and generates the appropriate control signals to operate the motors. It also provides GPIO pins and PWM outputs for controlling the motor driver.

2. L298N Motor Driver Module

The L298N is a dual H-bridge motor driver used to control the four DC motors of the robot car. It receives control signals from the receiver ESP32 and regulates the direction and speed of the motors. Its two output channels allow the motors on the left side and right side of the car to be controlled independently.

3- IR Remote Control 

Télécommande infrarouge

The infrared remote control allows the user to operate the robot car wirelessly. By pressing different buttons, the user can send commands to control the car's movements, such as moving forward, moving backward, turning left, turning right, and stopping.

4- KY-032 Infrared Sensor

Capteur infrarouge KY-032

The KY-032 is an infrared sensor module used to detect infrared signals or nearby obstacles. In this project, it is intended to receive infrared signals and transmit its output through the OUT pin to the ESP32. The ESP32 uses the received signal to determine the required action.

5. 5V/3.3V Power Supply

Module d'alimentation

The 5V/3.3V power supply module provides the appropriate regulated voltage to power the receiver ESP32 board and its associated electronic components

6. Four-Wheeled Car Chassis

The four-wheeled car chassis provides the mechanical structure of the robot. It consists of four DC motors, four wheels, and a supporting frame. The motors allow the car to move forward, backward, turn left, and turn right.

7. Connecting wires

Jumper wires

Connecting wires are used to establish electrical connections between the ESP32 boards, joystick, L298N motor driver, motors, and power supply. They ensure the transmission of electrical signals and power throughout the system.

8. Two 3.7V Rechargeable Batteries

The two 3.7V rechargeable batteries provide the electrical power required to operate the robotic car. They supply energy to the L298N Motor Driver Module and the four DC motors, allowing the car to move autonomously according to the commands received from the sender ESP32.

9. Breadboard

plaque d'essai

The breadboard is used to connect and assemble electronic components without soldering. It facilitates the connection of the receiver ESP32 board to the 5V/3.3V power supply module and other electronic components. It allows students to build, test, and modify electronic circuits easily.

10- 9V Battery:


The 9V battery serves as the electrical power source for the system. It supplies power to the 3.3V/5V power supply module, which converts the 9V input voltage into two regulated output voltages: 5V and 3.3V. These voltages are used to power the various electronic components of the system.

 

Circuit Connections of system

1- Connecting the ESP32 to the L298N Module

The  ESP32 board receives Bluetooth commands from the transmitter and controls the motors through the L298N motor driver module.

L298N Module ESP32 Board Function
IN1 GPIO 22 Controls the first motor rotation direction
IN2 GPIO 21 Controls the opposite rotation direction
IN3 GPIO 19 Controls the third motor control input
IN4 GPIO 18 Controls the fourth motor control input
ENA GPIO 23 (PWM) Controls the speed of the left-side motors
ENB GPIO 5 (PWM) Controls the speed of the right-side motors
GND GND Common ground connection

2- Connecting the Motors to the L298N Module

L298N Outputs Connected Components
OUT1 – OUT2 Two motors on the left side
OUT3 – OUT4 Two motors on the right side

The two motors on each side are connected together to operate simultaneously. This configuration allows the robot car to move in different directions by changing the motors' rotation direction and speed.

3. Connecting the KY-032 Infrared Module to the ESP32 Board

KY-032 Pin ESP32 Pin Function
VCC 3V3 Power supply for the module
GND GND Common ground
OUT GPIO 15 Detection signal output

The OUT pin transmits the infrared detection signals received by the module to the ESP32 board.

4- Power Supply Connections

Component Connection Function
9V Battery Power supply module input Main energy source
Power Supply Module 5V output Supplies power to the ESP32 board
Two 3.7V Batteries L298N motor power input Supplies power to the motors
GND of the different modules Common ground Provides a common electrical reference

 

Micropython Program for the ESP32 board

1. ESP32 Board Preparation and Setup

Before starting the programming process, it is necessary to complete the following steps:

1. Install the MicroPython firmware: Download and install the esp32-20210902-v1.17.bin firmware on the ESP32 board.

2. Import the IR library: Download the ir_rx.py file and add it to the ESP32 board's files. This library allows the board to receive and decode the infrared signals transmitted by the remote control.
Cette personnalité vous plaît-elle ?

2. ESP32 Board Program:

This program controls a four-wheel robot car using an ESP32 board, an infrared (IR) remote control, and an L298N motor driver module. It is written in MicroPython and uses the NEC infrared communication protocol to receive and decode commands transmitted by the remote control.

 

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

Pictures of the articles

Robotic site created by Mohamed Ali Haj Salah - Teacher info