Build a walking robot based on ESP32
MAKER: Chen Liang
Strider is a mechanical walking robot developed by Wade Vagle. It is a reptile robot based on ESP32 camera and 3D printed body with flexible and convenient movement speed. It has undergone many iterations and continuously optimized its movement speed.
Before building this robot, I also tried to build another robot, Lego Trotbot.
Finally, at the suggestion of Wade Vagle, I built the Strider. You can refer to the link for more information about the mechanical design and Strider.
https://www.diywalkers.com/walker-abcs.html
https://www.diywalkers.com/strider-link age-plans.html
Here is a comparison of a Strandbeest and a Strider that I built myself.
The Strandbeest I built a few years ago could only walk on very flat surfaces and couldn’t even cross a mat, but the smaller Strider could walk across the same mat just fine, which is enough to show that the Strider has better walking ability.
Component List
ESP32-CAM-MB × 1
LiFePO4 14500 battery with charger × 1
N20 3V 200RPM motor × 1
DRV8833 2-channel DC motor driver module board × 1
8-pin female header × 2
6702ZZ bearing × 8
6 mm M2 flat head screw × 100
155mm long 2mm diameter rod × 2
15mm long 2mm diameter rod × 6
Component Description
Battery Options
The Strider comes with two slots for 14500 (AA size) batteries.
Voltage requirements
ESP32-CAM requires a 3.3V power supply, and the onboard regulator (AMS1117) accepts a maximum voltage of 15V.
N20 motors can accept 3-12V power supply, but higher voltages can run faster. DRV8833 motor drivers accept 2.7-10.8 V. In terms of battery safety, it is best to use LiFePO4 batteries. If you choose lithium batteries, remember to choose a built-in protection board or embed a circuit to protect the battery in it.
Motors
The Strider uses 2 micro N20 gear motors. There are three gear motors to choose from.
I tested three ratios: 3V 100RPM, 200 RPM and 500RPM. 3V 500RPM runs very fast, but the walking stability is a little worse, so I recommend using 3V 200 RPM. The operating voltage is linearly proportional to the speed, 3V 100RPM is equivalent to 6V 200RPM.
The
Strider is driven by the motor to rotate the legs. Since the rotation cannot be driven directly by a linear shaft, I used some thin-walled ball bearings to build a stable crankshaft for rotation. In the end, eight 6702ZZ bearings were used, with an inner diameter of 15mm, an outer diameter of 21mm, and a width of 4mm.
Screws
Screws are very important in the Strider project, connecting important parts such as leg joints, body parts, battery holders and electronic components. For convenience, all connected parts are designed to use the same screws, which are 6mm long M2 flat head screws. The Strider robot requires 72 to assemble. But it is possible to assemble more components, 100 is the most reasonable number.
Selection of rods
You need two 155mm and six 15mm long rods with a diameter of 2mm. If they are not in stock, you can cut them yourself.
3D Printed Parts
Download all the parts you need to 3D print from thingiverse:
https://www.thingiverse.com/thing:4917588
Note:
1. The x2 after the file means 2 copies are printed, and x12 means 12 copies are printed.
2. For punching holes in 3D printed components, use a 2.1mm drill bit as shown in the figure to repair the printed holes for better use.
Assembling the parts
screw
Use four screws to hold core1, core2a, and core2b together.
Install the motors
The two motors should be installed side by side, and be careful to avoid poor contact at the motor ends.
Motor shaft and body assembly
1. Place the bearing inside.
2. Install shaft 3 to the bearing.
3. Repeat this step to prepare 2 more.
Install the motor shaft
Align the D-shaped motor shaft with axis 3 and fit it into place.
Install the cover
1. Use eight screws to secure cover 1 and cover 2 to the main body.
2. Install the 155mm rod
3. Pass the rod through the hole in the main body.
Leg assembly
1. Connect Leg 2, Leg 3 and Leg 1 with one screw.
2. Connect Leg 3 and Leg 4 with one screw.
3. Repeat this step to make the second leg.
4. Mirror and install the second leg to the right.
5. Connect Leg 2 and Leg 4 with one screw.
6. Repeat this step to make 6 legs.
Install the legs
1. Install the 15mm rod on shaft 3.
2. Pass the 155mm rod through the holes in the two legs 1.
3. Pass the 15mm rod through the hole in the middle of the two legs 2.
Shaft and body assembly
1. Place the bearing into the body 2.
2. Install the shaft 2 into the bearing.
3. Repeat this step to prepare 4 parts.
Install the shaft
1. Pass the 155mm rod through the hole in the body 2.
2. Pass the 15mm rod through the hole in the shaft.
3. Secure the shaft with two screws.
4. Repeat the process of installing the legs. There are three pairs of legs on each side; each pair of legs moves the crankshaft 60°.
Side shaft and main body assembly
1. Place the bearing into the body 1.
2. Install the shaft 1 into the bearing.
3. Repeat this step to prepare 2 sets.
Install the main body edge
1. Pass the 15mm rod through the hole of shaft 1.
2. Secure the edge of the body with two screws.
Connecting the battery base
1. Connect the battery base and wires in series. It is strongly recommended to use red and blue wires to indicate the positive and negative poles of the battery.
2. Arrange the red and blue wires of the battery base and pass them through the holes of Core2b.
3. Use 8 screws to fix the 2 battery holders to core2a and core2b.
Software
Arduino IDEDownload
and install Arduino IDE:
https://www.arduino.cc/en/main/software
ESP32
Please follow the installation instructions to add ESP32:
https://github.com/espressif/arduino-esp32
Arduino ESP32 File System Uploader
Please follow the installation steps to install:
https://github.com/lorol/arduino-esp32fs-plugin
FSBrowserPlus
Download FSBrowserPlus: (“Clone or Download” -> “Download ZIP”)
https://github.com/moononournation/FSBrowserPlus
Import the library in Arduino IDE. (Arduino IDE “Sketch” Menu -> “Include Library” -> “Add .ZIP Library” -> select downloaded ZIP file)
ESP asynchronous web server library
Download the latest ESPAsyncWebServer library: (“Clone or Download” -> “Download ZIP”)
https://github.com/me-no-dev/ESPAsyncWebServer.git
Import the library in Arduino IDE. (Arduino IDE “Sketch” Menu -> “Include Library” -> “Add .ZIP Library” -> select downloaded ZIP file)
Configuration
Camera Type
In “FSBrowserPlus.ino”, uncomment the camera model at line 28 and comment out the others. For example, CAMERA_MODEL_ESP32_CAM_ROBOT for the Strider camera robot.
// Select camera model
// #define CAMERA_MODEL_WROVER_KIT // Has PSRAM
// #define CAMERA_MODEL_ESP_EYE // Has PSRAM
// #define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
// #define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
// #define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
// #define CAMERA_MODEL_ESP32_CAM // Has PSRAM
#define CAMERA_MODEL_ESP32_CAM_ROBOT // Has PSRAM
// #define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
// #define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM
// #define CAMERA_MODEL_JSZWY_CYIS
#include "cameraAPI.h"
Motor pins
CAMERA_MODEL_ESP32_CAM_ROBOT defines the motor pins in “camera_pins.h”:
#define MOTOR
#define MotorL_A_Pin 13
#define MotorL_B_Pin 12
#define MotorR_A_Pin 2
#define MotorR_B_Pin 14
LED light pins
The LEDs are controlled directly by the Web GPIO API. Normally in GPIO 4 you can change the LED pin in line 616 of “camerarobot.htm”.
const query = `${baseHost}/gpio?pin=4&val=${value}`;
Compile and upload
1. Connect ESP32-CAM to USB Serial Dock.
2. Open Arduino IDE.
3. Open FSBrowserPlus.ino.
4. Edit ssid and password to your own WiFi AP credentials.
5. Select Board to “ESP32 Dev Module” in the “Tools” menu.
6. Select the partition scheme in the “Tools” menu, “Default 4 4MB with fat (1.2MB APP/1.5MB FATFS)”
7. Press Arduino IDE to upload.
8. Select “ESP32 Sketch Data Upload” in the “Tools” menu.
9. Select FS type to “FatFS” and press the “OK” button.
PCB Part
1. Cut the PCB into boards with 10 x 10 holes.
2. Drill 4 holes at C3, H3, C8 and H8 (to match the holes in core1).
Welding work
Because ESP32-CAM does not have a built-in USB serial chip, it is best to use a pin header to help separate it, so that reprogramming is easier.
The connection method is as follows:
Battery -> Switch -> ESP32-CAM -> DRV8833 -> Motor
+ve pole -> Pin 1
Pin 2 -> 5V -> Vcc
-ve pole -> GND -> GND
GPIO 12 -> IN1
GPIO 13 -> IN2
GPIO 14 -> IN3
GPIO 2 -> IN4
OUT1 -> LEFT +ve
OUT2 -> LEFT -ve
OUT3 -> RIGHT -ve
OUT4 -> RIGHT +ve
short J2
Fixing PCB
Use 4 screws to fix the PCB on core1.
Arrange and connect wires
Connect the battery and motor pins to the PCB.
Installing the ESP32-CAM
1. Insert the ESP32-CAM into the pin header.
2. Attach a heat sink to the SD card reader.
3. Attach the camera module to the heat sink.
Installing the battery
Before installing the battery, be sure to check that the battery poles are correct, otherwise the chip will be burned. It is recommended to use the red and blue wires in the battery base again.
Connect and Run
FSBrowserPlus runs in AP+STA dual mode.
If you have entered the WiFi AP and password, you can directly browse to http://fsbrowserplus.local to access FSBrowserPlus, limited to the area covered by the WiFi AP.
If your camera robot is not in the WiFi AP coverage area, just search for the WiFi network AP and call “fsbrowserplus” and enter the predefined password in the code to connect. Once connected, a Captive Portal web page will pop up. Then select the Camera Robot path.
Once everything is done, Strider can move flexibly.
Areas for improvement
1. This Strider is the smallest size. But it is still too wide to control remotely and can be easily blocked by obstacles outside the camera’s field of view. I will try to fix it in the next iteration.
2. Add an external antenna (optional). There are many antennas on the market that are suitable for ESP32-CAM. An external antenna can improve the performance of the camera video data stream.
The code used in the project can be downloaded from the project file library:
https://make.quwj.com/project/398