DC motor braking effect

I am powering a DC brushed motor for a slotcar using an Arduino. I have controlled it via

a) MOSFET simple circuit
b) An L298 motor controller
c) an unidentified PWM speed controller where I use a digital pot to control it

This part of the project is going okay. What I would like to do is control the braking effect when the motor goes into overrun. No braking is where the motor free runs or ‘full’ braking where the output is traditionally shorted out.

The L298 allows me to control the braking effect and I think I could pulse the pin that enables/disables the braking using another PWM pin.

However… I would some ideas how to ‘switch’ in my own braking circuit once the car is no longer under power. Simple slotcar controllers mechanically short the motor for braking. More sophisticated ones somehow control the braking but I think the circuit is brought into play by the physical switching of the sweeper arm of the trigger in the controller.

Unfortunately I do not have a physical sweeper to do this. All the speed control PWM output is computer generated.

Ideas please.

Cheers Alan

A single MOSFET can't do 2-quadrant control (which is the technical term for forward + braking).

A half-H-bridge is needed, you replace the free-wheel diode with another MOSFET, allowing the motor to be shorted out (you'll get proper linear control if you drive the half-bridge in synchronous mode anyway).

Synchronous mode here means driving the two MOSFETs in antiphase from the PWM so one is always on (except for a small amount of dead-time at switch-over to prevent direct shoot-through currents).

MarkT: A single MOSFET can't do 2-quadrant control (which is the technical term for forward + braking).

A half-H-bridge is needed, you replace the free-wheel diode with another MOSFET, allowing the motor to be shorted out (you'll get proper linear control if you drive the half-bridge in synchronous mode anyway).

Synchronous mode here means driving the two MOSFETs in antiphase from the PWM so one is always on (except for a small amount of dead-time at switch-over to prevent direct shoot-through currents).

Sounds good... I'm a mech eng and my electronics is a not very advanced.

Is there a schematic you can point me at so I can see something practical? I'm not sure I'd find the free wheel diode unless it hit me in the face or build the said circuit without copying one.

Cheers Alan

H-bridge: http://en.wikipedia.org/wiki/H_bridge

For a half-H-bridge you lose S3 and replace S4 with direct link to ground. (or alternatively lose S4 and replace S3 with link to supply)

A full H-bridge allows driving in reverse, but if you don't need that then only half the circuit is needed.

MarkT: H-bridge: http://en.wikipedia.org/wiki/H_bridge

For a half-H-bridge you lose S3 and replace S4 with direct link to ground. (or alternatively lose S4 and replace S3 with link to supply)

A full H-bridge allows driving in reverse, but if you don't need that then only half the circuit is needed.

Thanks for the link... led me to some new stuff I hadn't read before however I'm still a bit stuck with the concepts side.

I don't need to put the motor into reverse so hopefully this simplifies things.

I've got the H bridge in my mind quite clearly. I can drive the motor okay.

Then the PWM is cut to the driving side at which time the motor will start to be driven and become a generator. Do I 'PWM' a MOSFET on the other side of the circuit and what do I connect it to (ground... some resistor circuit... some thing else...) An external resistor (potentiometer?) would be good so the 'driver' can adjust the amount of braking.

Cheers Alan

Perhaps it will help to understand what I am trying to do with respect to the braking effect.

I want to be able to control, via the Arduino, the amount of braking effect from the minimum to the maximum available for any particular motor (slot motors are quite variable and some are capable of severe braking and some not using existing controllers).

I plan to adjust the braking amount during the braking period rather than have a single braking force. The user/driver would be able to adjust how the Arduino responds by adjusting the parameters of the braking algorithm.

I already monitor voltage and current and use these and their rates of change in the control algorithm... this part is I have under control (pun intended)... I just need the analog electronics sorting out

Cheers Alan

As forward speed can be varied with the duty cycle of the upper transistor, similarly, braking force can be varied by the duty cycle of the lower transistor. You have two options if you use a half-bridge (no reverse):

In Option A, you can PWM only the upper transistor for forward (alternating "go" and "coast") and PWM only the lower transistor for brake (alternating "coast" and "whoa"). This is easiest to implement, as you can use the Arduino's hardware PWM.

In Option B, you can PWM the upper and lower transistors in opposite phase. That is, you never use "coast". One transistor or the other is always on (alternating between "go" and "whoa"). This is called Locked Anti-Phase Drive, and it generally allows for "better" (subjectively) speed control of a motor (changes the throttle-response curve). It's particularly useful when you're letting a PID algorithm control motor speed, which you aren't in this case, but in your case the human is sort of a PID controller. A car with Locked Anti-Phase will "feel" different, which you may or may not like.

If you are doing your own H-bridge, be aware of shoot-through. That is, if the upper transistor turns on before the lower one fully turns off (or vice versa), you have a dead short which can pop a transistor. Even if you switch one off in software immediately before turning the other one one, transistors don't turn on/off instantly (they have internal capacitance). So, a delayMicroseconds(1) between flipping states is a good idea. However this illustrates the fact that you need to do Locked Anti-Phase in software, as doing it with hardware PWM requires a ton of extra hardware components to add delay and avoid shoot-through. If you have a tight loop(), you can do Locked Anti-Phase in pure software just fine, but if your Arduino is busy doing a lot of other stuff (excessively frequent analogRead()s, for example) you may need to use a hardware timer interrupt service routine to flip states.

However this illustrates the fact that you need to do Locked Anti-Phase in software, as doing it with hardware PWM requires a ton of extra hardware components to add delay and avoid shoot-through.

How is a half-H-bridge driver chip with dead-time enforcement "a ton of extra hardware"?

http://www.irf.com/product-info/datasheets/data/irs2004pbf.pdf

MarkT:

However this illustrates the fact that you need to do Locked Anti-Phase in software, as doing it with hardware PWM requires a ton of extra hardware components to add delay and avoid shoot-through.

How is a half-H-bridge driver chip with dead-time enforcement "a ton of extra hardware"?

Let me rephrase that... "However this illustrates the fact that, when building your own H-bridge, you need to do Locked Anti-Phase in software..."

But I always use MOSFET driver chips when building inverters/bridges, and one's that enforce deadtime are a no-brainer to select. One's like the IRS2004 that take a single input are harder to find, but make things easy when using antiphase, but a 74HC14 isn't a big problem to add in front of a driver either.

Can someone sketch out one of these circuits for me... I'm getting left behind a bit :(

The IRS2004 datasheet I linked to has a half-H-bridge example circuit.

Actually the L298 has braking built into it. If you turn on both high-side drivers at the same time, it will short the motor leads together. That being the case, you should also be able to turn on "FWD", PWM-"REV". then set enable HIGH.

rmetzner49: Actually the L298 has braking built into it. If you turn on both high-side drivers at the same time, it will short the motor leads together. That being the case, you should also be able to turn on "FWD", PWM-"REV". then set enable HIGH.

I tried that and it works. Pretty easy as nothing to do except follow the instructions. Free running stopping and braking which is controllable - in theory just what I want. Slightly different behaviour if you PWM the enable or PWM the input but good potential EXCEPT....

The problem with the L298 is that it is very inefficient and eats up something like 2v just being there and I only have about 12v to start with ... which I why I asked another question elsewhere about being able to treat the two motor outputs from the L298 as two independent sources of power... either coupling to give greater current like parallel batteries or in series to give greater voltage (up to 12v - 2v times 2 = 20v).

I'd seen coupling for more current but not for voltage... apparently the latter is a stupid idea although the explanation as to why was pitched above my pay grade and could have done with being dumbed down a bit.

Perhaps I just need to build an L298 type of thing with something more efficient like the MOSFETs. Maybe something exists. My L298 came assembled on a break out board so I didn't work out all the clever stuff... as I said I'm a mechanical engineer not an electronic. Anyone have such a schematic?

The other unknown board I mention in the first posting is efficient but what little I can read is in Chinese on it (which means not much!), no instructions, a chip with nothing marked on it at all, incorrect help from the supplier... I got it working with a digital potentiometer replacing the physical one it came with. Can't work out how I'd control any braking though. You can see loads of these on eBay.

A schematic/circuit that would help me understand a lot is one that is simply a braking circuit that I can control. I do something with PWM to control the amount of braking from zero to maximum... anyone help there?

Cheers Alan

This one should let you do what you want, and it's cheap. There's a link to the schematic on that page. I believe if you set both inputs HIGH you can do braking.

http://www.ebay.com/itm/43A-BTS7960B-DC-Motor-Driver-H-Bridge-PWM-Fast-Braking-For-Arduino-Compatible-/171065203806?pt=LH_DefaultDomain_0&hash=item27d447dc5e

rmetzner49: This one should let you do what you want, and it's cheap. There's a link to the schematic on that page. I believe if you set both inputs HIGH you can do braking.

http://www.ebay.com/itm/43A-BTS7960B-DC-Motor-Driver-H-Bridge-PWM-Fast-Braking-For-Arduino-Compatible-/171065203806?pt=LH_DefaultDomain_0&hash=item27d447dc5e

Yep control-ability just like my L298. The above i not available in the UK (on eBay that is) but at that price from China/Hong Kong I could put up with the delivery wait.

So cheap in fact you can't buy two chips for the same... what can you say!

You will also notice it has FETs for the output stages so you don't give away 1.5-2V like a Darlington stage does.

acboother:

rmetzner49: This one should let you do what you want, and it's cheap. There's a link to the schematic on that page. I believe if you set both inputs HIGH you can do braking.

http://www.ebay.com/itm/43A-BTS7960B-DC-Motor-Driver-H-Bridge-PWM-Fast-Braking-For-Arduino-Compatible-/171065203806?pt=LH_DefaultDomain_0&hash=item27d447dc5e

Yep control-ability just like my L298. The above i not available in the UK (on eBay that is) but at that price from China/Hong Kong I could put up with the delivery wait.

So cheap in fact you can't buy two chips for the same... what can you say!

It's arrived! In a jiffy bag... header pins bent and I noticed that the screw mounting the heat sink was shorting two pins in the chip... Oh well, at least I haven't powered it up yet.

Now, who has wired this chap up and can speed me along the way please? Looking to see how to control free-wheeling braking and 'full' braking in particular.

Cheers

Alan

http://www.infineon.com/dgdl/Infineon-BTS7960-DS-v01_01-en.pdf?folderId=db3a304412b407950112b408e8c90004&fileId=db3a304412b407950112b43945006d5d&ack=t

Chapter 6 of the data sheet shows an application example. I see no reason why this wouldn't be a starting point.

rmetzner49:
http://www.infineon.com/dgdl/Infineon-BTS7960-DS-v01_01-en.pdf?folderId=db3a304412b407950112b408e8c90004&fileId=db3a304412b407950112b43945006d5d&ack=t

Chapter 6 of the data sheet shows an application example. I see no reason why this wouldn’t be a starting point.

Thank you for the link to the datasheet. It takes me a bit further forward but I still have some questions. Below is a photo of the actual device. I have added on the B± (assuming power in or “B”attery) and M± (“M”otor) in red which are marked on the underneath of the board. You can see I have the pins nearly straight now and you can see how the right hand screw would touch a couple of the pins if it were screwed right down (I will sort this problem later).

The datasheet talks about the high side and low side of the MOSFET as a single chip (or seems to be to me). But the application example is like the board with two identifiable chips. The identification on the actual pins of the board is different to that in the datasheet application example which is the closest I can find to the actual device – no left or right even though there are two chips.

It appears the IS pins on the two MOSFETS share the same I/O pin on the Arduino, and the same for the INH pins (which control sleep mode according to the pin definition functions! What is that?). Otherwise two more Arduino pins are used for IN (left and right each). That only makes 4 pins plus VCC and GND. So why are there 6 pins on the device plus the VCC and GND?

Why are there two MOSFETs to control assuming that the prefixes on the pins L_ and R_ mean left and right?

I think _IS and L_IS mean left and right current sensing pins. I can’t work out if these are input and/or output pins and once again why two are needed?

The truth table in the data sheet doesn’t explain freewheeling and fast braking options. I compare this with the L298 datasheet which does show how to set the various pins to achieve these two different forms of motor braking. So how do I control this?

Comparing with my L298 I can PWM the input pins or the enable pins in order to get motor speed control. As I recall the motor behaviour is slightly different but never-the-less it worked. Can the enable pin(s) on the BTS7960 also be PWM’d to provide speed control?

Can the motor ground (assume M-) and/or the battery ground (B-) and/or the Arduino ground (GND) must be or could be common?

I have asked the supplier to unlock the link to the documentation on their eBay page but I’m afraid no reply. I have extracted what I think are the relevant parts of the datasheet below.