Xbox-Driven ESP32 Explorer: a Camera-Enhanced Rover
by Benjamin Chelule in Circuits > Microcontrollers
1983 Views, 10 Favorites, 0 Comments
Xbox-Driven ESP32 Explorer: a Camera-Enhanced Rover
![IMG_2187.jpg](/proxy/?url=https://content.instructables.com/FWH/FPXQ/M6Z2FKWC/FWHFPXQM6Z2FKWC.jpg&filename=IMG_2187.jpg)
![IMG_2186.jpg](/proxy/?url=https://content.instructables.com/FCV/S3MA/M6Z2FKY3/FCVS3MAM6Z2FKY3.jpg&filename=IMG_2186.jpg)
My name is Benjamin Chelule. I am 20 years old and currently studying mechatronics engineering. I am a hard working, driven individual who always strived to believe that there is nothing I can't do. As a result I have grown strength and resilience in my work. However, I never truly understood what it meant to look above and beyond - to do more, to seek more.
This being my first project serves as foundation in this new phase in my life where I hope to push myself to my limits in something that isn't a school assignment or assessment. To take initiative and work on something I am passionate on.
Over the past month I have spent time building a rover controlled with an Xbox Series X controller from an ESP32, this rover also has an ESP32 camera module that is capable of live footage through wifi. This rover consists of mostly 3D-printed parts and takes heavy inspiration from the Tarmo5 by Engineering Nonsense.
A lot of what I have done throughout this project was trial and error. I made big mistakes along the way and learnt from them. Through this instructable I hope to convey what I have lernt in the best way possible for others to follow and learn along the way.
Without further ado, here we go 🫡
Supplies
![IMG_2150.jpg](/proxy/?url=https://content.instructables.com/F3Z/33IY/M6Z2EES9/F3Z33IYM6Z2EES9.jpg&filename=IMG_2150.jpg)
![IMG_2156.jpg](/proxy/?url=https://content.instructables.com/FQQ/BNPP/M6Z2EQLN/FQQBNPPM6Z2EQLN.jpg&filename=IMG_2156.jpg)
![IMG_2134.jpg](/proxy/?url=https://content.instructables.com/FXL/OETS/M6Z2E0SJ/FXLOETSM6Z2E0SJ.jpg&filename=IMG_2134.jpg)
Mechanical Parts:
These 3D printed mechanical parts were printed on the Creality Ender K3 V3 KE. A printer with balance of performance, ease of use, and affordability.
With the printing for parts in this project I used an infill of 10% and a layer height of 0.25 mm for both the PLA and TPU. A detailed spreadsheet of all the 3D printed parts can be found here. The 3D printing software I used was Creality Print.
The parts listed below can be printed in PLA, ABS or PETG. (I printed them in PLA):
- 2x SHOCK MOUNT
- 8x CONTROL ARM
- 2x REAR BEARING HUB
- 2x FRONT SUS MOUNT
- 1x FRONT BEARING HUB (A05)
- 1x FRONT BEARING HUB (A06)
- 1x STEERING ARM (A07)
- 1x STEERING ARM (A08)
- 1x STEERING BAR
- 2x STEERING LINK
- 1x GEARBOX LID
- 1x GEARBOX
- 1x CENTER CHASSIS
- 1x END CHASSIS (B04)
- 1x END CHASSIS (B05)
- 1x END CHASSIS (B06)
- 1x MOTOR MOUNT
- 2x CV WHEEL HOUSING
- 2x CV GEAR HOUSING
- 4x CV CAGE
- 4x CV INNER RACE
- 1x MAIN GEAR HUB
- 1x MAIN GEAR
- 1x PINION GEAR
- 2x FRONT AXLE
- 2x FRONT WHEEL SPACER
You can find the I uploaded these STL Files here.
Prefferably, one would use metal ball bearings for the rear suspension, however I could not find those in any local shops which forced me to resort to PLA ball bearings. This can be found here. However, bear in mind that these balls have way more friction than metal ball bearings and tend to break or fall off during rough accelerations (I have to replace them quite frequently) hence I would recommend metal ball bearings if possible.
I would also highly recommend purchasing a lubricant for the main and pinion gear.
The parts listed below can be printed in any 95A TPU:
- 1x BUMPER
- 2x TOURQUE DAMPER
- 1x FRONT PLATE B
- 1x REAR PLATE A
- 1x REAR PLATE B
What I realised with TPU
TPU (more specifically 95A) is flexible and elastic making it harder to stick to the printing board. I left unsupervised, the TPU could stick to the nozzle and your printer finish the job with a blob of death.
In order to prevent this I changed a few things:
- I used hair spray (you can use anything that can get the printing board sticky)
- Increase the nozzle temperature to at least 230 degrees celsius and bed temperature to 70 degrees celsius
Lastly, for the mechanical side you will need the following bolts, nuts, screws and attachments:
- M3X16MM SOCKET HEAD (x20)
- M3X8MM SOCKET HEAD (x10)
- M4 Nylock Nut (x10)
- M4X12MM SOCKET HEAD (x10)
- M4x20MM SOCKET HEAD (x20)
- M4x35 hex head bolts HEX HEADED (x4)
- M4x35 Screws SOCKET HEAD (x15)
- M4x40 screws SOCKET HEAD (x20)
- M3 Nylock Nut (x10)
- M3 Threaded Rod 350mm (x3)
- Metal servo Horn
Electrical Parts:
- 3000-5000 mAH lithium polymer battery 3S 11.1V
- Seperate 2S lithium polymer/ion (7.4V) or 9-12V AA Alkaline batteries (6-9 AA batteries)
- Multimeter
- Jumper cables
- Motor (C3542-930KV)
- ESC (50A)
- Breadboard
- 20-30 kg servo
- ESP32 Development Board
- ESP32-CAM
- ESP-32 MB Cam base board
- Xbox Series X controller (Or any other bluetooth controller)
- DC-DC buck converter (XL6009)
Because my motor has a slightly larger spinning end than the original tarmo5, I modified the motor mount. It is attached at the bottom
Tools:
- Flat head screw driver
- 5.5 mm deep socket (for m3 nylock nuts)
- 6 mm deep socket (for m4 nylock nuts)
- Hex Screwdriver 3 and 4
- Adjustable pliers
Downloads
Configuring the ESP32 Development Board and Controller
![IMG_2159.jpg](/proxy/?url=https://content.instructables.com/FU1/TD0I/M6Z2ERHJ/FU1TD0IM6Z2ERHJ.jpg&filename=IMG_2159.jpg)
![Screenshot 2025-02-11 at 04.25.33.png](/proxy/?url=https://content.instructables.com/FRS/S3C7/M6Z2ETTV/FRSS3C7M6Z2ETTV.png&filename=Screenshot 2025-02-11 at 04.25.33.png)
![Screenshot 2025-02-11 at 04.36.03.png](/proxy/?url=https://content.instructables.com/F57/VTS5/M6Z2EUJK/F57VTS5M6Z2EUJK.png&filename=Screenshot 2025-02-11 at 04.36.03.png)
![Screenshot 2025-02-11 at 04.45.19.png](/proxy/?url=https://content.instructables.com/FVL/I22V/M6Z2EUZY/FVLI22VM6Z2EUZY.png&filename=Screenshot 2025-02-11 at 04.45.19.png)
The ESP32 is a low-cost low power microcontroller with integrated Wi-Fi and Bluetooth Capablities. This will allow us to control the rover with bluetooth.
I will be using Arduino IDE along with the esp32 an Bluepad32 extension.
If you go to Preferences>Additional Board manager URLs, pasting the following links will allow you to install esp32 and Bluepad32 into you arduino IDE library:
- https://dl.espressif.com/dl/package_esp32_index.json
- https://raw.githubusercontent.com/ricardoquesada/esp32-arduino-lib-builder/master/bluepad32_files/package_esp32_bluepad32_index.json
Now you can exit, click on the boards icon and search esp32. Both esp32 and esp32_bluepad32. You can install the latest version of eso32_bluepad32 however, for the sake of the ESP32-CAM board we will be using version 2.0.14.
Go to Tools>Boards>esp32_bluepad32>DOIT ESP32 DEVKIT V1. This is the generic board that will work for most if not all ESP32 development boards.
Now you can open the Bluepad32 example code through File > Examples > Bluepad32_ESP32 > Controller. Upload the code to your ESP32. Press reset on your development board and now the code should run. If you open the serial monitor, you will see information on the ESP on the your main console (your serial should be set to 115200 baud).
Now you can connect your controller by turning it on and holding the pair button. It should connect after a few seconds.
Your serial monitor should be showing live inputs from your controller.
Configuring the ESP32-CAM
![IMG_2166.jpg](/proxy/?url=https://content.instructables.com/FUY/UUGF/M6Z2EV3V/FUYUUGFM6Z2EV3V.jpg&filename=IMG_2166.jpg)
![Screenshot 2025-02-11 at 04.57.14.png](/proxy/?url=https://content.instructables.com/FD5/TRQ3/M6Z2EVS7/FD5TRQ3M6Z2EVS7.png&filename=Screenshot 2025-02-11 at 04.57.14.png)
![Screenshot 2025-02-11 at 05.18.18.png](/proxy/?url=https://content.instructables.com/FXX/C1W5/M6Z2EX3W/FXXC1W5M6Z2EX3W.png&filename=Screenshot 2025-02-11 at 05.18.18.png)
![IMG_2167.PNG](/proxy/?url=https://content.instructables.com/FT3/APNG/M6Z2EY02/FT3APNGM6Z2EY02.png&filename=IMG_2167.PNG)
The ESP32-CAM board is a compact all-in-one solution for camera-based applications. It has a 2 MP OV2640 capable of HD video streaming
Connect the OV2640 camera attachment to the ESP32-CAM development board and attach the development board to the base board and plug the base board into your computer via USB. The reason we installed version 2.0.14 in the previous step was to avoid errors from the later versions of the esp32 board extension.
Open Arduino IDE and navigate to Tools > Board > esp32_bluepad32 and find AI Thinker ESP-32-CAM.
Now go to Files > Examples > ESP32 > Camera > CameraWebServer
Once the code is open, change ssid and password strings to those of your wi-fi network respectively.
A very common error with the ESP32-CAM is the "Brownout detector triggered" error on the serial monitor. Because the ESP32-CAM has wifi enabled and powers the camera attachment, a drop in voltage will cause the board to reach a stage of brownout and the board will stop all operation until the error is fixed. There are two ways to solve this:
- Add a 100 uF capacitor between the 5V and GND terminals
- Apply 5V DC voltage between the 5V and GND terminals
If all comes right, the serial monitor should display a information on the ESP-32-CAM board as well as the domain for the camera.
Copy the domain and paste it into your browser.
Once you enter the domain, you will be presented with many settings, bear in mind that the higher the resolution, the lower the framerate (320x240 outputs at about 25 frames per second 1280x720 outputs at about 2 frames per second). Enabling human face detection will lower the framerate regardless of resolution.
I have designed an enclosure on fusion360 for the module that is attachable to the final rover. These are also printable on PLA with the same preset.
Configuring the Servo
![IMG_2177.jpg](/proxy/?url=https://content.instructables.com/F81/LXAW/M6Z2F2EZ/F81LXAWM6Z2F2EZ.jpg&filename=IMG_2177.jpg)
![Screenshot 2025-02-11 at 08.11.47.png](/proxy/?url=https://content.instructables.com/FF0/0QTS/M6Z2F3ZA/FF00QTSM6Z2F3ZA.png&filename=Screenshot 2025-02-11 at 08.11.47.png)
![stick.jpg](/proxy/?url=https://content.instructables.com/F3Y/31W5/M6Z2FC3F/F3Y31W5M6Z2FC3F.jpg&filename=stick.jpg)
The servo will be responsible for the steering of the rover, by moving left and right, it will also manoeuvre the steering link.
Understanding how a servo works:
A servo has a range of motion from 0 to 180 degrees. With the servo attached to the steering link, this is limited to 30 and 120 degrees.
How the servo will be connected:
The ESC provided has a Battery eliminator circuit (BEC) that will step down the voltage from the lithium-polymer battery down to 5V. Because the input from the servo takes 5-7V, this serves as a perfect power source for the servo
Connecting the Servo to the ESP32
The ESP32 controls the servo using Pulse Width Modulation Signals (PWM). This is a square wave that alternates between HIGH and LOW. The number of PWM HIGH's and LOW's is per second is determined by the frequency. In this case we will be using 350 Hz (as this is a digital servo).
Open arduino IDE and paste in this link to the additional boards manager:
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_dev_index.json
Click on the library icon and search for ESP32Servo. Install the latest version.
Now we can move on to the code
For simplicity we will be modifying the bluepad32 code so we are still able to control the servo with the controller.
Before the declaration of the void method, paste this code
With this code we are declaring a servo object. We have also chosen GPIO pin 18 on the ESP as a dedicated input output port to send PWM signals to the servo
Connect the LIPO battery to the ESC. Using jumper cables connect the red on the BEC to the red on the servo, black on the BEC to black on the servo as well as the GND pin on the ESP, lastly connect the orange cable to pin 18 on the ESP.
Paste the following code into the 'void setup()' method:
This will allocate a timer in ledc 0 in the esp to allow PWM HIGH's and LOW's at a certain frequency with the servo attached to pin 18.
Bluepad 32 has configured the x axis of the joysticks to a value between -512 and +512. Using this information, we will convert that input to degrees of motion on the servo.
Go to the 'void loop()' method and paste the following code.
Now the servo will move according to the motion of the left joystick on your controller.
Configuring the Motor
![IMG_2179.jpg](/proxy/?url=https://content.instructables.com/FE5/SXT2/M6Z2FBQ3/FE5SXT2M6Z2FBQ3.jpg&filename=IMG_2179.jpg)
![triggers.jpg](/proxy/?url=https://content.instructables.com/FPY/A2XX/M6Z2FBVD/FPYA2XXM6Z2FBVD.jpg&filename=triggers.jpg)
The motor will be responsible for the motion of the rover by spinning the wheels, this will be a Rear-wheel drive rover (RWD), hence it will once be driving the wheels at the back.
How the motor works:
The motor operation is similar to that of the servo except it is not controlled directly but rather through an Electric Speed Controller (ESC). The ESC controls the voltages sent to the motor hence controlling the speed of the motor. Unfortunately for the sake of the simplicity of this project, the motor will only move forwards. The motor will be connected to a pinion gear which will be connected to a main gear which will spin the wheels.
Connecting the motor to the ESP32:
The assembly of the motor to the ESC is pretty straight forward. With the use of banana connectors that come with the motor, you could either attach them directly or solder the banana connectors.
Open the modified bluepad code and paste the following code in the 'void setup()' method:
This will use the second LEDC channel built into the ESP32 to send PWM signals to the ESC at a resolution of 50 Hz and 16-bits on GPIO pin 19 on the ESP.
Connect the white cable to pin 19 on the ESP32.
Bluepad 32 has configured the triggers on the controller to a value between 0 and 1023 whilst setting a 16-bit resolution would mean that PWM values sent to the ESC would be between 3277 (complete stop) and 6554 (full throttle)
Paste the following code in the 'void loop(method)'
This code ensured that the motor moves at the pressure at which the throttle is pressed. It will only move when the brake is released and the throttle is pressed. When the brake is pressed, the rover will come to a stop.
Assembling the Rover
This step is pretty straight forward. A detailed tutorial for the assembly can be found from Engineering Nonsense here.
Connecting the Circuit
![cirucit diagram.jpg](/proxy/?url=https://content.instructables.com/F2B/R821/M6Z2FEPQ/F2BR821M6Z2FEPQ.jpg&filename=cirucit diagram.jpg)
The ESP32 can take a voltage of 3.3V for power and 5V for logic. The same applies for the ESP32-CAM.
Both the servo and motor draw too much current for the lipo battery to split with the ESPs. Hence a seperate voltage supply will be used.
Power supplies for the ESPs
I will be using 9V in AA batteries and connect them to a dc-dc buck converter. This will ensure that both boards have stable voltage and constant current to run ideally. The buck converter will be reduced to 5V.
Take your power supply and connect it to the DC-DC buck converter. Connect a multimeter to the output of the converter and turn the potentiometer until the output is 5V.
Disconnect the multimeter and connect the ESPs in parallel.
Now that the boards have a separate power supply, they can run unaffected by the current drawn from the motor or servo.
Now you have a running rover!