What it is:
This device takes the signal from an RC receiver, the kind you would plug your servos into in an RC car or airplane. Based on that RC signal it outputs controlled power to pair of motors up to 18V and 4A. The control is proportional (variable speed), and goes in both directions without bias in either direction, making it well suited to tank drive vehicles. The logic is based on a PIC18F1320. The best part of this project is not just that it allows you to make a relatively cheap RC dual motor controller, but that using this code and input scheme you can take any PIC microcontroller project and add radio control with as many channels as you like using only one pin to receive it all. Besides using those values to control other robot functions you can still use any of the ports on your receiver, including the ones that are going to the control board, to control servos.
Because it's not that much fun controlling two motors without a robot for them to drive I have built the system into a Lego robot . This motor controller could be used for any skid steer robot, or you could simplify it to one motor, use the other port for a servo and make a vehicle that steers like a car. If the Lego part of the project is of interest to you the connectors are explained in step 4 and the lego body is layed out in step 5.
This project requires basic electronic tools and a programmer that can work with 18F series chips.
The hardware:
The electronic hardware is fairly simple. The PIC 18F1320 handles all the signal interpretation, requiring only 2 filtering diodes. The same chip generates motor control signals for both motors. The other big chip on the board is a L298n motor driver. This chip contains two H-Bridges capable of driving a motor with up to 4A of current at up to 18V. Besides the chips the one other large component is a 5V regulator to give the PIC a good power supply. Besides those you have a handful of inexpensive diodes and resistors. A specific parts list is in step 1.
The software:
The software for the chip has a portion that interprets PWM* servo control signals into a variable, and another portion that generates two motor control PWM* signals. These parts could each potentially be used to make either a system that does something else based on radio control commands, or a motor controller that is driven by other means. The code could easily be expanded to read many (I'm talking 8 or more) PWM signals. You could take one of those huge $500 airplane remote control systems and have a chip read every channel! What you did with all that control data would be up to you.
A note on PWM:
These are both pulse width modulated (PWM) signals, which simply means the width of the pulses is used to represent values, but the motor control signal pulses on and off to vary the average power, or duty cycle, to accomplish various motor speeds, while the servo signal works by sending different widths of pulse which are read as relative command values.
Remove these ads by
Signing UpStep 1: Parts List
RC transmitter/receiver set with at least 3 channels. As is this code only works with stacked PWM signals. I can only say for sure that it will work with traxxas receivers. With modification it could work with any PWM timing, and I am working on making it work with synchronous PWM like the newer Futaba systems use, that is the pulses all begin at the same moment. It will not work with VEX rc systems, which use a different kind of signal.
since this is going to be in a SparkFun sponsored contest, links to the parts on that website are provided, conveniently these pages also have the datasheets
Electrical
2 9V rechargeable batteries, or any other array of of batteries that gives you 9 to 24 volts.
2x 9V battery connectors
A few feet of 22AWG or similar hook up wire (solid recommended if you don't know which you prefer)
Electronic components:
1x perf board with 0.1" spacing, about 2x3 inches in size
1x L298 Dual bridge driver
1x PIC18F1320
2x 0.1uF ceramic capacitors for regulator. (the code of 0.1uF is "104")
1x 18 pin IC socket (recommended but not strictly needed)
1x 5V regulator
2x small 3mm LEDs for indicators. (use a green and a red instead of two reds like i did.)
Resistors (2x 1 ohm, 2x 220 ohm, 1x 12k ohm, 1x 3.6k ohm)
10x 1N4148 or similar diodes
1x servo wire with two female ends, you can cut it in half and make both yo
Software needed (all free):
MPLAB and C18 software (free version works fine, only needed if you want to modify the code)
The plan for the board was made in the free version of EAGLE PCB.
Tools:
PIC programmer such as a PICkit 3, PICkit 2, or one of it's clones like the Junebug.
Solder
Soldering Iron with fine tip
Diagonal Cutters, or any kind of wire snipper you favor
Wire strippers
Soldering heat sink (recommended, not required)












































Visit Our Store »
Go Pro Today »




http://diydrones.com/profiles/blogs/705844:BlogPost:39393
you can find many more examples of servo signal capture, and of motor control using the arduino with a google search. You could still use the motor driver circuit from this instructible.
As for the controls, if you just want to build an RC car most people just buy a servo for the steering, which can be plugged right into that receiver, and a motor speed controller, which also plugs into the receiver, to drive the motor. You can also get kits that have the transmitter, receiver, motor control and steering servo.
If you want to go DIY on the controls and drive, which few people do, but that's what this instructable is about, my directions here explain that. This system still needs the off the shelf transmitter and receiver, but lets you make your own controls. In this example the two channels control two motors. The data, once received by the microchip could be used to run any process that you can find a way to control with a microchip. How to control things like steppers, dc motors, relays, brushless motors, linear actuators, solenoids, lights, pumps ect. are outside the scope of this project but if you find something you want to control, there is a way out there and it can be combined with this. If you just want to control servos it would be a bit goofy to use this because you would be interpreting a servo signal into program data, then using that data to produce a servo signal. For that there is also the option of using this plan to control a motor, and just plugging a servo directly into the receiver.
Since I may be going way off topic of what you wanted to know I'll stop now, but feel free to ask more questions, since I'm not sure specifically what you would like to do.
One question; Can I replace the lego motors with 12v gearmotors? Does there need to be a bigger battery pack for that? There would obviously be more consumption...
(yes I know that was really two questions.) lol.
If you have access to an O scope or the datasheet for your receiver you can probably find out which method it uses.
http://manuals.hobbico.com/fut/6nfk-6npk-manual.pdf
I'm not sure if this is what you meant by datasheet and I'm not quite sure what to look for. (this is only my second radio related project and it is a bit of a leap.)
Do you mean the little circuit board? That's just the inside of the Traxxas receiver, I just bought that and if you wanted to make your own it would be a whole other rather large project. If you mean my motor control board, click the [ i ] at the top left of the photo, that will take you to a page about that photo, then under available sizes choose ORIGINAL.
I'm wondering if the same code might work also on pic 18f248 - with external oscilator 10Mhz in HS4 (4 times multiplied) mode ?
Thanks Andrej