Pages: [1] 2   Go Down
Author Topic: Strange waveform with LMD18200 H Bridge  (Read 3145 times)
0 Members and 1 Guest are viewing this topic.
UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi all,

I'm trying to get a LMD18200T H Bridge from National Semiconductor working properly - but am getting strange results. I'm trying to use the 'Simple locked anti-phase PWM' mode as described in the datasheet - tie the PWM pin high, then apply the PWM signal to the direction pin, that way 50% duty cycle should be zero drive, 0% = full reverse, 100% = full forward.

Datasheet; http://pdf1.alldatasheet.com/datasheet-pdf/view/9135/NSC/LMD18200.html

However, 50% for me is 50% in one direction, 0% is 0 drive and 100% is full speed. There is not change of direction.

Here's my schematic - the grounds are common between the Arduino and the schematic circuit.



Here's a scope shot of the PWM signal, good.



...and this is what I REALLY don't understand - these are the scope shots from each terminal of the motor.




The datasheet says logic high is 2V min, 12V max. I'm wondering if maybe the 5V logic signals are not high enough. I'm just using a pot into an ADC input, and outputting a value accordingly. Earlier on today, it seemly worked for a moment in that as a crossed 50% on the pot, the motor switched direction. Here's the very simple test code I'm using.

Code:
int potPin = 4;
int val = 0;
int pwmPin = 3;

void setup()
{
  pinMode(pwmPin, OUTPUT);
}

void loop()
{
    val = analogRead(potPin);
    analogWrite(pwmPin, val / 4);
}
« Last Edit: December 18, 2012, 10:22:30 am by jtw11 » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33314
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Your diagram is not like the one on page 10 of the data sheet. You have left the current sense floating and also not connected pins 5 & 9 high.
Logged

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Pin 5 is connected to 5v in my schematic, albiet pin 9 is not.

Earlier, I was not wearing a ground strap when I removed the chip from its package and soldered on wires to stick in the breadboard - so, I thought I'd try another chip (after I'd found my ground strap). The new chip works perfectly, while the old chip does not.

So, yes - current sense and pin 9 were floating - however, if I disconnect them and let them float now the circuit still works as expected. So does that mean a) leaving those pins floating killed the chip, or b) I zapped the chip through static?

EDIT: I now also have the same waveform on both motor pins, which is good - however, why does the waveform not replicate a 'proper' square wave, and instead has the flicks?

« Last Edit: December 18, 2012, 11:32:11 am by jtw11 » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33314
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
leaving those pins floating killed the chip
I would vote for that one. The clue was that it worked the very first time and not after.

Quote
why does the waveform not replicate a 'proper' square wave
That is the voltage across an inductive load. Instantly the voltage is applied there is an infinite impedance and so the voltage is at its highest because no current is being drawn. Then as the current starts to flow it drags the voltage down because of the internal impedance of the switches or the lack of power in the power supply ( or both ). It is normal to see waveforms like this.
Logged

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Brilliant, thanks for all your input.

I believe there's somebody who's subline under their username is something along the lines of "knowledge is proportional to the number of destroyed parts". There's another to add to the list smiley-wink
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2882
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The questions appear to have been answered, but I was wondering what the PWM
frequency is, as I cannot see any time scale anywheres?
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So does that mean a) leaving those pins floating killed the chip, or b) I zapped the chip through static?

Possibly (b), although most chips are fairly resistance to static these days. A dodgy connection to one of the bootstrap capacitors is another possibility, it would damage the chip when you use it to drive a load.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

The questions appear to have been answered, but I was wondering what the PWM
frequency is, as I cannot see any time scale anywheres?

I was using just the standard Arduino PWM function, which I think is really quite low - around the 500Hz mark I believe. (EDIT - just checked, 488Hz)

So does that mean a) leaving those pins floating killed the chip, or b) I zapped the chip through static?

Possibly (b), although most chips are fairly resistance to static these days. A dodgy connection to one of the bootstrap capacitors is another possibility, it would damage the chip when you use it to drive a load.

When you say a dodgy connection, do you mean a bootstrap cap that didn't have a brilliant connection (as this was only wired up on a breadboard), or an intermittent short from an output to a bootstrap pin?

Quote
why does the waveform not replicate a 'proper' square wave
That is the voltage across an inductive load. Instantly the voltage is applied there is an infinite impedance and so the voltage is at its highest because no current is being drawn. Then as the current starts to flow it drags the voltage down because of the internal impedance of the switches or the lack of power in the power supply ( or both ). It is normal to see waveforms like this.

The power supply I was using was set up only to supply 2A thinking back now actually, and was driving a motor that draws average 1A no load. Maybe the power supply caused a little of that droop.
« Last Edit: December 18, 2012, 02:48:50 pm by jtw11 » Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

When you say a dodgy connection, do you mean a bootstrap cap that didn't have a brilliant connection (as this was only wired up on a breadboard), or an intermittent short from an output to a bootstrap pin?

I meant a poor connection or open circuit. Without the bootstrap capacitor, the upper mosfet in that half of the H-bridge won't get enough gate drive to run on fully.

The power supply I was using was set up only to supply 2A thinking back now actually, and was driving a motor that draws average 1A no load. Maybe the power supply caused a little of that droop.

When the H-bridge changes state, power will initially flow out of the inductive load into the power supply capacitor, raising the voltage a little. Later on in the cycle power, will flow from the supply into the load again. Depending on how much dead time the chip provides, you may also see the voltage go briefly above the supply voltage (and below ground on the falling edges) by 1 diode drop.

Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2882
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Some people swear by "locked anti-phase PWM' mode", but I've never seen the point of
using it. I think your motors will make a lot of noise, and possibly run hot, with a 500 Hz
PWM frequency.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 223
Posts: 6593
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Some people swear by "locked anti-phase PWM' mode", but I've never seen the point of
using it. I think your motors will make a lot of noise, and possibly run hot, with a 500 Hz
PWM frequency.

I agree.
Logged

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11671
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some people swear by "locked anti-phase PWM' mode", but I've never seen the point of
using it. I think your motors will make a lot of noise, and possibly run hot, with a 500 Hz
PWM frequency.

Definitely, want the higher PWM frequencies with this mode, perhaps 10kHz or higher, or there will be lots of
copper losses from high AC currents.

[edit: the LMD18200 is nice and fast switching and will handle higher PWM frequencies well - I've used it as
a class D audio amplifier in fact]
« Last Edit: December 18, 2012, 05:20:01 pm by MarkT » Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Full Member
***
Karma: 5
Posts: 207
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Definitely, want the higher PWM frequencies with this mode, perhaps 10kHz or higher, or there will be lots of
copper losses from high AC currents.
Can you elaborate on this? I always thought that the higher the frequency, the worse the losses because of the skin effect. Or are you talking about something else?
Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11671
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Definitely, want the higher PWM frequencies with this mode, perhaps 10kHz or higher, or there will be lots of
copper losses from high AC currents.
Can you elaborate on this? I always thought that the higher the frequency, the worse the losses because of the skin effect. Or are you talking about something else?

Skin effect isn't worth worrying about at audio frequencies typically, but does become important from
10's kHz up with thicker wires (an example being induction hob coils).  Here we want to reduce the
copper losses from large AC currents when the motor is nominally "off" - the winding inductance will
nicely limit the (AC) current if the frequency is high enough.  With a low PWM frequency in this
mode you may well be pulling more current with the motor stationary than when its moving!!

However there will be switching losses (and iron losses) at higher frequencies so there is a compromise
frequency which is best determined by experimentation, but ought to be closer to 10kHz than 500Hz for
a small motor.  So
Logged

[ I won't respond to messages, use the forum please ]

UK
Offline Offline
God Member
*****
Karma: 1
Posts: 530
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks to all for all the input so far. I was planning on running at much faster in the final project - I'm not bothered about any hum, so 20+ kHz isn't what I was thinking. Around 10kHz is what I was aiming for.

The motor was certainly running hot during this test, the bridge was cool still however. I'm not sure I understand why this mode generates extra heat, is it not just normal PWM still?

The one thing I did notice was I couldn't actual switch the motor off at the half way point on the pot, the motor would just hum and get hot. I figured that could be fixed though with a dead band in the code, where half the control input +- a small amount would output exactly a 50% duty cycle. Or would the motor still hum?

In its application, the motor is never actually going to be off - so it's not a problem, but it looks like I need to do some more reading on the downsides of this mode,
Logged

Pages: [1] 2   Go Up
Jump to: