Friday, February 4, 2011
Robotifying an RC Truck
And, I'd gotten an Arduino to control the steering and throttle, prototyped interfaces to a gyro, GPS, and SD card, and was ready to capture data, but before I could do so, it was time to modify the RC Truck and mount the control electronics more permanently.
I didn't want to drill a bunch of holes in the truck if I didn't have to and I wanted to keep a plastic body shell on the truck to protect the electronics from rollovers and weather.
I decided to use a sheet of Lexan® (polycarbonate) I had laying around as the base for the electronics, mounted to the RC truck chassis in a solid but non-destructive manner.
In the front of the truck, there is a plastic frame screwed into the top of the chassis, encapsulating the servo steering mechanism. I decided to use two of this frame's mounting holes as attachment points.
Luckily I happened to find a couple of longer screws of the exact size and thread pitch. I needed longer screws to accommodate PCB spacers under the polycarbonate sheet.
As for the rear, I built a bracket out of sheet brass to fit over the rear body studs. These studs have two clip holes so I can clip down the bracket then clip the body on top of the bracket.
I have a tabletop sized Harbor Freight sheet metal brake that I used to get nice clean bends on the bracket. I drilled the required 5 holes in the plastic using a step drill (I can no longer live without one!). Four holes for mounting, and one hole for the antenna.
I used the step drill for the brass bracket, too. Two holes for the studs, two for mounting to the plastic.
I stuck my breadboard to the plastic sheet and started working on protoyping.
I wanted a way to tie the microcontroller to the ESC / BEC and steering servo. The Electronic Speed Control is the throttle. The Battery Elimination Circuit puts out a regulated 5V that can power the microcontroller and sensors.
I made a simple servo connector adapter using a Radio Shack copper clad perfboard, pin headers, and wire. Now I can plug the steering and throttle connectors into the microcontroller with ease. You can see it in the picture above, just left of center, in the foreground.
It's the gizmo with a bunch of orange and yellow wires and a black and red wire pair for power. The black, red, and white servo wires are plugged into it.
A side project: The RC truck travels about 15mph and I already know from experience with Pokey that my robots have a penchant for crashing into things. The RC truck robot won't be stuck in a maze so it might run into cars, cats, dogs, people...
To provide a remote kill switch, I wanted the robot to halt itself if I turn on the RC transmitter. I added one more 3-wire connector: from the microcontroller INT0 pin to the radio receiver. That's the black, red, and yellow wire set are plugged into the receiver, which is the blue device in the center foreground.
I coded the microcontroller to interrupt if it sees a high signal from the radio receiver. When it does, it disables the throttle and steering and aborts operation.
With the electronics mounted securely, it was time for a test run to capture some data...