I came across this amazing buggy kit made by Tamiya and got one on eBay for about $20 shipped. It has turned into a project without any specific goal beyond doing something cool with the buggy. I think I may do something robotic with it down the line, but the first thing I did was turn it into an RC car. The kit comes with all the mechanics including the drive motor and gearing, but nothing else, so I did the steering actuation and all the electronics from scratch. Here’s the assembled kit (minus the battery holder):
I made some PCBs a while back for random RC projects, so I had this remote control board that takes a standard joystick (the ones used in game controllers) and a Nordic 2.4GHz radio board, all run by a PIC16F1823:
The whole remote assembly worked out really well with a CR123A holder glued on the bottom. I kept the code on this side generic so I can use the remote with different vehicles (I have some helicopter and airplane projects in the queue). The remote just transmits a byte each for the x and y position of the stick, 4 times a second.
I designed the receiver board for any simple vehicle with one drive motor and one steering servo. It has a PIC16F1823, a connector for the radio board, an H-bridge to run the drive motor, and a servo connector. There’s also a FET that can switch on a load for some other simple function if the vehicle needs one.
The board on the receiving end does all the handling of the joystick inputs specific to the vehicle. In this case it puts the joystick’s y position directly into the variable that runs the H-bridge. This part of the code is ported from the UAV code; it uses timer interrupts to create a PWM signal on two separate pins from a pitch variable, scheduling interrupts instead of using delays so it doesn’t tie up processor cycles. A second timer interrupt generates servo control pulses which are set by the joystick's x position.
That huge electrolytic cap is one of many modifications I had to do to make things work with the big drive motor. It turns out everything goes to hell when you try to run big DC motors on a system with sensitive digital parts. I kept having the whole board lock up when I throttled up the drive motor. The scope showed me I was getting huge spikes on the 3V supply when the brushes in the motor disconnect. To make things work I had to up the capacitance, add a TVS, and put a blocking diode in the connection between the battery and the top side of the H-bridge. Finally things worked:
Back to mechanics. The buggy kit came with this great steering & suspension linkage for the front wheels. It wasn’t so straightforward to add a servo to actuate the steering because of the suspension—the link bar travels up and down as the suspension moves. After sleeping on the issue, I realized that I could make the servo rotate up and down on the same axis that the suspension does. This also eliminates the need to slot the servo horn because now the servo can ride up and down to account for the change in link length (it’s no longer a slider crank). Shapelock made quick work of this:
The last part is a piece of music wire to link the bar to the servo horn.
The steering worked out great, plenty of control resolution and a full range of motion on the wheels.
The drive motor didn’t work out so well. After all the modifications to take care of the electrical spikes, the system still just barely worked. I took measurements of the motor and found that it has a ridiculously low coil resistance and relies on the internal resistance of alkaline batteries to operate. I was definitely torturing my little SMD FETs and the lithium polymer battery. Down the line I’ll have to make a specialized motor driver with bigger FETs, current limiting, and a starting capacitor to kick it into motion.
Instead of wait until I find time for all of that, I decided I just wanted to drive it today, so I cut the connection that feeds the top of the H-bridge and ran the drive motor from a separate alkaline battery pack. This certainly isn’t permanent, but I got to have fun driving it around:
I have all kinds of ideas to put into this down the line, so this post is just part 1. Here’s code for the transmitter and the receiver
No comments:
Post a Comment