# How to tackle regenerative current in my H-bridge

I am using 2 of the following H-Bridge to control 2 x 24V 350W electric scooter DC motors. The power is from 2 x 12V 12AH SLA batteries in series.

EDIT: These are the entire schematic and PCB photos:

The PWM signal controlling this H-Bridge is in locked-antiphase mode at 40KHz.

This H-Bridge works great except that only when the motor brakes and changes direction SWIFTLY, this will make the microcontroller hang oweing to electrical ripples/noise.

I am new to H-Bridges and I am unable to see how regenerative current from the motor (generated when the motor slows down and changes direction) is circulated around the circuit. Would it be the cause of my problem? How to tackle it?

A friend of mine who designs electronic circuits suggests using a 0.1uF capacitor in series with a high power resistor (5W) and connecting both between the motor terminals, in order to absorb the power generated by the motor whenever it works as a power generator. Has anyone done this before?

I am grateful to any help from you!

Ah, I forgot to put in the schematic, but C6 and C9 are 1000uF each. The half bridge driver is IRS2184S. If you want to see the schematic clearer, please do a "Save image as". Thanks in advance.

EDIT 17 Nov 2014 Based on Andy aka's & JonRB's answers:

Thank you both so much for your invaluable advice. I believe you are poiting me in the right direction now!

I plan to get this circuit board redesigned, fabricated and tested with updated result, and these are the changes I am going to make:

• Since a 4 layer PCB is not possible here, I intend to use a DIP version of the micro (pitch=2.54mm) so that I can make a full earth plane around the micro
• The earth plane of the signal part will be connected directly to Battery (-) rather than to that of the power side, so that return current of the power side goes directly to the battery rather than polluting the signal side

I would like to hear your comments on the following if possible:

• If I make the power side and signal side into 2 separate PCBs connected by some wires, with GND of each connected directly to Battery (-), will this be even cleaner? Would you recommend it?
• @RonRB: is the braking circuit a must (to make the board run without hanging/data corruption)? I guess we can live without it?

As a self-taught electronics enthusiast, I have been pulling my hair on this problem for a month now, hopefully I will have it resolved thanks to your help.

• There are no clues on the circuit about the microcontroller wiring so answering this is guesswork. Why not show the full circuit and a picture of the circuit board. – Andy aka Nov 15 '14 at 11:12
• Andy, thanks for your concern! I have added the entire schematic and PCB photos. – Dave Nov 15 '14 at 12:31
• Is it a double sided circuit board? How good is the earth plane on the circuit board? – Andy aka Nov 15 '14 at 12:36
• Yes the PCB is double sided, but all the components are on the top layer. I made a ground plane on each side,and they are well connected with vias as you can see and THT components. ground planes are connected to Battery - – Dave Nov 15 '14 at 15:40
• Bottom line is that I believe your micro is resetting due to bad ground plane or bad placement of connectors through the PCB i.e. power ground currents are forcing their way into the MCU ground plane area. Maybe a picture of the reverse of the board is a good idea? – Andy aka Nov 15 '14 at 17:44

This H-Bridge works great except that only when the motor brakes and changes direction SWIFTLY, this will make the microcontroller hang oweing to electrical ripples/noise.

Given the picture of the reverse of your double sided board I have to strongly suggest that it is the lack of decent continuous earthplane that is causing you this problem and possibly others that you have not encountered yet: -

What you have around your MCU is not an earth/groundplane but seemingly a series of tracks with loop inductance i.e. they act as a magnetic pick-up and when the big current thru the motor arises (changing direction) the voltages induced in these loops "tip the balance" and quite possibly cause your MCU to reset and/or disturb the power lines to your MCU in a way that causes corruptions to data or memory.

You may argue that you can't get all the connections in and out to your IO if you did a full earth plane and I'd immediately say "use a four layer board".

• I believe you are quite right! I think I will have the board redesigned, please do see my update in the Question, I would like to have your comments on 1 more point reg. the earth plane – Dave Nov 17 '14 at 3:42
• Regarding your proposals, star-point grounding is good but so is minimal length of wires so I'm not 100% sure using two PCBs will be ideal. However, it might help you debug things that crop up and is, as a method fixable more easily and should be able to made work. – Andy aka Nov 17 '14 at 8:24
• Ouch, the only part on the board that really needs tight grounding doesn't get one. – gsills Nov 17 '14 at 18:49

The issue here seems to stem from poor layout more than anything. This has been covered by Andy aka, but to compliment what was written BUT more from a powerCore point of view (rather than a sensitive digital point of view, where a solid GND plane & decoupling is pretty much mandatory...)

The H-Bridge is powered from the 24V directly & returns via GND.

The control is powered from 5V, 3v3 ... & returns via GND, the same GND.This doesn't have to be an issue UNTIL you see the route the return current of the H-Bridge takes... Some of it will start polluting the digital section, especially the bridge on the far right (topside view), Especially considering that bank of via's top left (topside view)

Digi & Power can share the same 0V But you have to be conscious of the return currents.

Three things I would do

1. I would clearly separate the Power 0V and the Control 0V and have a single startpoint near the connector
2. I would introduce a CM choke between the 24V:GND to produce a 24V_CORE:GND_CORE. this will help block any HF going back onto the sensitive section & equally a similar arrangement from 24V:GND to produce a 24V_CON:GND_CON. Equally consider setting up a Pi filter to help with EMI.
3. Deal with the regenerative energy.

W.R.T. #3 what is your load inertia? what are your rotor inertia's? what is the deceleration rates?

These three things in conjunction with $\frac{1}{2}J\omega^2$ will tell you how much energy you need to pull out of the system. All this energy will be dumped into your DClink (those nice little... 10uF capacitance). THUS with $\frac{1}{2}CV^2$ you know how much your DClink will rise.

Then you can decide what todo

1. reduce your current limit - slows the decel --> exchange of power
2. reduce your rotor acceleration limit - slows the decel --> exchange of power
3. reduce your current/speed loop gains - slows the decel --> exchange of power
4. Introduce a braking circuit

Braking circuit (edit)

During deceleration of the machines rotor+load inertia, you will be pulling energy out of the mechanical system into the electrical system.

Right now you have some MOSFETS that (for argument sake) are switching in 50nS. They are switching 24V ==> 480V/us

When you start to actively brake/regen two things occur

1. At higher speeds you will be initially be switching higher voltages: say +10V due to BackEMF & -24V due to inverted H-bridge ==> 680V/us
2. There will be an exchange of energy: Mech --> Elec

Hopefully it is #1 you are being susceptible & the layout would hint at that. Split 0V plane plus a CM choke & Caps (creating a Pi filter) going to the control should significantly mitigate this - Make sure the starpoint is big enough to cater for the stator current. Equally ensure referencing considerations w.r.t. IRS2184 FET driver (and Pin#3 or Pin#5 depending on if you have 8 or 14pin variant)

#2 is a bit different and is only really considered IF you are unable to regen onto the supply. You have a battery so you should be permitted to. The only complication will come from the leads that connect the battery to your Powercore.

Say you are using 32AWG, 10m worth & untwisted... This will have a lot of stray inductance & will essentially decouple your powerCore from your supply. Depending on specifics of your system (coming back to inertias and such) you may find your local capacitance is more than enough to absorb this energy with only a slight change in voltage. Worst-case however is you have a lot of energy to remove from the mechanical system & your local DClink rises significantly.

The stray inductance in your power harness now is a hindrance and your local voltage could rise to dangerous levels. In these instances IF you cannot reduce the inductance or you cannot regen, you would deploy a brake circuit which would dissipate that mechanical energy as heat in the electrical system - a waste.

A simple comparator circuit that measures the actual DClink (ie at the Hbridge NOT the 24V coming in ). A simple FET+Resistor+Freewheel dide (as the resistor will be inductive...) to then chop the DClink between the voltages of say... 35V:28V.

My gut feeling is you are susceptible to #1 (the difference in dv/dt & your present layout) but for completeness above is a quick overview of resistive regen.

• Thanks for such detailed discussion, though I must admit at some point it becomes a bit too technical for me to follow. I am using some Chinese worm gear motors that don't come with specs (other than being 24V 350W), so not too sure about Point 3 parameters, but this is a balancing scooter and I can't seem to afford slowing the decel. I will at least implement your point 1 and see how it fare. Please do have a look at my update in the Question. – Dave Nov 17 '14 at 4:20
• Nice description of the difference between power returns and ground, and the problem with mixing them. Also good mention of basic kinetics. – gsills Nov 17 '14 at 18:48
• JonRB & @Andy aka: your help has been great and is greatly appreciated! Will take a couple of weeks for me to have the new board fabricated and tested. Will report later on the result. – Dave Nov 18 '14 at 4:23

It looks to me as you have arranged the H-Bridges to enable them such that each side is driven by the inversion of the control for the other side. This inversion being supplied by the BC817 NPN transistors.

To be able to control your motors better you want to reconsider your HBridge controls some. The best situation is that you consider four controls into the bridge so that you can have four state control of the motor wires instead of just two. With four you can allow for momentary short term connection of both motor leads to GND or both to +24V. This allows for a current path wherein the bridge can basically short across the motor to support brakeing and absorption of regenerative energy from the motor.

The current design with the NPN transistor inverters is also somewhat less than optimal. A circuit like that will have a 100 to 300 nsec delay and this will cause the switch over from one direction to the other to have a short moment where the H-Bridge may not be in the state that you would like. You could determine how much of an issue this is by carefully capturing scope traces around your bridge FETs during switching time.

With H-Bridges you always want to allow for some dead time between when the upper transistor and lower transistor in each half bridge are ON. Without dead time insertion you can get cases of through current surges through the upper and lower transistors that can create huge current spikes that result in noise and possible upset of other circuits on the PCB.

Edit

I see from your comments above that you are using the IRS2184 Half Bridge driver. Taking a look at its data sheet I see that this device apparently takes care of the dead time switching of the half bridge. That is good.

• Michael, thanks for your answer. Yes you can see that your points presented in your paragraphs 2 and 3 have been taken care of by the IRS2184S half bridge driver. On the four state control, do you have a link or reference so that I can see how it is implemented? – Dave Nov 16 '14 at 3:31