I've done some work with Arduino controlled cars, but the ones I've worked on have always been slow and methodical. This is great when learning arduino, but I wanted something a bit more...fun. Enter the RC car.
RC cars are literally designed to be as fun to drive as possible - they're toys! I went on YouTube but all I found was a bunch of overly complicated ways to convert an RC car to Arduino control. I thought there must be simpler ways to do this, so I set out to find my own way of converting an RC car to Arduino control, emphasizing simplicity and effectiveness.
Rather than gut the car and start over, I thought it would be a lot easier to piggyback on the existing infrastructure. There are some really cool benefits to this method.
I hacked the controller of the car, but left the car itself untouched. This allowed me to autonomously control the car for way cheaper, using the radio system they already have.
I like this solution because it's elegant, easy, cheap, and extensible. Hope you find it as useful as I did!
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Test Drive!
You really want to crack the car open and get started. But wait! You just got this awesome new RC car, take a moment to act a little childish and drive it around! My friends and I had a lot of fun running around with an RC car "for science." Our favorite spots to drive around have been a local skate park and an old baseball diamond. These places were great for practicing jumps and donuts, check out the slow mo video we got!
Step 2: Open Up the Controller
Each controller is different, so it's important to take a look inside to figure out what you're dealing with. My controller had a trigger for the gas and a foam wheel for turning. It turns out that both the trigger and the wheel were just complex housings for potentiometers! This is super convenient because we can easily spoof this with an arduino.
Take a minute to figure out where the potentiometers connect to the board. They should have 3 soldered wires on there: Power, ground, and data. This will be important soon.
Step 3: Multimeter!
I ran into an issue and I forgot to try using a multimeter. After finally remembering to use the multimeter, it fixed all of my problems!
Multimeters are like the print statements in your code, the editor to your paper. In this case, the multimeter helped me to understand the way the potentiometers were hooked up so I could better fake them with the arduino.
To figure out how your potentiometers are hooked up, simply touch the ground to ground, and the red wire of your multimeter to the data pin of the board. The order should be clear from the color of the wires, but if not, the data pin is the one that will change value as the potentiometer is turned.
Then I recorded the values of the data line at the midpoint (the default position) and at either pole. This way, I would know what 0 was, and which direction to go to increase or decrease speed, or to turn left or right. Here are my measurements:
- 0 max speed
- 1.75v no movement
- 3.0v max reverse
- 0 max left turn
- 1.57 no turn
- 3.37 max right turn
I was planning to use an Adafruit feather to control the car anyways because I like the board, but these measurements support that decision. The feather runs on 3.3v logic, which lines up really well with this analog range. This could also be done with a 5v board, but you would have to be more careful about the maximum analog voltage you supply.
Step 4: Test It!
This step is optional, but I find it's always better to test the intermediate steps with controls if possible. I used a desktop power bank to hook up the controller with alligator clips (after desoldering the data lines), and test different voltages. It was awesome to turn the knob on the power bank to vary the voltage and watch the wheels rev up as if I made them move with the controller.
Step 5: Hook Up the Arduino
This step was actually pretty straightforward, but I did a few things that made this work a lot better. Here's my method:
- Desolder the data lines from the two potentiometers, on the board side.
- Solder the loose wires to a male plug: speed to power and turning to ground.
- Solder a matching female plug to the board, so that if plugged in, it would function the same as before.
- Solder a male plug to the arduino.
- One wire to the built in DAC (on my board this was pin A0, not all boards have this so make sure to check first!).
- If you happen to be using an Arduino Due or similar, then connect the other wire to the second built in DAC.
- Otherwise connect the other wire to the output of an external DAC; I bought an external DAC breakout board from adafruit.
- Connect the other pins of the external DAC to the Arduino.
- Connect the ground line of one of the potentiometers to the ground of the Arduino
- Providing a common ground helps reduce interference dramatically.
Step 6: Programming Your New Autonomous Car!
Now you can autonomously control your RC car! Your going to have to use a library if you're using an external DAC, but otherwise the programming should be quite straightforward. As you may have guessed from the wiring, it is crucial to use a true analog signal. At first I tried to get it working with a PWM signal, but it had confusing and generally poor results. With true analog outputs however, it's been working great!
Start with geometric shapes and patterns that would otherwise be difficult to make with the controller. For example, the first thing I programmed mine to do was to drive in perfect circles of varying diameter.
This is also the lightest weight modification I've seen to autonomously control an rc car, and you'll learn a lot about how they work during the process!
Step 7: Next Steps
The major drawback of this solution is that I do not have two-way communication. This means that I can send the car instructions, but cannot receive sensor data.
The next thing I plan to do is address this problem, either by hacking the car side to send data back, or by setting up a separate link to relay sensor data. If I set up a separate link it won't have to be as reliable as the main drive link because the motor controls are more important.
Participated in the