A common problem for hobby robotics is controlling the drive level to a motor. Often hacked R/C servo's are used, but they typically have poor control range. Many micro-controllers don't have built in PWM or the PWM is very slow and makes for lots of motor buzz. This paper describes an AVR chip and software that converts two easily formed R/C pulse signals (often directly supported by inexpensive controllers like the Basic Stamp) and converts them into a PWM signal suitable for driving small motors.
This AVR application and the reference board design is very much like the hobby shop ESC (Electronic Speed Controller) for Electric R/C cars, etc. The value of this AVR software application is that one can interface the output signals of the AVR chip to a wide variety of H-Bridge driver chips with a current capacity from 600ma to 5+ amps. Or, it could drive a discrete FET bridge for even higher capacities.
The software runs on an Atmel AT90S1200 chip with a 16mhz clock and has the following characteristics:
- Converts R/C pulses to 0-100% forward/reverse PWM signal @ ~1.4 kHz.
- Forward/Reverse and Enable outputs for each channel
- Output disable input for each channel
- In-circuit programmable via an Atmel STK200 dongle and ISP software
- Missing pulse detection kills output if R/C signal fails
- Jumper selectable options:
Zero drive dead-band (0, 4, 8 and 12 us.)
Brake/Coast at zero drive
1.3-1.8 ms. or 1.0-2.0 ms. pulse range
The following users guide describes how the reference board works when loaded with this version. The software is written for the GNU avr-gcc assembler.
The schematic and circuit board were designed using the Eagle cad package.
A demo/evaluation copy can be downloaded from http://www.cadsoft.de. The following attached file contains the software, makefile, schematic and printed circuit board design. The primary code file is main.s. The code is very simple and should be easily ported to your favourite development environment (Atmel assembler, ICC, IAR, etc). The software includes two version: Mixed and straight. Mixed mode is intended for applications where one wants to use a single joystick, on R/C radio gear, to steer a differential drive robot (e.g tank). One channel controls forward/reverse and the other channel controls the differential drive between the wheels. Straight mode just does two independent channel conversion.
All my designs and code are available for any non-commercial or non-profit use without restrictions. If you want to use them commercially, you need to contact me and get permission.
Courtesy: Larry Barello