A step by step instructable on how to take any R/C car and control it with your computer
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Overview
my friend leslie got me a radio controlled rat, so I decided to make a computer interface for it (because I'm a huge dork)
This instructable shows how to hack up an R/C car and connect it to your computer. I made a web interface for mine so that my mom could drive a little car around my room from north carolina (I'm in boston), using a webcam to watch it.
This is pretty fun project, takes about an hour to solder up, and if you can make toys computer controlled, you'll uh.....have lots of friends
Also, I'm writing an instructable on using an R/C car to make a digital radio link. Stay tuned, amigos.
Step 2: Get the Parts Together
so, this is what you need:
an old R/C car and its transmitter--this current version might work for transmitters with digital proportional control, but it's designed for transmitters that just have on/off buttons
a proto board--I really like the radio shack PCB boards that are basically breadboards, except pcbs.
an atmega48--smaller processors will work, too, but I have tons of these around, they cost $1.65, and the code I wrote is guaranteed to work for them
a max232 chip (or a max233, if you're rich, lazy, and classy)
a female DB9 connector (with soldertails)
4 1uF capacitors(for the max232 chip)
a 7805 voltage regulator
as many 2N2222 transistors as you have buttons on your transmitter (I had 6)
a 1K resistor for each transistor
Step 3: Get Some Tunes
everything is better with music. Take some time and rock out. I'm listening to Vitalic's OK Cowboy album right now, and it's really good. If you're into variety, grab one of my mixes at http://www.artiswrong.com/alex/mix
Step 4: Start Actually Doing Things
OK, let's get down to brass tacks (how much for the ape?) (anybody get that reference? somebody? please????)
open up the transmitter. It probably looks like the picture below. Be careful with the battery wires--they can pull out really easily on some transmitters, and then it's hard to figure out where they went. You might as well just mark where they are now, and then you can fuggetaboutit. Same goes for the antenna wire, if the antenna's not soldered directly to the board.
Now, find the buttons on the remote that make the car do stuff. Give the transmitter power, and using a multimeter, find out which end of the button is at a high voltage and which end is at ground. Remember this.
oh yeah--a note on the buttons. They tend to be DPST buttons, since those are sturdy if you solder them, but they're used like SPST buttons, meaning that when you press the button, all it does is connect one wire to one other wire. Since each button has 4 wires, you'll need to figure out which ones are actually used. Use the multimeter, luke
Step 5: Solder on the Transistors
OK, remember how you just figured out which of the button's leads had a high voltage on them and which were at ground? Cool.
Now we're going to solder transistors to the buttons so that we can control the current flow from another circuit. And by 'we', I mean you. I already did it. That's where all these pretty pictures came from
OK, so you'll want to solder the collector lead of your transistor to the high voltage pin of the button, and the emitter lead to the ground pin of the button. Bend the base lead out of the way, so that you can get to it later. Do this for each button.
Step 6: Build Some More Stuff
So, now you want to build the circuit from the schematic below. The transistors at the bottom are the ones you just soldered onto the transmitter. And oh yeah--THIS IS IMPORTANT! Don't forget to put your microcontroller in an IC socket. Otherwise you'll be very sad when you want to program it. For now, don't worry about where the VCC for your 7805 is coming from (this will be the 9V we use to power the transmitter).
Feel free to put on a power LED, too. Doing that always gives me a warm feeling inside
Step 7: Connect Your Board to the Transmitter
OK, so now, solder the 1K resistors onto the base leads of each transistor on you transmitter. Now, solder wires from each of the resistors to the PB0-PB5 lines of your microcontroller. (Remember that my transmitter had 6 buttons, so if yours doesn't have that many, don't feel bad.)
Connect the positive battery(probably red) wire from the transmitter to the 7805's VCC pin on your board. Connect the ground wire to ground on your board.
And now's probably a good time to wire up the serial DB-9 connector to your board. Connect the PC_TX line to pin 2 of the DB9 connector, the PC_RX line to pin3, and the GND line to pin 5. There are tiny little numbers on the solder side of the DB-9 connector that should give you an idea of what I'm talking about. If you don't see them, look up DB-9 pinout in google, and that oughta help
Step 8: Program the Microcontroller
OK, now you want to flash the micro with some code to let it talk to your computer. If you have an AVR burner, burn cujo.hex onto the micro. The code is in cujo.c, if you're interested. If you want to use the makefile, just get rid of the .ale extension--instructables doesn't let up upload extensionless files
If you really want to make this, but you don't have an AVR burner, email me at email@example.com and I'll send you a burned micro if you send me like $5. I might also make a kit for this, with a printed circuit board and all the parts you need (including a cheap R/C car), if enough people are interested
Step 9: Hook It Up to Your Computer
Plug your computer's serial cable into the board you just made. Give the board 9V and ground, and run the program radio that's listed below (remove the .run extension--again, instructables with that no-extensionless-uploads thing)
It's compiled for a linux machine. This code will only work on linux machines, I think. The source is in radio.c, also listed below.
The code I wrote uses the numpad to control the car. Be sure that num lock is on. Also, ESC closes the program.
If you want to write your own code, either because you have a PC/mac or just feel sexy, the details are:
the chip talks 4800 baud 8N1 serial.
the program is very simple--it will just spit out whatever number you send it on portB. If you send it '1', it will turn on button 1. '2' will turn on button 2. '4' will turn on button 3, etc.
email me at firstname.lastname@example.org if you have questions
Step 10: Done! (at Last)
cool. You're done. With any luck, you should be able to drive your car around with your computer. If you think this instructable is cool, but it seems like to much hacking, or you don't have all the parts, I could put together a kit. Email email@example.com if you're interested.
I hope you enjoy it.
By the way, you should be able to drive my car around(in my room) and watch it on a webcam soon. Check out http://www.artiswrong.com
see you later,