AVR and H-Bridge erratic behaviour

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Dear all,

 

In current circuit the ATmege-328p is interfaced with the MOSFET H-Bridge (schematic below). The code just runs a simple routine to test the bridge, that is, turns on or off both sides.

Since the first test, it did not function, sometimes it would behave erratic way, when I put my finger close to (M5, or M6) MOSFET it would then start to function, when I take away my finger, couple of seconds later it would stop again.

If I remove the control wires which are used to energize the H-Bridge  and hold it with bare hands, the circuit will start function, as soon as I connect them back to AVR everything stops.

Has anyone come across this kind of issue, if so an advise on resolving this floating behavior would be very appreciated. 

 

 

program is working......

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 3

You need to connect the 0V from the AVR to your h-bridge. Electrons like to flow in a loop.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

5 * for Kartman.

Show us your whole schematic.

 

Also: Your Power Fet's in TO220 go upto 100V and 10A.

What is your motor voltage and current?

 

If your Motor Vcc is higher than the sum of the threshold voltages of M1 & M2 then both these fets will be on during switching. Combined with the slow switching of only a 1k series resistor on the MOSfet Gates this may well be a recipie for disaster (Or at least smoking FET's). When both these FET's are on at the same time they short your power supply. This is called "shoot through".

Have a look at for example the datasheet of the IR2104.

This MOSfet driver controlls 2 FET's of a Half Bridge, and it also makes sure that there is always a delay of 520ns between turning one FET off, and the other on.

 

Do you have an Oscilloscope to measure check & troubleshoot such things?

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

If i understood you correctly. mates I think the guy here also have a problem with the control flow of the program:

 

So lets start with the question, Do you know what to do to turn the motor forward and backward, in other words, do you know which MOSFETS to turn on to move fw, and which to turn bw ? break, stop...etc

 

regards,

Moe

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Moe123 wrote:

If i understood you correctly. mates I think the guy here also have a problem with the control flow of the program:

 

So lets start with the question, Do you know what to do to turn the motor forward and backward, in other words, do you know which MOSFETS to turn on to move fw, and which to turn bw ? break, stop...etc

 

regards,

Moe

 

I also see some pull-up resistors on the PMOS but where are you pull-down on NMOS ?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The motor nominal voltage = 6 Volts DC, working range = 4,5 -12 V DC.

The motor current draw while idling =  1.15 Amps.

 

I do have an oscilloscope.

 

The H-Bridge two outputs (left/right) are connected to AVR's PD5/PD6 GPIO. The power supply for the AVR and circuitry is the same, so Vcc of the AVR is one with the Vcc of the H-Bridge and is 5 VOLTS, same holds for the Ground plane.

With this setup, when the PD5 is logic high and the PD6 is logic low, and vice versa, the  motor does not run. Even if I plug an LED it does not light up with either polarity. If I remove the wires attached to PD5 and PD6 on AVR and hold one wire in my hand and let go another wire, the motor runs. If I hold the both wires in my hand the motor stops.

 

 

 

program is working......

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You’ve not shown that AVCC is connected on the AVR. Itmust be connected!

Running the avr from the same supply as the motor has some challenges. I’d suggest a separate regulator for it and capacitors for supply bypassing. The peak current draw from the motor and transients will upset the avr otherwise.
At your current level,why not use an integrated h bridge chip rather than your poor circuit?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I decided to run the 2 x DC motors with dual H-Bridge on separate higher voltage power supply rail. So Currently the AVR runs through the USB power provided form my PC, and the motors with dual H - Bridges are running via bench power supply.

Could you please have a look at the schematics if this would be a proper way to utilize those parts. Regarding the ready IC you mentioned like L 298N, It has current limit of 2.0 Amps, in my case the hole setup draws a little more than that, so I decided to build this one.

I would like to make it proper running bridge control with later PWM. So would be very helpful to get some constructive critics on current one.

 

program is working......

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your deutschlander friends at Infineon have a selection of h bridge parts. Some with even a microcontroller built in. I was being constructive calling your circuit poor - no current limit, no protection, bad drive of the mosfets, the list goes on. Integrated h bridges give you so much more. If you want to run pwm, then you'll have to drive the gates faster. There's chips to do that, but you might as well get the whole kit n kaboodle with a h bridge chip.

 

As well, you'll need to pay attention to your power wiring, especially the 0V so that you avoid voltage drops affecting the logic signals.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

actually I am not German ^_^. But I looked at the Infineon IC's and I am impressed, quite advanced stuff in comparison to L298D. Could you please provide a source of building not poor H-Bridge. That I can learn from.

Regarding the power wiring, it means that I need various caps to avoid the voltage drops? i don't understand the part with 0V you mentioned.

program is working......

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

But Infineon are German! I made no statement of your nationality!

 

 

Infineon/International Rectifier have many app notes on the care and feeding of mosfets.  The most obvious problem in your circuit is the gate drive. Mosfet gates are effectively a capacitor. So your 1k resistor and the capacitance from two mosfets for a RC time constant. This means your mosfets are not switched fast or cleanly. The faster you want them to switch, the greater the switching losses will be causing meltdown. The solution here is to actively source and sink current to the mosfet gates. You can do this with transistors or there are plenty of gate driver ics as it is a common issue to be solved. Something like an IR2110 comes to mind. As others have mentioned is ensuring the top and bottom mosfets don't conduct at the same time. Your circuit due to the RC time constant won't guarantee that it won't happen - it will more like guarantee it will happen!

 

DC motors draw peak current when stalled. This may cause the mosfets to overheat and/or fail and as well, the motor can burn out. So you want some protection here to ensure if something does go wrong, it is handled. Having an overload signal sent back to the microcontroller means the software can implement a strategy to protect the motor and handle the error gracefully.

 

Regarding wiring - every wire has finite resistance, thus when you pass current through it you get a voltage drop. Ohms law 101. What happens if you get a voltage drop in the 0V between your h bridge and the microcontroller? What the 2n7000 gate sees is not what the micro is producing. You need to understand where the current flows and design your wiring such that the high current paths don't affect the low current ones.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You might consider using an ATtiny861 or tiny85 and driving your fet gates separately and take advantage of the deadtime generator on timer1 to prevent flow through on your bridge.

 

Click Link: Get Free Stock: Retire early! PM for strategy

share.robinhood.com/jamesc3274

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Such a bunch of discrete components are great as a learning experience, but not ver cost / time effective if you just want to drive some motor and be done with it.

 

Kartman wrote:
The most obvious problem in your circuit is the gate drive...
Yes, but not only for the problem stated. It looks very much like the top and bottom fet will conduct at the same time which will cause large shoot through currents.

 

For hobby level motor control it is nice to be able to buy some ready made breakout boards.

DRV8871 is a magic word and seems to fit your needs perfectly.

It is not from Infineon, but from TI:

http://www.ti.com/lit/ds/symlink/drv8871.pdf

http://www.aliexpress.com/wholesale?SearchText=drv8871

 

Also did a small search by Watterott for motor drivers:

https://www.watterott.com/index.php?page=search&keywords=motor+driver&cat=&mnf=&x=0&y=0

Most hits seem to be for stepper motor drivers, but some, such as for example MC33926 might be interesting for you.

Is that an Infineon part? (Haven't looked at the datasheet, only Watterott's description).

 

If you are planning on using more than a few, and want to design your own PCB, then go directly to the manufacturers of those chips, and select a chip that fits your needs, and then build your PCB with it.

Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756

Bunch of old projects with AVR's: http://www.hoevendesign.com