|
Doit ESP32 Devkit V1 development board |
x 1 | |
|
MG996R or MG995 servo motor |
x 1 | |
|
100uF capacitor |
x 1 | |
|
470uF capacitor |
x 1 | |
|
330-ohm resistor |
x 1 |
|
arduino IDEArduino
|
|
|
Soldering iron |
|
|
Soldering Iron Wire Welding Lead Roll |
One and Multiple Servo Motor Control With ESP32 Development Board (DOIT ESP32 DEVKIT V1)
IThis article covers controlling a Servo motor using the ESP32 development board. Also, this article provides some basic information about the Doit ESP32 Devkit V1 development board, MG996R or MG995 Servo motor, and breadboard circuitry, as well as a step-by-step guide for assembling a printed circuit board designed for multi-servo motor control. In addition, the shown breadboard circuit and printed circuit board minimize the jitter problem of Servo motors, making Servo motors work more stably.
Step 1: About ESP32 Board and Servo Motors
Doit ESP32 Devkit V1 Development Board
The Doit ESP32 Dev Kit V1 is an ideal board for development purposes, powered by the ESP32 microcontroller. It comes with Wi-Fi and Bluetooth connectivity features and offers a wide range of pins for various applications. You can refer to the pinout diagram of the board to determine the pin you'll use for servo motor control in our project. DOIT ESP32 Board can operate with a supply voltage between 4V to 12V via a VIN pin.
MG996R or MG995 Servo Motor
The MG996R or MG995 servo motors are a popular choice known for their high torque and quick response time. Servo motors are precision motors that can be moved to a specific angle or position. They are generally used in robotics and automation projects. The servo motor can operate with a supply voltage in the range of 4.8V to 6V. However, servo motor control can sometimes be accompanied by a common issue called Servo Jitter. Servo jitter refers to the undesired trembling or small fluctuations exhibited by a servo motor. It indicates an unstable operation and can lead to undesired results.
Step 2: Build a Circuit on the Breadboard
Build a circuit on the breadboard. Your circuit should have the following components:
- Doit ESP32 Devkit V1 development board
- MG996R or MG995 servo motor
- 100uF capacitor (for power supply)
- 470uF capacitor (for servo motor power supply)
- 330-ohm resistor (for the signal leg of the servo motor)
To avoid the servo jitter issue, I have included specific components in the breadboard circuit. So what do these components do to avoid the servo jitter issue? These components help reduce power fluctuations on the circuit and ensure the servo motor operates more stably. The capacitors absorb power supply fluctuations, stabilizing the servo motor's power feed, while the resistor helps minimize electrical noise on the signal line, allowing cleaner transmission of the servo motor's signal. By incorporating these components, the breadboard circuit minimizes the servo jitter issue, enabling the servo motor to operate more reliably.
- Place the ESP32 on the breadboard. Add wires to VIN and GND inputs for power. Then add the 100uF capacitor and attach the power wires to the capacitor's legs. Make sure the polarity is correct!
- Place the ground, power, and signal wires of the servo motor, add 470uF capacitor to the ground and power inputs of the servo, then connect the capacitor's legs to the breadboard power and ground lines.
- Add a 330-ohm resistor to the signal leg of the servo, connect the wire signal pin of the servo motor to pin GPIO13 of the ESP32, and connect this wire to the other leg of the resistor.
Step 3: ESP32 Development Board Setup for the Arduino IDE
To work with the Arduino IDE, we need to set up the ESP32 board. Here are the requirements and steps:
- Download and install the latest version of the Arduino IDE from the official Arduino website.
- Open the Arduino IDE and go to "Preferences" > "Board Manager URLs", paste the shared ESP32 package link, and click the ok button.
Additional Boards Manager URL:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
- Navigate to "Tools" > "Boards Manager."
- Search for "ESP32" in the Boards Manager and install the ESP32 boards.
- Select the appropriate ESP32 board from the "Tools" > "Board" menu.
Step 4: ESP32 Servo Library and Circuit Test
To test the circuit, we can utilize the "Simple Servo" example provided by the ESP32 Servo library. Follow these steps:
- First, cut off the servo power without making the USB connection. Then open the Arduino IDE.
- Go to "Add Library" from Sketch, search Servo library for ESP32, and install it.
ServoESP32 Library: https://github.com/RoboticsBrno/ServoESP32
- Go to "Examples" from "File", find the "Simple Servo" sketch for ESP32, and open it.
- Define the PIN the Servo is connected to and upload the code!
- Reconnect the wire of the servo power, then let's power the circuit.
DOIT ESP32 Devkit V1 Board can operate with a supply voltage between 4V to 12V via a VIN pin. The servo motor can operate with a supply voltage in the range of 4.8V to 6V. Therefore, a 6-volt supply voltage will be sufficient for the circuit. Power the circuit with a 6-volt external power supply and observe the servo motor operating smoothly. Verify that the servo jitter issue is not present during the test. The circuit works great... Let's move on to multiple-servo control.
Step 5: Printed Circuit Board (PCB)
As the breadboard circuit can become complex when controlling multiple servo motors, I designed a printed circuit board (PCB) to provide a more organized and permanent solution.
Breadboard circuits are ideal for testing and running small-scale designs, they are not durable for long-term use. Printed circuit boards are used to design electronic circuits more durable and stable for long-term use.
Place an order with a PCB fabrication service provider to produce the designed PCB. I prefer the PCBWay for printed circuit board service, I can easily upload the design file and place an order quickly. The order is delivered within a few days, depending on your location. You can choose PCBWay for high-quality and low-price PCB service.
PCB Order:
- Go to PCBWay's official website.
- Then go to the "PCB Instant Quote" link.
- Click on the "Quick-Order PCB" link from the page that opens.
- Click "Add Gerber File" and then get the shared Gerber file and upload it.
- A minimum 5 PCB pieces option is selected as standard. You can increase the number of PCBs if you wish, or you can get 5 PCBs for $5. Finally, you can complete the order by choosing one of the "Solder Mask" color options.
Features of the PCB:
The designed PCB is a 2-layer board that can handle up to 16 servo motors. It includes an ESP32 microcontroller for seamless integration and control.
Step 6: PCB Assembly and Soldering
Just like the breadboard circuit, easy-to-assemble solderable components were preferred:
- 4x 100uf 25V~16V Capacitor for Power
- 4x 470uf 25V~16V Capacitor for Servo Motor
- 1x SB560 Diode for Power
- 1x 7805CV Voltage Regulator for Power (Used when required, see explanation in next step)
- 2x 3mm-LED
- 16x 220-ohm Resistor for Servo Motors
- 2x 330-ohm Resistor for LEDs
- 1x 2pin 5mm Screw Terminal for Power input
- 2.54 Female Headers for ESP32 Board
- 2.54 Male Header for Servo Motor Connections
Assemble the required components on the PCB, and solder them in place with the soldering iron and soldering wire. You can see the soldering priority of the components in the uploaded images. It will make your work easier if you proceed according to the component dimensions while doing the soldering process.
- Put the resistors and LEDs in place, then solder them.
- Shorten the leg lengths of the components using a wire cutter.
- Then add and solder the male-female headers. You can use paper tape to prevent the headers from coming off during soldering.
- Finally, place and solder the capacitors, then shorten the leg lengths.
Step 7: Uploading Code to the PCB and Testing Servo Motors
Place ESP32 on PCB, and connect the Servo motor to the GPIO13 input. The Simple Servo example is already uploaded.
Let's supply 6V external power to the board and run the first test. The board is working great. The voltage regulator input on the board is empty, so the ESP32 is powered via USB while the servo motor is powered by an external power supply.
If you want to power the board with a single power supply, and the supply power needs to be higher than the 6V to 12V operating range, you should use a voltage regulator such as the L7805.
However, if a voltage within the operating range of both the development board and the servo motor will be sufficient in your project, you can complete the power circuit using a jumper.
Step 8: Conclusion and Recommendations
- 6 high-torque servo motors were connected to the board and 6 volts were supplied to the board. As you can see in the video, 6 high-torque servo motors were successfully run without any problems.
- This printed circuit board does not have any jitter problems and servo motors work stably.
- In addition, the printed circuit board supports the control of up to 16 mini servo motors.
- A robotic arm with high torque servo motors was tested on this printed circuit board and worked successfully.
- ESP32 to ESP32 communicated with ESP-NOW, and as a result of the test, the board worked successfully.
- Connected to the board via Bluetooth using an Android app, and the board worked successfully as a result of testing.
As a result of all the tests, the servo motors moved toward the desired positions and without jitter. If you want to take a look at other projects that can be done with the board, you can find them in the videos below:
Thanks for reading the project article. You can send your questions through the comments section, I will try to answer them when I have time.
One and Multiple Servo Motor Control With ESP32 Development Board (DOIT ESP32 DEVKIT V1)
*PCBWay community is a sharing platform. We are not responsible for any design issues and parameter issues (board thickness, surface finish, etc.) you choose.
- Comments(1)
- Likes(2)
- 0 USER VOTES
- YOUR VOTE 0.00 0.00
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
More by MERT KILIC
- Creative Pogo LED Lighting Design Hi everyone! Welcome to my latest project: a modular, plug-in LED lighting system that is as fun as ...
- Build a simple 3D printed CNC plotter machine Hi friends, do you remember this Mini CNC Plotter machine that uses hobby stepper motors and a few 3...
- Circuit Activity Board - Educational Electronics Circuit Activity Board – A Hands-On Project to Learn Basic ElectronicsIn this project, we're going t...
- Build a Simple 3D Wall Lighting Hi friends, this project shows how to make and control 3D hexagonal LED lighting panels. The project...
- Robot Sumo Board Robot-sumo, or pepe-sumo, is a sport in which two robots attempt to push each other out of a circle ...
- ESP32 Mecanum Wheels Robot and Bluetooth Gamepad Controller In this project we will see how to make an ESP32 Mecanum Wheels Robot which is capable of moving in ...
- DIY Motorized WiFi Roller Blind - ESP8266 & Blynk In this project we will see how to control a roller blind via a smartphone application. The reason w...
- Pet Feeder Controlled Via WiFi - ESP8266 How It Works?As you can see, a 3D design was used for the pet feeder. ESP8266-based Wemos D1 Mini bo...
- ESP8266 Two Wheel Robot (NodeMCU and Stepper Motor) Generally, robot cars are built on a chassis with 2 DC motor wheels and a bovine wheel. While surfin...
- 3D Printed Rotating Table Board with Arduino Nano and 28BYJ-48 Stepper Motor This project shows how to make a 3D printed Rotating Table using Arduino and a hobby stepper motor. ...
- Hand Gesture Controller for Robotic Hand Gesture Controller for RoboticThe hand gesture controller makes it possible to control applicat...
- How To Make DIY Remote Control Hoverboat at Home In this video, I showed you how to make your own hoverboat from materials available at home and chea...
- How to Make DIY Arduino Gesture Control Robot at Home Parts Required for Receiver (Tank):1) Robot Tank Chassis - https://bit.ly/3j8y2Q52) Arduino Nano V3 ...
- DIY Circuit Activty Board with Paperclips | MAKER | STEM You can be creative and design your own circuit and add different sensors (other LEDs...). The idea ...
- ATtiny85 Wearable Activity Tracking Watch How to make the wearable activity tracking watch? This is a wearable gadget designed to vibrate when...
- Face With Animatronic Eyes, Motion Detection and Voice Are you ready to create something both eerie and captivating? This project combines 3D printing, ser...
- Build a simple 3D Arduino Mini CNC Plotter Hi friends, we will see how to make a simple and awesome mini CNC plotter machine in this project. I...
- Build a simple 3D Sphere Drawing Robot (SphereBot - EggBot - EggDuino) Hi friends in this video we will see how to make a simple and awesome sphere drawing robot. Actually...
-
-
kmMiniSchield MIDI I/O - IN/OUT/THROUGH MIDI extension for kmMidiMini
71 0 0 -
DIY Laser Power Meter with Arduino
83 0 2 -
-
-
Box & Bolt, 3D Printed Cardboard Crafting Tools
120 0 2 -
-
A DIY Soldering Station Perfect for Learning (Floppy Soldering Station 3.0)
413 0 1 -
Custom Mechanic Keyboard - STM32
239 0 3