Arduino R/C Lawnmower (painted)

 by johndavid400
Contest WinnerFeatured

Step 2: The Motor Driver

triple8_brd.png
triple8_7.jpg
lb400_3.jpg
lb400_9.jpg
lb400_13.jpg
lb400_6.jpg
lb400_21.jpg
I built several motor drivers before finding a design that worked for my needs. For what it's worth, there are several nice products already out there that are fully assembled and require a lot less work if you are not interested in building your own electronics. The Open Source Motor Controller is an open source design that has been under constant community improvement for several years now and can handle up to 160amps at 36vdc! But they are over $100 and only control 1 motor. The Sabertooth 2x25amp motor controller is nice and controls 2 motors, but it is $125.

So I thought I would just make an extremely simple dual h-bridge that could handle at least 25 amps at 24vdc continuous and handle surges of up to 100amps for a few seconds. Once I found out that you can parallel Mosfets and multiply their current carrying capacity accordingly, I thought I would come up with a simple design and slightly complicate it by adding more mosfets until I had enough to handle the current that I needed.  Digikey has a good selection of Mosfets to choose from and good filters to narrow it down by what you need, so I spent a lot of time looking for Mosfets that were rated for around 50amp and could handle over 30 volts. Also, they have to be cheap because my plan is to use a bunch of them. I decided on the FQP47P06 p-channel and the FQP50N06L n-channel Mosfets from Fairchild Semiconductor, which I bought from Digikey.

If you are wondering what an H-bridge is, find out here: en.wikipedia.org/wiki/H-bridge and this will all make more sense to you.

The design is simple: 2 P-channel mosfets control the high-side switches and 2 N-channel mosfets for the low-side switches. But instead of using 1 mosfet for each switch, lets use 3. Now we have 12 mosfets per H-bridge (3 mosfets x 4 switches) and theoretically the ability to carry 150 amps (that is not accurate though). The board is as small as I could make it with nothing touching. Each set of 3 mosfets have heatsinks and are bolted together to help dissipate heat. Also, there is an 80mm cooling fan mounted directly above mosfets to further keep them cool.  The mosfets are very good at handling sudden changes in direction and speed changes.

Since there are 24 mosfets in total (8 groups of 3) I dubbed it the Triple-8. It is running at the Arduino default PWM frequency of 1kHz (I plan on playing with that to get the frequency higher). The board has 4 inputs, 2 for each bridge. If you bring an input HIGH, that side of the bridge goes HIGH.

Ideally, you would control the board by holding 1 input LOW and applying a PWM signal to the other input. This allows for easy speed control. I have written into the code that if you bring digital pin 7 HIGH, the code switches to Relay mode and either turns the mosfets all the way ON or all the way OFF. This is far more difficult to control, but is useful sometimes.

If you are interested in building your own H-bridge you can download the eagle file to etch a pcb and the schematic to show where everything goes. You can get everything to make this dual h-bridge at Radio-shack (including the copper clad), except the Mosfets and a special resistor network I used to save space. I bought most of the parts from Digikey though because it was cheaper and arrives to my house in 2 days.

Here are the parts needed for this motor driver:

(12) FQP47P06 - P-channel mosfet 47a 60v - Digikey - $1.73 ea
(12) FQP50N06L - Logic level N-channel mosfet 52a 60v - Digikey - $1.04 ea
(4) 2n7000 - Logic level N-channel mosfet 200ma 60v - Digikey - $0.26 ea
(8) 4606X-1-470LF-ND - 47ohm bussed resistor network - Digikey - $0.25 ea
(6) ED1609-ND - 2 position screw terminal - Digikey or Radio Shack- $0.46 ea
(24) CF1/84.7KJRCT-ND - 4.7k 1/8w resistor - Digikey or Radio Shack - $1.78 (for 50pk)
(1) PC9-ND - 3"x4.5" 1-sided copper-clad .064" 2oz copper - Digikey or Radio Shack- $4.66
(4) P5575-ND - 1000uf Capacitor or similar - Digikey - $1.19 ea
(1) 330ohm - 1kohm resistor 1/4w - for power LED, doesn't have to be exact
(1) power LED any color you like, I use the 3mm size to save space

Maybe something smaller?

If you are going to use this for something smaller than a 100lb lawnmower, you can look up one of the many H-bridge circuits and build your own smaller motor controller with as few as 4 mosfets (or BJT transistors) or even use a packaged IC H-bridge like the l293d (dual 1 amp) or the l298n (dual 2 amp).

Or if anyone is interested, I will post a schematic and Eagle .brd file for a smaller version of this H-bridge that only requires 8 mosfets total (everything else is the same), and it can handle about 10amps at 24vdc.

Etching:

I am not going to go into all the details of PCB etching, because there are already many excellent instructables on that topic. So once you download my .BRD file of my motor controller, all you need to do is print the .brd file onto some magazine paper using a laser printer, and iron that onto a piece of clean copper-clad. Then etch it with your favorite etchant solution (I use 2 parts Hydrogen Peroxide to 1 part Muriatic Acid and it works perfectly). And remove the toner with Acetone when done etching.

For ease of assembly I designed this board to be Single-sided and to use only through-hole components, no surface-mount stuff to mess with!  Yay for you.

You can get the .brd files for the various h-bridges at www.rediculouslygoodlooking.com

 
Remove these adsRemove these ads by Signing Up
SamfordValley says: Apr 17, 2012. 7:19 PM
I'm going to build something similar to this, but I'm going to make it so not only can I suspend the mower, but mount it on top for longer cut on rocky terrain.

I don't like the sprocket and chain system though, but I haven't done enough research or know for sure I can do it any other way. I'm worried the chain is too complex and something weeds and twigs will get caught in.

The main problem I'm having is I can't find these wheelchair motors for a reasonable price. I live in Australia and there don't seem to be any local cheap ebay auctions for these, and shipping on these suckers from the USA is $100-$200. I can't even find a cheap old wheelchair.

Is there a more... retail... kind of product I can use? Something like a servo/actuator I can order? I have no idea what I'd need to look for in terms of torque though. What sort of specs would I need to ensure in such a product to make it work with this project?

I need it to go up steep hills (30 degrees?) in long grass on rough ground. I'm already getting hardier wheels, larger drive wheels, and I found a company in Australia called Fallshaw that makes puncture-proof semi-pneumatic castors (though I can't find a price!), I will check out one of their stockists soon.

Because I need to mow my rocky terrain sooner rather than later, I might build the frame and use it like a push mower until I can get the motors and retrofit the electronics.

Any suggestions on alternatives to wheelchair motors would be appreciated.
nathanielg in reply to SamfordValleyMay 26, 2012. 9:09 PM
i used e300 razor scooter motors they are 280w each (there are larger sizes of motors up to 500w that i have seen so far) and the ones i got were off ebay and i only paid about $65 for the pair they are working well so far i have not had any trouble with them and the sprocket size on them is #25. if you are comfortable with drilling your own holes there is #25 sprockets on amazon for pretty cheap they also have #25 size chain (10ft for $12). Hope this helped
lstanczyk in reply to nathanielgAug 6, 2012. 2:19 PM
with those razor motors would i still be able to move dirt in an wheelbarrow like attachment?
nathanielg in reply to lstanczykAug 8, 2012. 10:19 PM
i have a 72 tooth sprocket on my 10 inch wheels (still goes fast with about an aproxamatly 5:1 ratio, but that is besides the point ) i put a wagon behind it and it was able to pull me (160 lbs. ) with ease and it struggled a little (like it might not do hills) with me and my 2 cousins in it ( about 350 lbs.), but if you change the gear ratio to a higher ratio then mine then it should be able to pull alot more then what i did, mine is too fast even with that gear ratio so i'm thinking about changing mine, but if you are using a 72 tooth sprocket on the wheels it should be able to pull about 200-300 pounds without it having much trouble but once you go over about 350 pounds then it will struggle. Make sure you are using 24v (for the torque) , and dont hit rocks with it (i did and i was sorry for about 2 hours of work [with the blade not the mower itsself] ) :)

If you have any more questions feel free to ask me, i would upload a video but i finished it then pulled out all the electronics in the back pannel to install an alternator.
osstekz in reply to nathanielgOct 7, 2012. 10:05 PM
Do you have any pictures/videos of the design using E300 motors?
nathanielg in reply to osstekzOct 16, 2012. 5:49 PM
email?
nathanielg in reply to osstekzOct 16, 2012. 5:45 PM
( sorry i was working on the mower at my grandparents and i did not see the message) yes i do have a video of the but it is not the clearest :) but i will send it to you
SamfordValley in reply to nathanielgMay 27, 2012. 4:40 PM
You must have gotten lucky, the cheapest on eBay right now is $157 for the pair.
nathanielg in reply to SamfordValleyJun 2, 2012. 1:14 PM
look at motor99motor his ebay page has the E300 motors for 26.90 a piece, that is who i ordered them from and they got to my house in a buisness week, Good luck
SamfordValley in reply to nathanielgJun 2, 2012. 8:18 PM
With shipping they're $124 for the pair, he knocks $30 off shipping for buying two. I guess I'll go with those, thanks.
nathanielg in reply to SamfordValleyJun 9, 2012. 9:13 PM
what wattage of motor did you get?
SamfordValley in reply to nathanielgJun 26, 2012. 5:50 PM
280W
brancilo in reply to SamfordValleyApr 24, 2012. 1:30 PM
I was lucky motors of the wheelchair gave me one for free otherwise they are expensive but the best solution, as an alternative solution can be taken from the truck to 24v, scooter, such as John, but the best of the wheelchair
I was denied the money I worked 2 years but the project eventually end only needs to be persistent.
niak32 in reply to SamfordValleyApr 22, 2012. 3:19 PM
I'm also in Australia close to Ballina NSW, I hounded a local scooter shop about an electric wheel char they had on consignment for $380, eventually got it for $150.
If there are old people living near by (lol) there should be a scooter shop which will have parts. Batteries I got for $5 each (deep cycle) as they replace both batteries at once and one is normally "still ok".
Hope this helps
jeremydial1981 says: Feb 16, 2012. 8:36 PM
Also, this is a noob question but here goes anyway. lol Looking at the pictures it looks like there are only 4 wires coming from the arduino clone to the motor controller. Now if my understanding is correct each 3 mosfets in parallel are 1of the 4 legs/switches in each h-bridge, that makes 8 switches to control 2 motors. How exactly are you controlling 8 switches with only 4 wires. Am I missing something? I am still a little new.
johndavid400 (author) in reply to jeremydial1981Feb 17, 2012. 11:35 AM
Hey Jeremy,
you are correct, 8 switches, each with 3 mosfets each. You can use 4 wires for each motor, but you can also connect the opposite (diagonal) legs of the H-bridge together, which are the 2 you would turn on separately to make the motor move. I decided to tie those opposite pins together in the circuit so you would only need 1 wire to go forward and 1 wire to go reverse for each motor.

If you have my book, check out page 94, fig 3-11. The second and third diagrams show how if you close switch 1 (S1) and switch 4 (S4) at the same time, current can flow through the motor and it will go one direction. If you close S2 and S3, it will go the other way. When the opposite inputs are tied together like this, the only thing you need to be concerned with to keep the board safe, is not turning on both inputs for one motor at the same time... which would open all switches and cause a short circuit for that h-bridge (see figure 3-12 on pg 94).

I hope that helps
~jd
jeremydial1981 in reply to johndavid400Feb 17, 2012. 1:44 PM
Ok great, makes perfect sense now. 1 more noob question because I understand the "how" but I feel like I need to know the "why" of each step to further my learning. What exactly is the function of the capacitors on the motor driver. I don't see any diodes in the schematic for the triple 8 that you show on a few of the h-bridges in your book to protect from back emf, so am I correct in that the capacitors are "absorbing the back emf?
johndavid400 (author) in reply to jeremydial1981Feb 17, 2012. 8:41 PM
to answer your question, no. Most, if not all mosfets have built in "body diodes" that can absorb the back emf, so you do not need to add any extra diodes. If using a Bipolar Junction Transistor (BJT), you usually need to add a diode, though some come with one built-in. So by using mosfets, we have the diodes built in.

The capacitors are used to store electricity for those times when the battery is just not enough. While these are not "required", they will greatly improve the stability and overall operation of the motor controller. I usually add a few capacitors to every pcb to smooth out the voltage ripples caused by deficient immediate supply from the batteries. You are welcome to try it both ways to see what you think (thats what i did)... it should not hurt the board to do without the capacitors, though they are only about $1 each and without them you will likely experience jittery movements from the motors. Just make sure to get capacitors with a voltage rating of about 50% higher than the battery voltage. The capacitance (microfarad in this case) will determine how much energy the capacitor can store, so generally larger is better for a motor controller, but I typically use around 1000 - 3000 microfarad (uF) value, and you do this by adding (2) 500uF caps or (1) 1000uF, simply add the capacitances together of all the caps that you use... make sure they all have the same voltage rating though.
jeremydial1981 in reply to johndavid400Feb 18, 2012. 3:37 AM
Ok, thanks JD. Makes perfect sense now.
brancilo in reply to jeremydial1981Feb 17, 2012. 9:20 AM

Hey
goes from arduino for each mosfet, tending one way out of the arduino ide two mosfet on the high side and low, can any another logic level, because the output is 5v arduino which is insufficient to completely open standard mosfet.
Here's a picture:
http://www.dodaj.rs/f/Q/4J/2EuyX78E/fda89k9g1qwb96j.png
http://www.dodaj.rs/f/1b/Gf/3VPVduTf/h-most.jpg
johndavid400 (author) in reply to branciloFeb 17, 2012. 11:39 AM
hey Brancilo,
yes, you can use any other logic-level N-channel mosfet to drive the P-channel mosfets. They do not consume any current, so the amperage rating should not be a concern.... this is why I originally used the 2n7000. They are an excellent and cheap N-channel mosfet with a logic-level gate and it can switch 200mA.

I have routinely used the much larger FQP50N06L logic-level power mosfet to switch very small loads, it does not hurt anything, but you may pay $1.50 for a power mosfet and around $0.60 for the smaller ones.... but availability usually rules that decision.

regards,
jd
brancilo in reply to johndavid400Feb 17, 2012. 12:08 PM
I have TSC7000K (2N7000) I do not know whether the logical level. Everything is the same as you in datashet
johndavid400 (author) in reply to branciloFeb 17, 2012. 8:47 PM
Bancilo,
it looks like that mosfet should work fine. It is the same chip.
wazeem1 says: Nov 30, 2011. 9:07 AM
hi john,

i want to design a motor drive circuit for driving 2, 5A 22v DC motors. Motors will be used in an electric wheel chair, i also want to control the speed of motors with PWM. Can you provide me with any help
johndavid400 (author) in reply to wazeem1Feb 17, 2012. 8:49 PM
hey Wazeem, not sure if i ever answered you, if you are still looking for help, let me know.
~jd
jeremydial1981 says: Feb 16, 2012. 6:30 PM
Do I have to use the 2n7000 logic level mosfets or can I just use more of the 52a 60v n-channel mosfets for controlling the p channels?
johndavid400 (author) in reply to jeremydial1981Feb 17, 2012. 11:43 AM
Jeremy,
I may have responded to the wrong person, but yes you can use any logic-level mosfet in place of the small 2n7000. If you are using my PCB design for the triple8 motor-controller, it has holes placed for use with either transistor package (the smaller to-92, and the larger to-220) which have different pin positions. So you can use either the 2n7000 type or the FQP50N06L type.
Jayvis Vineet Gonsalves says: Sep 20, 2011. 5:09 AM
Could you please give me H Bridge circuit schematic for driving 2 5A 12v DC Motors
johndavid400 (author) in reply to Jayvis Vineet GonsalvesSep 24, 2011. 7:20 PM
Hello Jayvis,

I would be happy to help, but might need slightly more info about your motors and the weight of your bot. I have several designs for H-bridges that are smaller than the triple8, easier to build, and cheaper parts... but I would want to make sure I give you a design that works for your purpose.

~jd
Jayvis Vineet Gonsalves in reply to johndavid400Sep 25, 2011. 2:24 AM
Hi John, the robot will be about 25-30 Kgs. It runs on four 12v Electric Motors. I will also be using one more similar motor for the weapon system. I want to supply about 5-6A of current to them. Apart from this, I do not much about the motors. Here is the pic of them. ( Just to get an idea of the size of the motors, the tile in the pic is of 1sq foot.)
100_0114.JPG
johndavid400 (author) in reply to Jayvis Vineet GonsalvesOct 10, 2011. 1:02 PM
Jayvis,
It looks like those motors are ungeared (is that right?)... and if so, they will draw far more current than 5amps under full load. Especially if they are going into a combat robot (I gather from the fact that it will have a weapon system...). I would go with a 25 amp (minimum) motor-controller to be safe. I used a set of (4) 100w Currie scooter motors (ungeared and about the same size as yours) to drive a small battle-bot, using (4) 12amp Sabertooth motor-controllers, and they tripped the overcurrent protection with very little effort... ended up using a 25amp driver and they were fine.

You can use the Triple8 design as used on the Lawnbot, or I have another design if you care to see it.

~jd
Jayvis Vineet Gonsalves in reply to johndavid400Oct 11, 2011. 5:02 AM
Yes John, those motors are ungeared. And could I get a link to the other H-Bridge circuit?
johndavid400 (author) in reply to Jayvis Vineet GonsalvesOct 11, 2011. 6:29 AM
Jayvis,
Here is one of the motor-controllers I designed for my book:
https://sites.google.com/site/arduinorobotics/home/chapter8

It will handle upwards of 30amps and has an optional current sensor built in that you can read with the Arduino.

~jd
Jayvis Vineet Gonsalves in reply to johndavid400Oct 14, 2011. 4:07 AM
Thank you John for your help. I also wanted to ask what batteries are you using in the RC Lawnmover and how long does it run on each charge?
johndavid400 (author) in reply to Jayvis Vineet GonsalvesOct 14, 2011. 6:45 AM
I used (2) 12v deep-cycle (not starting) marine batteries each with around 80 Amp Hour capacity. These batteries can be run down many times and recharged without a problem, and cost about $60 each. They typically last around 4-6 hours between charges, more if you have new batteries (mine are over 2 years old, and one of them was used). If you try to use a starting-type battery (like the one found in your car), it will only last through several discharges before dying completely.

You can however, use Sealed Lead-Acid (SLA) batteries, like the ones used on an electric scooter.... something in the range of 12 Amp Hour to 33 AH would be sufficient.
Jayvis Vineet Gonsalves in reply to johndavid400Oct 15, 2011. 9:02 AM
Thanx John.
cmagruder says: Apr 25, 2011. 5:18 PM
I read the comments and have some questions that I cant seem to answer using your schematics and pictures. Here is an image that has the questions on them.

http://i1179.photobucket.com/albums/x389/Chris_Magruder/HBridgeQuestion.png

I redesigned your eagle diagram to handle only 50A of current because my motors only draw around 30A so I shouldn't have a problem with heat. I replaced the resistor array with just resistors, deleted the mosfets and moved everything inward. Thank you for your time!
johndavid400 (author) in reply to cmagruderApr 27, 2011. 8:27 PM
Cmagruder, good questions... you are the first person to change the board file - nice!

maybe this pic will help:
ftp://ftp.rediculouslygoodlooking.com/arduino/LawnBot400/h-bridge.jpg

let me know if you have more questions

~jd
cmagruder in reply to johndavid400Jul 28, 2011. 11:07 AM
Hey John,

Thanks for the help, I just have one part I'm confused about. If I just want to control the motor with a PWM to the positive side or PWM to the lower side I would just use the two terminals at the top bottom of the schematic correct?

In the pic you posted you talk about ALI and BHI, what do these acronyms mean?

On another note, I bought your book, but it got pushed back so I haven't gotten it yet!
mattadamsnet says: Apr 10, 2011. 4:59 PM
Quick question,

I'm gathering the parts to start building and I noticed the comment from Unit042 on Dec 12, 2010. 9:33 PM, have the files been updated?

I will be downloading from ftp://ftp.rediculouslygoodlooking.com/arduino/LawnBot400/Eagle%20files/triple-8/
and just want to make sure the files are correct.

Thanks, Matt
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!