Medium Story of the Wifi Car

So one fine day, I had this epiphony. My new computer had a microATX motherboard - according to the manufacturer's specifications, that's about 22cm x 23cm. Suppose you could get an RC car big enough... you could drive your computer! Add a Wifi card on it, and a 1/6th scale Hummer from Walmart for $70, and you have a WifiHummer. So as I was installing a (legal) copy of Windows onto this new computer, I named it, "WifiHummer".

Then a friend of mine did something similar for his science fair project. He got 3rd place at the International Science and Engineering Fair (ISEF). It was a good robot. Although I did help him program part of it, I felt that, while I still want to build the WifiHummer, it was no longer the first ever. I needed something new.

When I saw OpenWRT, I thought that it was really cool. But when I saw the SD card mod and the GPIO pins, *click*! Use the router to drive-by-wifi! At only 14cm x 16cm, it's smaller than a PC, has integrated Wifi, 12v 400mA power usage, and a cross compiler to program it! What more could I want? So I set off to build the Wifi Router car.

My first plan was to put motors on or in the casing of the router. That eventually proved too expensive and a bit unreasonable. Although there are motors that can fit inside the case, at $22 a pop, times four motors, plus they need controllers, and a battery inside the router - it was tight, and expensive. So I made a paper cutout of the router as a size reference and hopped over to the nearest RadioShack to find any cheap large RC cars on sale.

So as I was walking around, I found one car lying on the ground. It had no box, no radio, no batteries. It was obviously a returned item, but what do I care? So I ask the employee how much it costs. He says that I can't use it without a remote. I'm like... "I have other means of controlling it." He says, "Like a science fair project?" Me: "... sort of." So he asks the manager about the car. She also says that I can't use it without a remote, but he tells her that it's for a science fair project. She wants $10 for it. :smile: Sold! It ended up being $10.60 after New Jersey sales tax.

I came home and started disecting it. I cut out the radio board, and found the large H-bridge controlling the drive motors. Indeed, the black and white motors controlled the drive mechanism. There were two other groupings of transistors: One controlled the transmission (yes, a real transmisssion) in the back, and another controlled the steering. With this in mind, I set out to build a driver board.

Having previously worked with the SN754410 Dual H-bridge chip, I desided that this was a good starting point. It has four totem pole drivers, good for two H-bridges and controlling two motors - for me, drive and steering. It also wants a +5V regulated supply. So I got one from RadioShack. $1.79 - overpriced, but it was there without shipping costs and I could walk out of the store with it, so I really can't complain. I soldered up a quick board and tested it out.

Knowing that I would mess something up, I checked everything - inputs here, outputs there, power, regulator, battery. I plugged it in and saw the puff of magic smoke that powers all electronics, for after it is released, electronics seem to fail. I quickly unplugged the battery and saw a charred and smoking H-bridge driver chip. Closer examination revealed that the input power was indeed input power - reversed. Whoops. Fortunately, I had an extra driver chip on hand, so I rebuilt the board with the proper connections this time.

So I tested that board and it worked. I soldered the motors directly to the board, because I figured that board wasn't going anywhere. The inputs, however, were a different matter. I didn't want to solder the car to the router, because what if one day I need the router as a rouer? So I needed a modular way to quickly connect/disconnect the router from the car, with four conntions. The answer: a telephone jack!

So I took apart an old telephone jack. I soldered #30 wire onto the router, and the other end of the wire to the leads of the telephone jack. The telephone jack would stay on the router, and only a telephone cable would emerge from the car and plug into the car. So I cut off an old telephone cable, and soldered it to the inputs of the driver board. I might have messed up some of the connections, but I corrected for that in the driver software, so it worked out OK.

The hardware was thus completed. Now, on to software (which was happening concurrently with the hardware... sort of.) OpenWrt comes with a buildroot that, in the process of creating the firmware image, creates a cross-compiler. While it did take me a bit of time to figure out how to use it (thanks for everyone in the forms and on the irc channel for help!). Once it was working, I compiled [mbm]'s GPIO program, and a simple tcp server from Both of these worked flawlessly, so now I set out to merge them. The way it worked is this: The client program would send an ASCII integer between 1 and 9, corresponding to the direction on a telephone pad, i.e. 2 is forward, 4 is left, etc. My merged program waits for a received charachter (end by a null.. that was also a stumbling block) and disects it. Then the program enables/disables the appropriate outputs based on the input. Sending 5, i.e. stop, disables all the outputs. Sending 2 enabls only the "forward" output, etc. Tested that, worked great. Now on to the client.

In retrospect this wasn't the best choice, but Visual Basic provides a quick way to make simple GUI programs, and I know it pretty well. So I made a quick program to wait for arrow key presses, determine which ones are pressed, and send the appropraite byte to the server specified in the settings. I eventually realized that the TCP server wanted a null after the charachter, so I added that then it worked. I had quite a bit of fun with this - it's like driving a car in some computer game, because you get to use the arrow keys - but the car is real! So cool.

Then I was reminded of a James Bond movie - Tomorrow Never Dies. In the movie, Q's new car comes with a remote control built into a cell phone. The cell phone opens to display a touch pad and an LCD. A camera on the car sends images which are displayed on the LCD, and the touchpad is used to drive the car. Now I'm thinking... touchpad... LCD... isn't that a PDA?! So, Off I went to program my PDA to drive the car.

Since the PC program was written in Visual Basic, I desided to program the PDA in eMbedded Visual Basic, eVB. I ended up rewriting most of the code, with some copy-and-pastes, because eVB doesn't support control arrays natively. It also took a while to get the Winsock to work. The one problem I'm still having is the nulls at the end of the string - eVB has trouble with that. So I'm kinda stuck. If you want, I'll email you the code and you can pick up where I left off. I might actually pick this up again, because carrying around a 6-lb laptop to drive the car is, ahem, bulky, to say the least.

So that's pretty much it. I'm thinking of adding a camera, but the WRT54G doesn't have USB, and ethernet cameras are $60-$80. Considering I got the router as a gift, the car was $10, and the driver chip(s) were $10, the camera would be 3-4 times more expensive than the car itself! When I finally deside to shell out the money, I'll also add some infrared LED's and send it prowling at night. Oooh... that's gonna be fun.

Oh, for Halloween: I had this styrofoam head, a hat, and a claok-thingy that was my costume a few years ago. So I put the head on a pike (Shrek quote) and put the stick on the car, and drove that round! It was quite amuzing, except the driver chip kept overheating. I now have to remount the router with room for a cooling fan, but with that it should be able to run continuously... I can't wait to get some spare time to finish it off!

The end result:

Go to the Source (and no, I didn't like the Matrix 2 or 3)

Page Created by yasha Okshtein