Controlling Servo Motor with ESP32 via Bluetooth and Smartphone

ESP32 25-07-26
190 0

Tutorial plan

1- Objective of the project

2- Required Components

3- Circuit Connections of system

4- MicroPython program for ESP32 board

5- The mobile app for controlling the servo motor

 

 

Objective of the project

The objective of this project is to control the position of a servo motor wirelessly using an ESP32 board, Bluetooth Low Energy (BLE), and a smartphone. The user can select or modify the desired servo angle through a mobile application. The command is then transmitted via Bluetooth to the ESP32, which processes the received data and positions the servo motor at the requested angle.

Functioning

The system operates as follows:

1- The user selects a desired servo motor angle using the smartphone application.

2- The application sends the angle value via Bluetooth Low Energy (BLE).

3- The ESP32 receives the command through its Bluetooth communication interface.

4- The ESP32 processes the received angle value.

4- The ESP32 generates the appropriate PWM signal for the servo motor.

5- The servo motor rotates to the corresponding position.

Thus, the smartphone acts as a wireless control interface, while the ESP32 serves as the control unit responsible for receiving commands and controlling the servo motor precisely.

 

Required Components

1. ESP32 board

The ESP32 is the main control unit of the project. It receives the commands sent by the smartphone via Bluetooth Low Energy (BLE) and generates the appropriate control signal for the servo motor. Thanks to its integrated Bluetooth communication, no additional Bluetooth module is required.

2. Servo Motor

The servo motor is an actuator that can rotate to a specific angular position, generally between 0° and 180°, depending on the model. It receives a PWM control signal from the ESP32 and moves to the angle selected by the user.

4. Jumper Wires

Jumper wires

Jumper wires are used to make the electrical connections between the ESP32 board, the GPIO expansion board and the servo motor.

5. Breadboard

The breadboard is a solderless prototyping board used to build and test electronic circuits quickly and easily.

 

Circuit Connections of system

1- Connect the servo motor's signal wire (usually yellow or orange) to pin GPIO23 of the ESP32 board.

2- Connect the servo motor's power supply wire (VCC), usually red, to the 5V pin of the ESP32 Board.

3- Connect the servo motor's ground wire (GND), usually black or brown, to a GND pin on the ESP32 board.

 

MicroPython program for ESP32 board

This MicroPython program allows the user to control the position of a servo motor connected to an ESP32 using a smartphone via Bluetooth Low Energy (BLE).

You need instal this librairies :

- Servo for servo motor.

- ble_uart_peripheral.py et ble_advertising.py for Bluetooth communication

 

 

The mobile app for controlling the servo motor

Download application

 

This mobile application, developed with MIT App Inventor, is designed to control the position of a servo motor connected to an ESP32 via Bluetooth Low Energy (BLE).

At the top of the interface, the Scanner button allows the application to search for nearby Bluetooth devices. The Connect button establishes a Bluetooth connection between the smartphone and the ESP32, while the Disconnect button terminates the connection. The Stop button can be used to stop or interrupt the communication or the servo motor control.

The central part of the application displays the title “Control Servo motor” and an image representing the servo motor being controlled. This provides a clear visual indication of the purpose of the application.

The current angular position of the servo motor is displayed below the image. In the example shown, the value is “Angle : 0°”. A slider located below this indicator allows the user to select the desired angle. By moving the slider, the user can vary the servo motor's position, generally between 0° and 180°.

When the user changes the slider position, the application sends the corresponding angle value to the ESP32 via Bluetooth. The ESP32 receives this value and controls the servo motor, which moves to the selected position. Thus, the application provides a simple and intuitive interface for wirelessly controlling a servo motor in real time.

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