Go Down

### Topic: Voltage v. PWM values nonlinear, why? (Read 4795 times)previous topic - next topic

#### gravelbar

##### Sep 23, 2011, 03:49 am
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!

#### gravelbar

#1
##### Sep 23, 2011, 03:50 am
Sorry, better image here.

#### retrolefty

#2
##### Sep 23, 2011, 03:58 amLast Edit: Sep 23, 2011, 04:00 am by retrolefty Reason: 1
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?

Lefty

#### gravelbar

#3
##### Sep 23, 2011, 04:25 am

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.

#### retrolefty

#4
##### Sep 23, 2011, 04:45 am
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

#### gravelbar

#5
##### Sep 23, 2011, 05:18 am
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 :-)

#### Magician

#6
##### Sep 23, 2011, 05:38 am
Have a diode across a motor? I'd expect that current via flyback diode , probably, would create non-linearity.

#### gravelbar

#7
##### Sep 23, 2011, 03:53 pm
Yep Magician; it's a first class circuit designed by a pro (not me :-); we'll check that out, thanks.

#### dc42

#8
##### Sep 23, 2011, 06:20 pm
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.
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.

#### gravelbar

#9
##### Sep 25, 2011, 06:18 pm
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.

#### dc42

#10
##### Sep 25, 2011, 10:51 pm
I find that negative-going spike rather disturbing, and the high level of noise during 50% of the cycle is odd.
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.

#### Grumpy_Mike

#11
##### Sep 25, 2011, 11:33 pm
Quote
I'll get that schematic soon;

You need to that trace is not at all correct.

#### retrolefty

#12
##### Sep 26, 2011, 01:00 am

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

#### gravelbar

#13
##### Sep 26, 2011, 07:09 am
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!

#### dc42

#14
##### Sep 26, 2011, 08:24 amLast Edit: Sep 26, 2011, 08:26 am by dc42 Reason: 1
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.
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.

Go Up