3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.


PIC RC Motor Controller (and example lego robot)

PIC RC Motor Controller (and example lego robot)
Note for National Robotics Week Robot Contest: I am over 18.  I am a student  at University of Wisconsin Milwaukee. As a mechanical engineering student this project is related to my major. It has also taught me skills that have led to undergrad research work that is taking me on a mechatronics and robotics related career path.

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 adsRemove these ads by Signing Up
 

Step 1Parts List

Parts List
General:
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)

« Previous StepDownload PDFView All StepsNext Step »
44 comments
1-40 of 44next »
Apr 30, 2012. 7:32 AMJayvis Vineet Gonsalves says:
Is there any way in which I can use an Arduino rather than a PIC microcontroller?
Apr 30, 2012. 8:42 AMJayvis Vineet Gonsalves says:
Oh thank you Mr. Paul. Please do send me the link you have made the instructable.
Jan 29, 2012. 1:44 PMel_gus says:
can i use other pic micro controller by just changing the include <>?
Jan 29, 2012. 6:49 PMel_gus says:
i'll try with the 18f2550 (i hope still works) or a 18f4550 and i show you my results thanks
Jan 22, 2012. 11:58 AMhighvoltageguy says:
http://www.jbprojects.netAwesome Theres one i'm making on link
Oct 5, 2011. 6:31 PMaxeman911 says:
srry but what i meant was which pins on the arduino will the pins go to?
Oct 4, 2011. 6:35 PMaxeman911 says:
Instead of hooking this up to the pic microcontroller how d u hook this up to the arduino? could u please send me the which pins go to wich pins please.
Sep 19, 2011. 6:32 AMvasim786 says:
hey..dude realy nice...i m mechanucal engineer..i want to make simple rc car..bt i dnt have any idea about receiver transmitter...can u help me pls..from wer should i start...
Sep 30, 2011. 9:17 PMvasim786 says:
hey bro THANK U VERY MUCH..i will try it..sorry to say..but i have another question..as i m beginner how to make simple forward reverse rc car...and i want to make it my self ..i can buy it from shop..but i will be more happy if i create somethin myself..so please tell me about normal forward reverse rc car,,,THANK U BROTHER
Mar 25, 2011. 4:05 PMmartzsam says:
NICE!

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.
Mar 25, 2011. 6:07 PMmartzsam says:
You mean the remote? Because I have an almost ancient RC remote in my garage...
Jun 27, 2011. 6:28 PMmartzsam says:
Ok. after a lot of procrastinating and actually having to dig through a storage facility to find the remotes model number, here is a link to the manual;

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.)
Mar 25, 2011. 9:30 PMmartzsam says:
I don't think I have an Oscilloscope lying around my garage, but the datasheet may be available online. I'll dig the remote up tomorrow and take a gander around the web. If not, I'm sure there is some way to figure it out.
May 12, 2011. 7:05 AMChowmix12 says:
If you explain the code to me (I'm not familiar with PICs.) and give me the pins you use for this project, I can try my best to port it over for Arduino. I have been able to read PWM signals accurately with an Arduino.
May 2, 2011. 2:49 AMasingh2 says:
please send 2ND PIC OF THE CIRCUIT BOARD LARGER AND CLEARER at armindersnandra@gmail.com
May 1, 2011. 2:49 AMasingh2 says:
PLEASE MAKE THE 2ND PIC OF THE CIRCUIT BOARD LARGER AND CLEARER .
May 1, 2011. 1:04 PMrama2295 says:
"you showed how to make the receiver but as the sender?
Mar 4, 2011. 5:13 AMdreja says:
Hi, it is a very useful project.

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
Feb 16, 2011. 8:31 PManmo says:
Do You have the code for ATMEL microcontrolers like ATMEGA's ??
Feb 17, 2011. 4:02 PManmo says:
Ok thanks I will try to convert it but I know it is not an easy task
Feb 14, 2011. 6:16 PMTOCO says:
Really cool, I only had time to skim through the instructable but were those just regular motors or lego motors?
Feb 15, 2011. 3:47 PMTOCO says:
I was just curious because we have to make a robot for science olympiad and people are against the tracks. I like them. Lego motors arent the best but they seem to work good in your application. If you were to do it again would you use the tracks or wheels?
Feb 15, 2011. 5:43 PMTOCO says:
It is normally on a thin carpet. I think that tracks would be better than the wheels just so nothing is skidding possibly causing it to flip over.
1-40 of 44next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
33
Followers
5
Author:PaulMakesThings(PaulMakesThings)
I am a robotic engineer, and I like to make things and teach others.