Friday, March 25, 2011

Make Robot-Wifi-part3

Micro-controller Selection
I evaluated three different microcontrollers for this project. Below is a summary of the evaluation.
Microcontroller
PIC16F628A
Arduino (ATmega168)
Freeduino MaxSerial
AVR Butterfly (ATmega169)
Pros
price
level of software control
very easy to program (C with many built-in libraries)
integrated serial
pre-packaged development kit, little or no soldering involved
easier to program than the PIC (C)
integrated serial
little soldering involved
Cons
hard to program (assembly)
have to wire up the circuit by hand
extra serial hardware required (MAX232A)
extra programmer required
pricebootloader error (see below)
integrated peripherals cause weird output voltages
price
I choose the PIC16F628A for a few reasons:
  • I had a bunch of them around
  • I have quite a bit of experience working with them
  • I wanted a board with a small footprint, the PIC was the smallest footprint of all 3 options
  • I wanted complete control over what the code was doing and this is very possible with assembly programming
The Arduino (Freeduino MaxSerial) is my second choice and I really liked how easy it was to get it up and running. The community support is great and it's very easy to use.
I originally used the AVR Butterfly development board. It was working fine until the batteries ran low one time. There is an error in the AVR butterfly bootloader detailedhere that corrupts the code and doesn't let you reprogram it unless you load a new bootloader. To me, I just knew my car was working one day and not the next. It took quite a while to debug the problem and quite a bit of time to fix it so I scrapped that control system. I also found the output voltages to be unpredictable because the outputs are also driving the integrated peripherals like the LCD screen.
Below I have included source code for the PIC and Arduino microcontroller platforms. Both have been tested -- so use whichever you feel most comfortable with. The Arduino (Freeduino MaxSerial) would be the most painless way to get running quickly. I bought this one.
Steering Circuit

I'm actually using two control boards in my car. The reason for this is that I blew the original drive transistors on the board that came with the car. Fortunately I was able to remove them and the RX2 chip (which was also blown) and salvage the steering circuit. Most of these toy RC cars have about 6 wires that go in to the steering motor assembly. This is because inside the assembly there's a metallic wiper that moves with the motor and the extra wires are used to relay which position the motor is in. Each different RC car will have a different setup for this wiper circuit, so it's VERY useful to be able to use the one that came with the car.
I blew the drive transistors because I was trying to drive the circuit at ~16V when the battery that drives the car would nominally be 9.6V. The transistors are rated for 5A, but evidentially I was driving them too hard and they failed in a spectacular plume of smoke. I took a board from another RC car and used its drive transistors. I'm running this circuit at 12V and it hasn't caused any problems. The transistors get quite hot though. Being able to use existing RC car circuits and not having to build your own H-bridges saves a lot of time and money.
Batteries
This project sucks some major battery power. I bought some high-end RC car batteries for about $50+shipping on eBay. They're 3800mAh and came with a 1.8A smart charger. They can be found with this eBay search. Each battery takes about 1.5hrs to charge (from being completely dead). They're 7.2V, however when they're just-charged they're ~8.3V and when they're dead (no longer able to move the car) they measure ~7.1V.
I replaced all of the RC battery connectors with standard ATX power supply Molex connectors. This was so that I could connect them using cheap connectors I already had and so that it would be easy to make a splitter connector for doing power measurements. The batteries are wired in series for about 16V when fully charged.
Power Rails
5V 
(7805 1A regulator)
9.2V 
(from 12V-7812 rail)
12V 
(7812 1A regulator)
12V 
(LT1083 7.5A Regulator)
microcontroller
camera
steering circuit controller
horn
wifi routerdrive board with motor controller
The 9.6V rail was powered by putting 4 diodes in series with the 7812 12V rail. A diode takes ~0.7V to turn on. By putting 4 in series, we drop ~2.8V across them and now we have 9V for the devices that need less than 12V. After burning the first bunch of transistors I wanted to run the circuit at a lower voltage. The 7812 regulator is only rated for 1A but the motors would drain considerably more than that. Digikey sells a 7.5A 12V regulator for ~$14 which I bought. I attached it to a heat sink because I thought that it may get pretty hot. After quite a bit of use, it doesn't even get warn, so the heat sink was not required.
I didn't want to risk blowing the steering control circuit, so I put it on the rail closest to the original RC car battery voltage. The camera required 9V and the horn wasn't loud enough when I tried it on the 5V rail, so all of these devices are on the 9.2V rail.
All of the power electronics are on a prototype board and are stored under a project box.

No comments:

Post a Comment