Instructables
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
1-40 of 49Next »
gtpdz6 months ago

just wonder if you use some high power/current motors do you need heat sink ?

PaulMakesThings (author)  gtpdz6 months ago
Now that I look at it, they have some examples of the math to use on pg 10 of the sheet from aavid: http://www.aavid.com/sites/default/files/literature/Aavid-Board-Level-Heatsinks-Catalog.pdf
PaulMakesThings (author)  gtpdz6 months ago

That depends on some specifics. In non-engineering terms, if it gets too hot to touch it needs a heat sink. In engineering terms, look at the heat dissipation numbers for the motor driver you are using. There is a derived property called thermal resistance. Quoting a sheet from intersil on the topic:

"A common method of characterizing a packaged device's

thermal performance is with "Thermal Resistance", denoted

by the Greek letter "theta" or θ. For a semiconductor device,

thermal resistance indicates the steady state temperature

rise of the die junction above a given reference for each watt

of power (heat) dissipated at the die surface. Its units are

deg C/W."

*http://www.intersil.com/content/dam/Intersil/docum...

In fact this paper covers a lot of useful information about heat dissipation

For example see the bottom of page 2 of the sheet for the L298n:

http://www.tech.dmu.ac.uk/~mgongora/Resources/L298...

The value you care about is probably R-ambient. It says the die can handle 130C and the Ra is 35 C/W. So if your putting 3W of power through the chip and the motor, and your ambient air is 72C, you would hit (3W * 35 C/W + 72C) the chip will heat to about 177C, which is too hot. But we can get data on the heat sink as well:

For example look at page 39 of this sheet: www.aavid.com/sites/default/files/literature/Aavid...

From that you can see if the heatsink will work, and if so, what airflow it would require. And furthermore, airflow of a fan at a given voltage would be on the sheet for the fan. Of course you don't have to be this rigorous, you can use the information available to estimate cooling easily 4 times or more higher than what you need to be safe.

dcavataio1 year ago
Very nice project Paul!...I was wondering if you freelance? I'm in the middle of a project and in need of some PIC programming assistance from someone here in Milwaukee..."If your still in Milwaukee that is".
PaulMakesThings (author)  dcavataio1 year ago
I do actually, given that it's in the scope of things I can do in a reasonable amount of time. Feel free to message me about the work you have in mind!
Is there any way in which I can use an Arduino rather than a PIC microcontroller?
Yes, in fact, I'll be posting an instructable on how to do just that soon.
Oh thank you Mr. Paul. Please do send me the link you have made the instructable.
el_gus2 years ago
can i use other pic micro controller by just changing the include <>?
PaulMakesThings (author)  el_gus2 years ago
That would depend on how different the new PIC is. Porting code can take some work, but you would start by changing the include, then see what errors you get. Often there will be ones about the config bits not being recognized, for that you need to go to the data sheet for the new PIC and find the names that it uses. Most of the time that is enough. If the PIC is too different it may be lacking features that my code uses, and then those uses would need to be reworked.
i'll try with the 18f2550 (i hope still works) or a 18f4550 and i show you my results thanks
PaulMakesThings (author)  el_gus2 years ago
I use those particular ones pretty often, they have all the capabilities of a 18F1320, and they are pretty similar, including using the same instruction set. Once you change the include you should, at most, need to change the names of a few settings.
http://www.jbprojects.netAwesome Theres one i'm making on link
axeman9113 years ago
srry but what i meant was which pins on the arduino will the pins go to?
PaulMakesThings (author)  axeman9113 years ago
This code won't run on an arduino. If you mean what pin would you use for a similar program on arduino, that would depend on the code. Any input would work, in the example code I posted it's pin 8.
axeman9113 years ago
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.
PaulMakesThings (author)  axeman9113 years ago
That would require whole different code, and the pin would be set in the code. Here is a good example of capturing servo signals on an arduino:
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.
vasim7863 years ago
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...
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
PaulMakesThings (author)  vasim7863 years ago
Hi, I'd be happy to help you out. This depends on how low level you want to start from. You could do anything from buying a complete RC car to designing your own transmitter. I opted for somewhere in the middle because I wanted to be able to control whatever device I liked, but the transmitter did not need to be specialized. To take this approach, you can buy a transmitter set. For example traxxas is the cheaper brand that is still decently reliable, a search on ebay for "traxxas transmitter receiver" gives you many results in the $40-$60 range for a 3 channel, just make sure it included the receiver or you'll have to buy a matching one of those too.

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.
martzsam3 years ago
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.
PaulMakesThings (author)  martzsam3 years ago
It should still work with 12 volt gear motors if their draw at 12 volts is less than 2A. There is a possibility with some motors that the frequency will need to be changed, but for most motors it's already in the right range. If you build it note the recent change, with some Futaba systems the code would need updating. It's only sure to work with traxxas.
You mean the remote? Because I have an almost ancient RC remote in my garage...
PaulMakesThings (author)  martzsam3 years ago
Then it just depends on the timing of the pulses, which I don't know for that particular remote. This system was designed for stacked pulses, ones that occur in series, with each successive pulse starting when the last one ends with a gap before they all start over. Some are synchronous, with all pulses starting at the same time or timed in series, with each pulse starting at a different even timing apart (ie, every 4ms a pulse starts, with a longer gap after the whole chain). Currently the code only works with stacked ones, like traxxas, but another user and I are working on a more universal mode for all PWM methods, and that will be added to this once it is working.

If you have access to an O scope or the datasheet for your receiver you can probably find out which method it uses.
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.)
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.
Chowmix123 years ago
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.
PaulMakesThings (author)  Chowmix123 years ago
This would be very easy to do with an arduino, I think they already have variable speed bi-directional motor control code for arduino out there, and servo signal reading code. The main thing you would need is the motor driver circuit (or shield as arduino users always seem to call add-ons). For that reason I was thinking of just making an instructible on how to build the motor driver unit, then people could use it however they like. Is there another aspect of this project you want to know more about, or is it mainly the driver circuit?
asingh23 years ago
please send 2ND PIC OF THE CIRCUIT BOARD LARGER AND CLEARER at armindersnandra@gmail.com
PaulMakesThings (author)  asingh23 years ago
I don't individually provide support. I'll answer questions here though.
asingh23 years ago
PLEASE MAKE THE 2ND PIC OF THE CIRCUIT BOARD LARGER AND CLEARER .
PaulMakesThings (author)  asingh23 years ago
Well, since you asked in all caps...
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.
rama22953 years ago
"you showed how to make the receiver but as the sender?
PaulMakesThings (author)  rama22953 years ago
I didn't make a receiver or sender. This is using an off the shelf Traxxas remote and receiver set. What I made is a motor controller that takes the pulses from the receiver and controls motors. These are the signals usually connected to RC servos or to a store bought motor control module.
dreja3 years ago
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
PaulMakesThings (author)  dreja3 years ago
It should work without much adaptation. The 18F248 has twice the memory of the 1320 and it has a CCP module. You would just change the configuration for whatever ports you are using, and to use an external oscillator.
anmo3 years ago
Do You have the code for ATMEL microcontrolers like ATMEGA's ??
PaulMakesThings (author)  anmo3 years ago
I dont , Atmels are also excellent microconrollers, but for now I have only PIC equipment and software. I'll see if a friend of mine whom uses AVR chips can convert it, it should be pretty similar.
Ok thanks I will try to convert it but I know it is not an easy task
PaulMakesThings (author)  anmo3 years ago
It might not be too difficult. I wrote it in C and AVR chips have a version of C, so the initialization commands will change, and possibly the port addressing, but much of those kinds of details can be handled by find/replace. I'm not sure how different the interrupts are. The people at this forum helped me a lot learning microcontrollers, if you go to their Microcontrollers>AVR section you can get a lot of help. http://www.electro-tech-online.com/
1-40 of 49Next »