Instructables

Step 2: The Motor Driver

Picture of The Motor Driver
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
psychled2 months ago

Does anyone have the schematic or .brd file? None of the links seem to work.

lcheng51 year ago
John,

I would like to have one already built if you could please email private. I dont have any background in elec to confidence in building this bot. Please contact me. Thanks.
brcoenen1 year ago
I been reading the arduino r/c lawnmower and am looking into building it. Just have a question, do u have a schematic for the pcb, or layout, with the receiver on it. The pcb under the moter driver board. Not sure how to connect the components on the board to the receiver and the to the power board and to the h-bridge board
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.
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
wazeem12 years ago
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)  wazeem12 years ago
hey Wazeem, not sure if i ever answered you, if you are still looking for help, let me know.
~jd
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)  jeremydial19812 years ago
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.
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.
Could you please give me H Bridge circuit schematic for driving 2 5A 12v DC Motors
cmagruder3 years ago
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)  cmagruder3 years ago
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
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!
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
I'm only asking because the newest file in the directory was 12/1/09 5:53:00 PM, and the comment was posted Dec 12, 2010. 9:33 PM.

I'm ready to start etching and just want to make sure everything is right.
V2 worked very nicely with no problems.

Thank you,
Matt
I have a question It may sound stupid I have a 2 channel rc remote and reciever of 27MHz can I user that to give the arduino commands??
johndavid400 (author)  a_k_a__wolfboy4 years ago
sure, any type of radio that ouputs a Servo signal will work - that is, the R/C receiver can directly drive a servo motor. I tried an old 27mHz pair with success, but the radio I was using had poor range. FWIW, the 2.4gHz radios are worth the money if you can afford one - excellent range and no interference.
Unit0424 years ago
Amazing project... I have a wheechair in my garage that I have been struggling to figure out motor controllers for, but nothing cheap.

A wise old friend strongly recommends I just beak down and shell out the cash for something similar to that sabertooth motor controller. Viewing your ible, homebrew hopes are revived, but before I go out and buy... what, 24 power mosfets? (tempting prospect, as I have never seen any mosfets that size for less than 5 bucks) I need to know a bit more about the schematic.

Does the lack of swamping resistors allow any one of the mosfets from taking the entire load (leaving the others to sit idly by), and failing early?

Are these really the cheapest power mosfets you could find (cheapest as in, more current carrying capacity per dollar spent getting it.)?

Do you think only two mosfets per switch (eight mosfets per motor H-bridge) would give close to the same performance (same size motors etc.), or does the current version risk burnout enough as-is?

By the way, I absolutely LOVE the idea of making a robot mow the lawn for me, you happened to beat me to doing it... keep up the excellent robot-building!  :)
johndavid400 (author)  Unit0424 years ago
There are Gate resistors connected to each mosfet (both P and N channel) to limit the amount of current allowed to any mosfet. This keeps 1 from using all the current and leaving the others in the leg closed. I have never had a problem with uneven heating on this design. I searched for days and weeks for any mosfets that I could find. If you are trying to make a P and N channel bridge (easier since it needs no charge pump), you should try to find somewhat similar Mosfets to use. Additionally, the voltage from Gate to Source on the P-channel fets must not exceed the Vgs max in the datasheet - which is typically +/- 20v. This means that applying a GND signal to the P-channel fets to turn them On when using a 24v main power supply, will apply a voltage difference to the P-channel Gates that is above the +/-20v (since the Source voltage is above 20v) which can kill the mosfet. So my search was mainly for a good P-channel mosfet that was capable of handling at least 40 amps at 30v, had a Vgs of higher than 24v, and was cheap. The FQP47P06 is around $2 each, has a 25v Vgs rating, and is rated for 47 amps at 60v. It happens to work wonderfully and I have used this mosfet with the FQP50N06L N-channel equivalent quite extensively on a 24v power supply with no problems (The N-channel is only about $1 each). The number of mosfets you must use per leg will depend on the weight of your bot and the efficiency of the bridge. Running this bridge as in the instructable is not the best way to do it - that is, driving the P-channel and opposing N-channel with the same PWM signal, as this causes unnecessary switching losses. A better way to drive the bridge is to use a separate Arduino output pin for each quadrant of the H-bridge, and using the PWM signal only on the lower N-channel fets. Then drive the P-channel fets with a simple digital On or Off. This nearly eliminates the risk of excessive transient voltages present at the mosfet Gate due to PWM switching. I have switched to running all of my H-bridges as 4-quadrant, which also allows for electric braking. If you really want to make the bridge efficient, you will need a mosfet driver chip. The OSMC motor-controller uses an all N-channel design with the hip4081 driver chip that has a built-in charge pump for the upper N-channel fets. I have designed and built several variants based on the OSMC design, and they are far more efficient than my first attempts with the triple8. I have an OSMC bridge using 2 mosfets per leg that stays just as cool as the Triple8 with 3 mosfet per leg. My more recent versions of the triple8 use a mosfet driver (TC4427) for the lower fets which allows them to be driven at ultrasonic PWM frequencies (24kHz +), and a voltage divider for the upper fets to allow use with main power supplies above 24vdc. The wheelchair motors I am using will draw around 15 amps under normal load, but I have a 200lb bot that often has a load of dirt or rocks in the bucket, so it can easily surpass 25amps fully loaded. I recently bought a Sabertooth 2x25 and while it works well for normal use, if I try to run it hard for more than 5 or 10 minutes (going up hills and such), it begins to warm up and disable the outputs until it cools down. Trust me, with a bot as heavy as the Lawnbot400, the triple8 is not overkill - it actually works harder than the Sabertooth, but has no overcurrent protection so you must keep an eye on it. Bottom line: the more efficiently you drive the mosfets, the fewer of them you will need to do the same job.
Thank you for giving me such a comprehensive reply. The info about efficiently driving the mosfets, now that is something I will have to read over a few times.... To make sure I understand, in ordder to efficiently drive a mosfet, I need a large enough voltage difference between the gate and the source. For the N type on the lower side of the H-bridge, I would simply apply positive 24 volts to turn it on; for the P-type, I would have to... have a negative 24 volt difference? (as in, apply GND, or 0 volts to the gate while the source has +24 volts?) Eliminating the switching transients makes sense. The TC4427 datasheet says it is for low side, so that part is taken care of (except for it's max supply voltage of +22v. Does that get in the way of using it in a 24v system?), but how does that voltage divider work (in terms of creating the proper driving voltage)? Does it simply lower (ie "divide down") the higher-than-24v-supply down to a usable voltage? That hip4081 looks expensive... The 47 ohm resistors on the gate limits the current? I thought it had to be a very low value resistor on the source of the mosfet. And... wait-wait-wait... These are 50 amp mosfets here. Sorry for being a bit (a lot) dense, but why not use just one instead of the three on the triple8? Is it because of inefficient switching?
Unit042 Unit0424 years ago
I just thought of another couple of (relatively important) questions: The P-mosfets cost extra. Would it be advisable to swap them out for cheaper N-mosfets (and making needed schematic changes of course), or were they chosen simply because of the convenience of automatically having the bias resistor, or the high side/low side stuff or whatever work out? About how much current do your wheelchair motors really require (when under load)? I ask because this project seems a bit overkill for wheelchair motors.... Which leads to question 3 of my previous post.
Unit042 Unit0424 years ago
You know what? Looking at the Digikey datasheet for the N-mosfet, it seems to be able to handle 52.4 amps (assuming a good deal of cooling off with the aid of a fan), AND if more than 10 are ordered, you get a quantity discount on them. So, I wonder if these things would handle 24 volts at 25 amps (continuous, but this is worst case scenario), with only four mosfets per motor in the traditional H-bridge arrangement (ie same as your schematic, but only one mosfet per 'switch'). Hmmm. Additionally, the 2n7000 mosfets might/could be substituted by a signal transistor like the 2n4401 (or somesuch), which I already have in my junk bin.... Sorry for triple posting, this project has me thinking. :D
Bluedog244 years ago
 How would I connect the Sabertooth 2x25amp motor controller if I get it? I was looking for the parts to build yours but couldn't find them all.
i am seeing your schematic, and, sorry to say, it's wrong. All the P-channel mosfets are reversed, you have a pair of p-channel mosfets on each H-bridge disconnected from the power. But apparently you fixed those two things on your PCB, it's a trap for beginners, you should fix it.

You have no back EM protection, not even a diode, and the mosfets are too small in voltage, i used 100v mosfets with a 24vdc motor, 12A and  they just exploded, all the protection died, and the microcontroller died. We measured the inductive peaks in approximately 200v, and you have 2 times the current here. You have no hardware protection to prevent both sides of the H-bridge from turning on at the same time.
We even used toric transformers and 100uf capacitors next to the motor and, even then, it exploded, with fire and everything.

The only solution that worked, after a year of trying (we didn't find something like a BTS7960 in my city, we looked for it) was to use a double inverter relay in series with 2 500v 8A mosfets in parallel, plus all the usual diode based protections, thermistor based protections, capacitor based protections, and, of course, optoisolated from the control logic.

that was for an electric wheelchair.

so, if your circuit worked, the motors are almost magic, you are extremely lucky, or you are omitting something.

i wish you the best
johndavid400 (author)  lucassiglo214 years ago
sorry about any schematic and board differences... I am a beginner in Eagle, so I made the .brd file before the .sch file.

The mosfets  I used are 50 amp and 60v.... I am also fairly new to mosfet theory, so I can't argue with you on much, but I do know that they have built in ESD protection diodes that are rated far above the 24 volts that I am using. I thought about adding additional diodes, but as it turns out, that is not necessary. My bot weighs over 100lbs and I can do very fast direction reversing and it does nothing to the mosfets or the microcontroller (It has had the same Atmega168 since I built it a few months ago). I was worried about the gate-source voltage spikes above 24 volts affecting the P-channel mosfets, but the mosfets I used have a Vgs max of 25v and they have performed very well so far at 24vdc.  

I have used this controller with several different motors and it worked with each. Also it will carry me on top of my mower across the yard... so that is over 300lbs and it doesn't heat up at all. I may be very lucky, but it can handle anything I throw at it and it is very responsive, which is far more than I was expecting to get when I started.

I think 2 people have already made this board and said it worked... but I am designing a new board based on the OSMC schematic, so I will post it as a replacement when I am done.
maybe those mosfets are extremely good and more resistant to transient voltages than normal ones (IRFxxx), normally mosfets are very sensitive to overvoltages, and they are good with high currents.