Self-Guided RC Car 3
This is the wiki page for the Self-Guided RC car that TP is working on.
The idea is to:
- Build a RC car that controls itself, and
- Have that RC car figure out HOW to control itself on its own, using some sort of adaptive learning routine.
The car's intristic goal will be to always be rolling.
"Standard issue cheap piece of junk from Radio Shack."
The car has two simple brushed DC motors. Rear drive motor has High/Low gear box with manual selector; steering assembly is spring-loaded to return to center when steering motor is not powered. Chassis came with a rechargable 9.6 V Ni-Cd battery and an on/off switch. The battery label is somewhat misleading but I think it's trying to tell me that the pack is rated for 1000mAh.
I added the ridiculously oversized terminal strip.
|Red||Positive Lead from Battery|
|Black||Ground from Battery to On/Off switch|
|Grey (thick)||Ground from On/Off switch|
|Yellow||Rear Motor Lead A|
|Green||Rear Motor Lead B|
|Brown||Steering Motor Lead A|
|Grey (thin)||Steering Motor Lead B|
PIC16F688 in 14 pin DIP form.
To drive the rear and steering motors, I am using two (2) L6202 DMOS Full Bridge Drivers, which are 18 pin Power-DIPs.
The feature that attracted me to these drivers in particular was their SENSE outputs. This pin outputs an analog voltage that corresponds to the amount of current being drawn by the motors. It was my understanding that this voltage would spike to full scale when a motor stalls (powered but for whatever reason can't turn), but initial tests show a change between 0.02 V when turning and only about 0.10 V when stalled. I expect that the analog capture of the controller will be able to distinguish between the two levels. The voltage is dependent on the resistance between the SENSE pin and ground, but a resistor here also acts as a current limitor for the bridge. Until I can get my hands on the recommended 0.15 ohm (!) resistor I'm just using a regular wire, which of course accounts for the extremely low SENSE outputs.
The drivers can handle up to 1 amp of continuous current and up to 5 amps of current when pulsed. Each driver requires three (3) inputs, one for each direction and an enable. The enable is intended for pulse control, and I may end up sharing a common pulse between the two drivers, but I still have to see how the SENSE output acts when the motor is pulsed. This may require a small capacitor to smooth out the SENSE voltage reading.
Below is a picture comparing the footprints of the new IC bridges with the discrete component bridges from SGRC2. The board with the new bridges also has a 5V power regulator setup to power the controller - this regulator is not involved directly in bridge operation. As you can see, there is still plenty of room left on the breadboard for the 14-pin controller IC. I am also leaving room for the accelerometer in case I decide to re-include it at some point in the future. The compactness of the L6202's make up for the fact that they cost me about $5 a piece (plus S&H, of course). I will most likely use the SMD version for the final soldered circuit.
Sharp 30cm IR range finder mounted on a servo. The sensor is bolted to an L-shaped piece of stiff plastic which has been screwed down into the horn of the servo. The sensor has a nominal range of 30 cm, but there is a dead band region for the first 8 cm or so, requiring the sensor to be mounted just behind halfway back on the chassis so that it can detect walls pressed up against the front tires. Testing is required to determine exactly how close to the front the sensor can be mounted.
The servo has a range of slightly greater than 180 degrees, but I will be limiting it to one of seven (7) positions. The binary addresses shown above each position hint at how the neural network will be choosing where to look.
Simplied neural network routine
Current Status - Active
- Basic system control development underway
Nov 20, 2009
Set project to Active status. Removed SGRC2 control system from chasis and began playing with the L6202 motor drivers. I haven't done anything electronic that wasn't school related lately, so it feels good to get back to playing. The drivers ended up being much simplier to wire than I had been led to believe.
Nov 21, 2009
A night of slow going with the PIC microcontroller. Took a minute to get back into the swing of programming one of these things, but I think I'm finding a stride.
I found a 4.9 ohm resistor laying around. The motors still get enough power to slip on my kitchen floor and now I have a readable SENSE output. I'm noticing that the current jumps pretty good when the rear motor first starts out, so I've added a timeout mechanism to hopefully only trip the error flag when continously trying to push up against an obstacle. Right now it works great moving forward but is still a little jumpy going backward, which might be OK in the end, since backward is not the preferred direction anyway, and it doesn't seem to be that bad. It's fairly transisent and may stop showing up as the main control loop gets longer as features are added.
Nov 24, 2009
Stabs in the dark at figuring out the servo timings left me wishing I had ordered the in-circuit programming option hardware for my PIC programmer, but eventually the solutions were found. As expected, pulsing the rear motor driver resulted in havoc with the current sensing routines I had. I wish I had logged this last night (early this morning) when I could remember some details, but I threw in the towel around 6am. It took a couple hours, but I now have all the hardware but the IR sensor input working, which I expect to be relatively simple at this point.
I found some great plexi-glass type plastic at HomeDepot for fashioning a frame. Tonight I'll finish the hardware interfacing and plan to try to do up the frame at the Hive tomorrow. Once I get everything mounted I'll begin with implementing the simplified neural net, which I've been giving considerable thought to.
- Motors drivers getting pretty hot. They have a built-in thermal shutdown, which I haven't seen get tripped yet, but I'm still concerned enough to feel the need for a pulse train to the driver enables.
- Driver 'error' flag sometimes trips when the car first starts moving backwards.
- Continue contemplating how/where to mount servo/IR sensor combo
- Continue fleshing out basic system
- Pulse motor driver enable lines
- Read IR sensor output
- Control servo position
- Bring bridges under system control (currently controlling them manually)
- Construct whatever ends up being necessary to mount all components to car chassis
- Begin work on simplified neural network control routine
- Test, test, test...
- Layout PCB board, order, and solder