ESP32 boat controlled by Wifi

ESP32 23-01-25
23 0

Tutorial plan

1- Objective of building ESP32 robot boat

2- Required Components

3- Boat Wiring Diagram

4- Micropython program for ESP32

 

 

Objective of building ESP32 robot boat

The objective of building an ESP32 robot boat controlled by Wi-Fi using a water pump, relay module, and servo motor is to develop a versatile, remotely controlled aquatic vehicle capable of performing a variety of tasks.

The ESP32 connects to a Wi-Fi network and hosts a web-based interface or uses a mobile app (Blynk, MQTT, etc.) to receive user commands. These commands control the water pump (for propulsion) and the servo motor (for direction control).

a. Propulsion System (Water Pump + Relay)

1- The ESP32 sends a signal to the relay module.

2- The relay activates the water pump, allowing water to be expelled, pushing the boat forward.

3- The pump can be turned ON/OFF via commands.

b. Direction Control (Servo Motor)

1- The ESP32 sends PWM signals to the servo motor.

2- The servo rotates the rudder, changing the boat's direction.

3- Left (0°–45°), Right (135°–180°), Center (90°).

c. Wi-Fi Control Mechanism

The ESP32 creates a Wi-Fi Access Point (AP Mode) or connects to an existing Wi-Fi network (Station Mode).

A web server runs on the ESP32, providing a control interface.

The user accesses the web dashboard via a smartphone, tablet, or PC.

Button presses send commands via HTTP requests/WebSocket, controlling the relay and servo.

 

Required Components

ESP32 Microcontroller:

Acts as the central brain of the boat.

Manages all peripherals, including the water pump, relay module, and servo motor.

Hosts or connects to a Wi-Fi network, allowing control via a smartphone or computer.

Water Pump:

Provides propulsion by expelling water through a nozzle.

Responsible for moving the boat forward or backward by changing the pump's orientation or water flow direction.

Relay Module:

Controls the water pump by switching it on or off as per commands from the ESP32.

Acts as an intermediary between the ESP32 and the high-current motor of the water pump.

Servo Motor:

Controls the steering by adjusting the rudder or the direction of the water pump nozzle.

Operates based on angle values sent by the ESP32, enabling precise directional control.

3V/5V power module 

Module d'alimentation

It supplies a stable 5V with sufficient current for the boat.

Power Supply:

Provides adequate power for the ESP32, water pump, servo motor, and relay module.

Typically uses a battery pack with appropriate voltage (e.g., 7.4V or 12V, depending on the components).

Jumper Wires :

Jumper wires

Jumper wires will be used to make connections between the components.

Breadboard (Optional):

Breadboard

A breadboard is a versatile and reusable platform used for prototyping and testing electronic circuits without the need for soldering.

 

Boat Wiring Diagram

we connect :

1- for the servomotor:

- the yellow wire to pin 2 of the ESP32 board

- the red wire to the 5V pin of the power supply module

- the black wire to the GND pin of the ESP32 board.

2- for relay:

- we connect pin (S) to pin 23 of the ESP32 board

- we connect pin (+) to the 3.3V pin of the ESP32 board

- we connect the pin (-) to the GND pin of the ESP32 board

- Connect the COM pin to the (+) terminal of the water pump

- Connect the NO pin to the 5V terminal of the power supply module

3- for the water pump:

the (-) terminal to the GND pin of the ESP32 board.

 

Micropython program for ESP32

Here are 2 micropython programs that allow you to connect the ESP32 card to the smartphone via the wifi network and to receive a message containing the command order of the boat.

You must install the servo library for the servo motor.

1- boot.py

2- main.py

 

How It Works

1. Wi-Fi AP Mode: ESP32 creates a Wi-Fi network ESP32-Boat, password: 12345678.

2. Web Interface: Access 192.168.4.1 in a web browser.

3. Control Buttons:

Stop: Turns the relay OFF (stopping the pump).

Turn Left: Moves the servo to 45° (left rudder).

Center: Moves the servo to 90° (straight rudder).

Turn Right: Moves the servo to 135° (right rudder).

4. ESP32 Handles HTTP Requests and controls relay & servo motor accordingly.

 

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