Smart IoT Motor Control System Using ESP32 & L298N
This project demonstrates a powerful wireless motor automation system built using the ESP32 and the L298N.
It integrates:
-
Dual DC motors
-
OLED display
-
PS3 wireless controller
-
Relay module
-
Laser shooting system
-
Buzzer alerts
-
Battery-powered portability
This makes it ideal for robotics, IoT automation, and smart vehicle development.
Project Overview
The ESP32 handles:
-
Wireless communication (Bluetooth via PS3 controller)
-
Motor speed & direction control using PWM
-
OLED display updates
-
Laser shooting logic
-
Game score tracking
-
External device switching via relay
The L298N driver controls:
-
Motor A (left wheel)
-
Motor B (right wheel)
-
Forward / reverse motion
-
Turning left / right
Key Components Used
| Component | Function |
|---|---|
| ESP32 Dev Board | Main controller with WiFi & Bluetooth |
| L298N Motor Driver | Controls 2 DC motors |
| Dual DC Geared Motors | Robot movement |
| 0.96” OLED (I2C) | Score & system display |
| PS3 Controller | Wireless control |
| Relay Module | External appliance control |
| Laser Module | Shooting mechanism |
| LM393 Photo Sensors | Laser detection |
| Buzzer | Audio alerts |
| Rechargeable Battery | Portable power |
System Working Explanation
1️⃣ Wireless Motor Control (Bluetooth)
Using the PlayStation 3 Controller, the ESP32 reads D-pad inputs:
-
🔼 Up → Move Forward
-
🔽 Down → Move Backward
-
◀ Left → Turn Left
-
▶ Right → Turn Right
-
⭕ Circle → Activate Laser
ESP32 receives controller signals via Bluetooth and triggers motor PWM signals.
2️⃣ Motor Control Logic
The L298N uses:
-
AIN1 / AIN2 → Motor A direction
-
BIN1 / BIN2 → Motor B direction
-
PWMA / PWMB → Speed control (PWM)
Forward Movement:
digitalWrite(AIN1_PIN, LOW);
digitalWrite(AIN2_PIN, HIGH);
Speed controlled using:
ledcWrite(motorAChannel, moveSpeed);
PWM Frequency: 1000 Hz
Resolution: 8-bit
3️⃣ Laser Shooting System
When the ⭕ button is pressed:
-
Laser goes FULL power for 2 seconds
-
Returns to idle mode automatically
if (Ps3.data.button.circle && !laserOn)
This creates a shooting game mechanism.
4️⃣ Photoresistor Detection (Scoring System)
Two LM393 sensor modules detect laser hits.
If laser beam hits sensor:
if (val1 == 0 || val2 == 0)
Score increases.
Untouchable delay: 2 seconds
Game Over: Score > 50
5️⃣ OLED Display System
Using SSD1306 controller with I2C.
Displays:
-
Game title
-
Current score
-
"YOU LOSE" message
Large 6x text used for score display.
6️⃣ Relay Module Control
The relay allows switching:
-
Bulb
-
Pump
-
Motor
-
External load
Makes system expandable for home automation or industrial control.
Power Management
Battery-powered system includes:
-
Voltage regulator for stable 5V
-
Protection circuitry
-
Portable robotics use
Core Technologies Used
-
Bluetooth communication
-
PWM motor speed control
-
H-Bridge direction control
-
I2C display communication
-
Real-time event handling
-
Wireless robotics control
-
Embedded game logic
Applications
Smart robotic vehicles
Smart agriculture robots
Autonomous delivery bots
Industrial automation prototypes
Interactive robotics games
IoT-based mobile systems
Smart automation carts
Project Advantages
✅ Wireless control (No wires required)
✅ Dual motor precision control
✅ Real-time OLED feedback
✅ Expandable IoT architecture
✅ Energy efficient
✅ Portable & scalable
✅ Suitable for competitions & exhibitions
Possible Upgrades
You can enhance this project by adding:
-
WiFi web dashboard control
-
Cloud data logging (Firebase / MQTT)
-
Camera module (ESP32-CAM)
-
GPS tracking
-
Autonomous obstacle avoidance
-
AI object tracking
-
Ultrasonic obstacle detection
-
Voice control integration
-
Mobile app control
-
Line follower functionality
Educational Concepts Covered
Electronics
-
H-Bridge motor drivers
-
PWM motor control
-
Laser sensing
-
Sensor interfacing
-
Power regulation
Programming
-
Event-driven coding
-
Interrupt-like callbacks
-
State management
-
Bluetooth stack integration
-
Embedded game development
IoT & Robotics
-
Wireless embedded control
-
Real-time monitoring
-
Automation logic
-
Smart device integration
Applications
-
Smart robotic vehicles
-
IoT-based automation systems
-
Remote-controlled carts
-
Smart agriculture robots
-
Industrial automation prototypes
-
Autonomous delivery systems
-
Educational embedded systems projects
Project Advantages
This ESP32 motor control system is scalable, energy-efficient, and suitable for modern IoT applications. With built-in wireless connectivity and dual motor control capability, it is perfect for developing smart robotics and automation solutions.
IOT & SMART SYSTEM PROJECTS
- IoT Weather Monitoring System (NodeMCU ESP8266 + DHT11 + Rain Sensor)
- ESP8266 NodeMCU Smart Health & Environment Monitoring System with Pulse, Temperature and Motion Sensors
- ESP32 Wi-Fi Weight Sensor with HX711
- Smart RFID Access Control System Using ESP32 Dev Board and UHF RFID Reader Module
- Smart IoT Motor Control System Using ESP32 Dev Board and L298N Motor Driver Module
- Smart Waste Management System Using Arduino Nano, Ultrasonic Sensor & GSM Module – Solar Powered IoT Solution
- Raspberry Pi Zero W and GSM SIM900 Based Ultrasonic Distance Measurement System
- Arduino UNO Smart Surveillance System with ESP8266 WiFi, PIR Motion Sensor & Camera Module
- Arduino UNO Environmental Monitoring System with OLED & 16x2 I2C LCD Display
- Arduino UNO-Based Smart Home Automation System with Flame and IR Sensors
- Arduino Nano-Based Landslide Detection System with GSM Alerts – Smart Disaster Monitoring Project
- Arduino Nano Rain-Sensing Stepper Motor System
- Arduino Based Automatic Tire Inflator Using Pressure Sensor, Relay Module and LCD Display
- Arduino-Based Automatic Cooker Using Servo Motors, DC Stirrer Motor, Temperature Sensor and Relay-Controlled Heater
- Arduino Sketch for Plastic Bottle and Can Reverse Vending Machine
- RFID-Based Smart Traffic Control System (Arduino Mega)
- Arduino UNO Traffic Light Control System – Smart LED Signal Project
- Arduino UNO Controlled Traffic Light System with Joystick Interface
- Arduino UNO Smart Obstacle Avoiding Robot (Ultrasonic + IR + GSM)
- Arduino-Powered Autonomous Obstacle Avoidance Robot with Servo Control
- Arduino Nano Bluetooth Controlled Line Follower Robot Using L298N Motor Driver
- Arduino UNO Bluetooth Controlled 4WD Robot Car Using L298N Motor Driver
- Arduino UNO Multi-Sensor Obstacle Avoidance & Bluetooth Controlled Robot Car Using L298N
- Raspberry Pi Motor Control Robot (L298N + Li-ion)
- RC Car Simulation with L298N Motor Driver and Joystick Control using Arduino (CirkitDesign Simulation)
- Raspberry Pi Robotic Arm Control System with Camera Module and Motor Driver – Smart Automation & Vision-Based Robotics Project
- ESP32-Based 4WD Robot Car Using Dual L298N Motor Drivers – Circuit Diagram and IoT Control Project
- Arduino LoRa Communication Project Using Adafruit RFM95W LoRa RadioArduino Nano with RFM95 SX1276 LoRa
- Arduino Nano with RFM95 LoRa SX1276 Module – Long Range Wireless Communication Project
- Arduino Nano Digital Clock Using DS3231 RTC and TM1637 4-Digit Display – Circuit Diagram and Project Guide
- Arduino UNO Controlled NeoPixel Ring Light Show
- Wi-Fi Controlled NeoPixel Ring (ESP8266)
- Chained NeoPixel Rings with Arduino – Addressable RGB LED Control Project
- Arduino Nano-Controlled Lighting System with Gesture and Sound Interaction
- Raspberry Pi GPIO Multi-LED Control System – Beginner-Friendly Embedded Electronics Project
- 4 Channel Relay Module with Arduino UNO
- Arduino UNO Color Sensor + Proximity System (TCS3200 + Inductive)
- Arduino Color Detection Project Using Adafruit TCS34725 RGB Color Sensor
- Arduino Gas Leakage Detection and Safety Alert System Using MQ-2 Gas Sensor
- MQ-135 Air Quality Detector Using Arduino | Cirkit Designer Simulation Project
- Pulse Sensor Using Arduino – Complete Guide with Simulation
- HX711 Load Sensor Demo Using Arduino | Digital Weight Measurement Project
- Track Time with DS1307 RTC and Display on Arduino Uno with 16x2 LCD | Cirkit Designer Project
- Parking Sensor Simulator using Arduino Uno and HC-SR04 Ultrasonic Sensor
- Pong Game with Arduino UNO and OLED Display – Project Explanation
- Arduino UNO Bluetooth-Controlled Servo Motor System
- Arduino UNO-Based Interactive Touch and Distance Sensing System with LED Indicators and Servo Control
- Arduino UNO Smart Waste Sorting System Using Ultrasonic Sensor, Moisture Sensor, Servo, Stepper Motor and LCD
- Arduino-Based Smart Waste Segregation System Using Metal, Plastic and Moisture Sensors with Stepper and Servo Control
- ESP32-Based Digital Weighing Scale Using 50kg Load Cell, HX711 Module and 16x2 LCD Display
Arduino-Based Smart Toll Gate Automation System with RFID, GSM, Ultrasonic Sensor and LCD Display
Arduino-Based Automatic Pill Dispenser Machine with LCD Display, Servo Motor and Buzzer Reminder
Arduino UNO Smart Water Quality Monitoring System with pH Sensor, Turbidity Sensor and LCD Display
Arduino-Based Ocean Cleaning Boat Robot with Dual IBT-2 Motor Drivers and Conveyor Belt System
Raspberry Pi RFID and Keypad Based Smart Door Lock System with LCD Display and L298N Motor Driver
Smart Shopping Trolley Using Arduino UNO & RFID | Automatic Billing System
Arduino UNO Based Automatic Liquid Hand Sanitizer & Soap Dispenser System
Arduino Based Robotic Weeding Machine with Ultrasonic Obstacle Detection and L298N Motor Driver
Arduino UNO Based Biometric Electronic Voting System with LCD Display and Fingerprint Authentication
Arduino UNO Based Electronic Voting System with ILI9341 TFT Display
Comments
Post a Comment