Introduction: Ghost Toddler: Esp32 FPV Pan Tilt Power Wheels
An ESP32 is the brains.
The ESP32 reads a serial stream with a 32 byte payload from an RC receiver (packaging is called "I-Bus").
The code interprets the payload into the 10 channels (e.g. joysticks and switches and stuff) from the transmitter.
The Esp32 outputs to:
-two BTS7960 dc motor drivers (wheels forward or reverse)
-one 35kg*cm servo (steering shaft pulley)
-two 25kg*cm servos (skull pan and tilt servos
-one 12V relay controlling a gas solenoid valve
-one 12V relay controlling a mini high-voltage transformer
I put an analog FPV camera in the right eye socket so I could look around with one joystick while I drove with the other joystick… Kind of like legend of Zelda.
The end product: I made a radio controlled power wheels that allowed me to FPV the experience of being the pediatric version of Ghost Rider, all accoutrements accounted for.
This project happened on a dare. I just figured out how to receive/interpret/use the serial stream from an RC receiver on an esp32 using the Arduino IDE (I was never really an RC person, but I was RC curious).
However, I had not yet completed two rites of passage for most maker-types;
1) I had never built anything really robotic, and
2) I had never built anything seriously battery-powered.
Despite this lack of experience, I proclaimed on September 26 that I thought I could do this project and publish a video on it by Halloween. I’m gonna skip straight to the “Build Instructions” part if the reader is curious on how to do this, and I am happy to lay it out.
/* Edit: Users/ Editors, let me kow if my code copy-pastes can be improved upon; it looks a little wonky */
You can read the instructions and follow along on my full build video as well:
Step 1: Interpreting an RC Receiver Serial Payload
Honestly, I saw how relatively inexpensive these transmitter/receiver bundles were, and I saw how much functionality was built into them, and I knew they worked at a longer range than Bluetooth and standard Wi-Fi (I’m not even going near ESPNow but maybe), and I had to screw around with one.
I was doing an unrelated project using field oriented control of bushels motors, and I got the remote control to do this, which got me jazzed.
Each degree of motion (we will call them “channels,” because that is what they are called in this arena) on the transmitter is broadcast to the receiver. On the receiver side, each channel outputs a PWM signal that can directly control something, if it wants to, which we don’t want to do. Instead, we will utilize a different way to use way less wires, and it is easy and satisfying.
Instead of having a PWM line for each channel fed into the ESP32, this brand of remote has this thing called “I-Bus,” which sounds complicated, and sounds even more complicated upon learning it involves reading a serial stream of bytes from an RC receiver and turning that into meaningful information.
Luckily, as of October 2024, ChatGPT4o++^2 will be familiar with this, and upon our very detailed prompts which reflect our deep understanding of syntax and semantics of C++ (to be clear, this is sarcasm about my own proficiency), we get a pretty cool class for reading off a second UART stream to the ESP32. It gets better. We even get efficient code so as not to flood the buffer (I don’t know what that means but I’m writing it to sound knowledgeable) that reads one by every time it goes through the loop, scanning for the to start bytes, then reading the remaining 30 bytes that encode the data of every state of every doodad on the transmitter. Here is the class:
Step 2: Connect Esp32 to Two BTS7960 Motor Drivers to Control Wheel Dc Motors
We are going to use some somewhat beefy but inexpensive motor drivers, one for each wheel (each of which has its own motor). The BTS7960 is rated up to 43A, which will be more than sufficient unless we live on a steep hill (in which case we would like to hear from us).
We will assign two pins to the ESP32 to output the PWM signal using the MCPWM library (apparently it’s like, better than the LEDC library or something for reasons I don’t understand). While we are soldering, we will ask ChatGPT^ei to write up another cpp class allowing us to easily control the drivers from the main loop.
This code uses the MCPWM library to drive the BTS7960.
If this works correctly, it should look something like the first part of this:
Step 3: The Steering Pulley
Dear reader, you’re on your own for the mechanical part of this section; I was entirely out of my depth here. I’m not exaggerating when I say took four iterations of progressively more (poor) aluminum TIG welding to make something rigid where I could have it fully control the steering wheel. I know some smart people hang out here and might have a better idea, please let me know as this was the best that I can come up with (including with advice from people who know what they are talking about).
Long story short, we will use a 20-tooth GT2 pulley on a 35kg*cm servo to drive a 40-tooth pulley mounted to the driving shaft. It bears stating, Power Wheels do not use elegant mechanisms for their steering.
Once we make our servo-drive-shaft coupling rigid (this involved more welding and fabricating it out tensioner for me, but I hope you understand this better), let's take our current existing code and add include the servo controlling the steering wheel.
Now that we have both the motor drivers and the steering servo controlled by the Esp32, we can do things like this:
Step 4: Pan and Tilt Skull Servos
I imagine this will be different for each of our personal skills, skill sets, and available materials. This probably could have been CAD'd and 3d printed, but I wanted to be away from the computer for a bit, so I made a weird mechanism for the pan and tilt functions of the skull.
In any event, here is a code with the motor driver is going, the steering wheel servo going, and both the pan and the tilt servers going (if you want to see videos on the actual wiring of stuff let you know because I definitely already have the footage):
Step 5: Make It Like Ghost Rider
Please, please don't make this your first experiment with flammable gas. There, I'm prepared for the onslaught of the Internet safety nerds. But seriously, this is not the starter project for flammable gas.
That said, let's plumb some propane into little Timmy to make him more awesome and bad ass! Visual aids are in the full video, but basically we do a plane cut through the top of the skull and weld some ~1/8" mild steel to it. I dunno if the skull is truly "cast iron," as that's outside my territory. All I know is it welded to mild steel really nicely! We bevel and cut a 1/4" NPT male threaded pipe (aka "nipple") to the bottom of the skull, then we drill out some holes and screw in a propane line. Control that propane with a male-female 1/4" NPT solenoid valve connected to a relay connected to the esp32.
Last thing to do? We connect another relay, then connect a high-voltage trasformer for the electrical/plasma arc. At this point, the left steering stick controls the speed/ direction, the right steering stick controls the head position, and switch3 (a 3-way switch) controls both the propane and the ignition. Position 0: all off // Positon 1: gas solenoid on, ignition off // Position 2: gas solenoid and ignition on
Step 6: Thank You for Making It This Far
I goof around, but seriously, if there's anything you want to hear more about, I am happy to share. This project involved a bunch of different things in a very short period of time. Here's a gratuitous nighttime shot: