(or The iPod car with an awkward name)
Last summer I worked at a software company, Green Hills Software in Santa Barbara, California. I like software, but I also like to be involved in the hardware. So I decided to take on a hardware/software project which had been bouncing around in my mind for a while: control a rc car with my iPod Touch over Wifi.
Theory of operation:
The iPod touch reads values from its onboard accelerometer and sends them over wifi (UDP) to my wrt54g (dd-wrt firmware) router. The router then reads the values in the packets and sends those values out the UART. A microcontroller attached to the UART reads commands from the router and creates a PWM signal to control the motor speed and a varied pulse width to control the steering servo.
I looked around for a good car to build on. Radio Shack’s selection isn’t nearly as awesome as it was when I was a kid and the high-end RC kits i looked at the local hobby store were out of my price range. I decided to have my parents mail me my old Blue Shark remote control car that they gave me for christmas when I was 10. When I got it, I took it apart, wiping off the years of dust as I went. I decided to gut the original servo which was just a potentiometer and a motor (all the control logic was on the board). The main motor was driven by some big TO-220 BJTs (transistors). I decided to scrap the original servo and retrofit a standard hobby servo to make it easier on myself later.
For the car-side wifi I decided to use the WRT54g router which I had previously modified to have a serial port (see iSwitch). This router runs linux (dd-wrt). At Green Hills Software I was learning a lot about development on and for Linux which helped emboldened me to learn the necessary tcp/ip and serial port programming.
The iPod is an iPod Touch 16gb. When I made my first implementation of the iPod software, the 2.0 firmware was not officially released and I didn’t have a mac. So I went about building the dev-team toolchain for iPod development on iPod 1.1.4 from Linux. This felt like fumbling around in the dark and ultimately I just got the helloworld example to work and then dropped in c posix code for the network code. It didn’t look like anything, but it worked. iPhone/iTouch programming is in ObjectiveC, which is a superset of c/c++. It is also a language Apple (and few others) uses a lot. The second implementation was built on the Apple SDK one night at my friend’s appartment. It still doesn’t look like much, but it works on the 2.0 firmware.
To interface the router with the servo and the motor, I grabbed a piece that I and a few others had built for a project for Dr. Jonathan Valvano’s EE345M class (sidenote: go to the University of Texas and take his classes). This part contained a motorola HC12 microcontroller, an L293 H-Bridge IC, a RS232 serial port with DB-9 connector, a 3-pin connector for the servo. Here is the schematic. This was an ideal starting point except that the L293D h-bridge only supports .6A continuous / 1A peak through each of its two H-bridges. The Blue Shark’s motor peaks around 7 and continuously pulls about 2 on even terrain. So I hacked together a first prototype by wiring a couple L293Ds in parallel on a breadboard. That worked ok for a few days then burned up. Then (I really wanted a quick prototype) I soldered 4 on top of eachother and that worked for a week or so; this was plenty of time to demonstrate my project before I left Santa Barbara.
My current implementation of this piece uses Mosfet transistors which are rated to 18A although some kind of heatsink would be good if you were going to use that much. In the resources selection below you can find the schematic for this board. The h-bridge specifically has a few places I could improve, but this implementation works pretty well. A picture of my current implementation H-Bridge board is below
Here is a video of my first implementation (before I laid out a PCB).
Resources: (download .zip file)
- AVR code for H-Bridge board
- (old) HC12 code for first implementation of H-Bridge
- PCB / SCH Eagle files for H-Bridge Board
- POSIX code for dd-wrt router
- iPhone code for iPhone / iPod
Shoot me an email at johnaboiles [at] gmail [dot] com if you have any questions about this. I’m glad to help.
Thanks / Credit:
- Yasha Okstein did this first with the wrt54g and his palmtop
- This site for a mosfet h-bridge design that I took and modified
- All the people like Daniel Imfeld and Peter Newman who I asked about linux tcp/ip and serial stuff and just generally listened to me talk very excitedly abou the project.
- Dr. Jonathon Valvano go to UT and take his classes
- My roomates last summer Ryan Pangrle, Philip Miller, Evan Danaher; you guys are brilliant. A big part of my motivation for this project was to keep up with you.
- Mom and dad for buying me the Blue Shark when i was 10
Note: sorry for posting this information so late, an entrepreneurial friend of mine invested some money to see if we could get this protected and marketed. I’d love to release things to the community right off but if I could somehow make a living working for myself building things like this I’d be real happy.