Pages: [1] 2   Go Down
Author Topic: Voltage v. PWM values nonlinear, why?  (Read 1714 times)
0 Members and 1 Guest are viewing this topic.
Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We're driving a small 12v pump with a MOSFET circuit driven by an Arduino pwm output.

Here you see the pwm values up to 255 (flow doesn't start until around 80 or 90), and voltage read from a VOM across the output.

The flow from the pump also shows a very similar curve (pump output v. voltage is quite linear).

It seems to me that voltage out versus pwm values should be quite linear, but it's not.  Why?

thanks!
Logged

Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry, better image here.

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16513
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here you see the pwm values up to 255 (flow doesn't start until around 80 or 90), and voltage read from a VOM across the output.

 There will always be a minimum voltage required before the motor can operate to overcome friction and load. This will be dependent on the specific motor.
  
The flow from the pump also shows a very similar curve (pump output v. voltage is quite linear).

I suspect this is mostly a shortcoming of the meter being used to make the measurement. Unless it is capable of and includes circuitry/firmware to perform 'True RMS' measurement I wouldn'd put too much faith in the accuracy of your data points. A basic DVM is designed to read pure DC which a PWM signal is not. See if you can borrow someones DVM with true rms capablity and see what the data points look like with it.

It seems to me that voltage out versus pwm values should be quite linear, but it's not.  Why?

See above answer.

Lefty

« Last Edit: September 22, 2011, 09:00:06 pm by retrolefty » Logged

Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Retrolefty, I always appreciate your comments, thanks.

First, the DVM is a good one, with RMS.

Second, as I mentioned, the actual flow (we measure in ml/s) from the pump follows the curve very much the same, so it's a real distortion -- I'm pretty sure that pwm v voltage really is non linear.

And if this helps, the pumps running quite well way before flow starts, we have about three feet of vertical lift between pump and the outlet, so it has to overcome that before flow starts, and you can see water level slowly climb up the clear pipe as pwm/voltage increase.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16513
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Second, as I mentioned, the actual flow (we measure in ml/s) from the pump follows the curve very much the same, so it's a real distortion -- I'm pretty sure that pwm v voltage really is non linear.

Or could the pump performance curve account for what you are seeing? At the refinery I worked at before I retired there were machinery experts that spent a lot of time looking at 'pump curves' datasheets when sizing pumps for applications.

Lefty

Logged

Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Indeed pumping is hideously complicated, but in this case I am *sure* that the voltage v. pump output curve is very close to linear; we have done much work on that aspect.  In this case we have a very simple, low pressure system that has a pretty flat response (in your refinery the pumps were operating under much higher/varied pressure probably and that creates more complexity and non-linearity.)

Part of why I ask is that we're developing a digital flowmeter, and having to use complex (sometimes third order poly) equations to describe curves in software is a real pain.  Linear much easier, especially when you throw in real-time feedback and calibration, which we are.

I will scope the pwm tomorrow, I suspect the square wave is changing shape as pwm values go up or that the MOSFET response is somehow changing with increase in pwm (and those things are beyond my understanding :-)
Logged

Montreal
Offline Offline
Edison Member
*
Karma: 23
Posts: 2486
Per aspera ad astra.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Have a diode across a motor? I'd expect that current via flyback diode , probably, would create non-linearity.
Logged

Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yep Magician; it's a first class circuit designed by a pro (not me :-); we'll check that out, thanks.
Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

What sort of mosfet is it, and how are you driving it? Please provide a schematic, with part numbers for the mosfet and diode, and any other active components.
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.

Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'll get that schematic soon; here's the scope trace in meantime; pretty much what I expected, and keeps this shape through all duty cycles.

Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

I find that negative-going spike rather disturbing, and the high level of noise during 50% of the cycle is odd.
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.

Manchester (England England)
Online Online
Brattain Member
*****
Karma: 508
Posts: 31411
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I'll get that schematic soon;

You need to that trace is not at all correct.
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16513
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I find that negative-going spike rather disturbing, and the high level of noise during 50% of the cycle is odd.

The negative going spike looks like what I would expect to see with an inductive load without a reversed biased diode across the winding. Do you have such a diode in place?

Lefty

Logged

Carbondale Illinois
Offline Offline
Full Member
***
Karma: 1
Posts: 104
Making digital rivers.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Grumpy Mike has warned me the scope lies about things like this.  This trace looks very much like others I've seen on this scope of similar circuits.   The only perfect square waves I've seen come from Critical Velocity PWM controllers.

Here's the circuit.  MPWM_D3 is pin 3 on the Arduino.

I think that MOSFET has its own flyback diode, but I don't see that on the datasheet, and there isn't one in the circuit; the MSENSE conection is unused.

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

Thanks!


Logged

United Kingdom
Offline Offline
Tesla Member
***
Karma: 220
Posts: 6587
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

I can see two things wrong with that circuit:

1. No flyback diode across the motor. The mosfet will be avalanching to absorb the energy stored in the motor when the mosfet turns off. Although that mosfet is avalanche rated, you are probably exceeding its repetitive avalanche rating, and this is likely to lead cause the mosfet to fail after a while. The diode in the mosfet does not help in this instance. The lack of a flyback diode probably explains some of the non-linearity, because the stored energy in the motor induictance is being wasted, except when the PWM is 100%.

2. The mosfet isn't a logic-level one, so unless the current taken by the pump is small (less than about 1A), the mosfet won't be turning fully on. You can get a logic level mosfet such as the STP40NF10L (and several others) that is pin-compatible with the IRF540.

I strongly recommend you correct both of these. I also recommend connecting a large capacitor (say 1000uF) between the line marked +12v where it feeds the motor and the ground connection at the bottom of R4. I would reduce R1 to 150 ohms to help the mosfet switch quickly.

It would be a little easier to understand the trace if you used the scope to show the voltage from the mosfet drain to ground, rather than the voltage across the motor, which is what I think you did.
« Last Edit: September 26, 2011, 01:26:06 am by dc42 » 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.

Pages: [1] 2   Go Up
Jump to: