Low Pass Filter Usage After Motor Driver Card?

Hi, i am now trying to drive a solenoid using PWM by this driver(Semiconductor Bts7960b Stepper Motor Driver 43a H-bridge Drive PWM for Arduino for sale online | eBay). I have some results but when i get the voltage values, i think there is some noise in values. After some research, there is sth called low pass filter smoothing frequency curve. Can i use this filter after motor driver (serial connection or which way is suitable) Does it make sense to use?

Info about project and materials: Solenoid is 24VDC, Controller is Arduino UNO. I change pwm signals dynamically so change the voltage value. So i can get a proportional spool position

I would reaaly appreciate, If somebody can help.

Best regards.

I don't think PWM is the right approach for a solenoid. It doesn't make sense. PWM is used for motor speed control. A motor is a rotating mechanical device. A solenoid is a plunger that moves back and forth (on or off). There is no need for speed control for a solenoid because it is not a rotating mechanical device. Why are you using a motor speed control for something that should be controlled with a relay or mosfet ?

There are issues with driving a solenoid with PWM.

  1. The solenoid probably has a soft iron plunger. This is not laminated silicon steel
    as used in motors and transformers and will have large eddy-current losses. This
    means much of your power from a PWM driver could end up directly heating the
    plunger (rather than just the coil), which can lead to thermal issues. However using
    a high enough PWM frequency will reduce these losses as the current ripple will be less.

  2. You are using a single switching device so will not necessariy get a linear response.
    A half-H-bridge in antiphase mode is needed for proper linearity (current proportional
    to duty cycle), but using a high enough PWM frequency should make this unnecessary.

So long as the current doesn't fall to zero during the PWM cycle things will behave
reasonably - note this means the free wheel diode will be conducting a lot of the time
and must be rated for continuous current, not peak.

  1. Measuring a PWM voltage isn't meaningful unless you low-pass filter - but you
    only low pass filter the voltage you sample to be read by analogRead. If you
    try to low-pass filter the voltage to the coil itself you'll end up wasting massive amounts
    of power compared to what the solenoid uses.

Judging what is a high enough PWM frequency takes an oscilloscope ideally, but you can
just try it, and if there are problems try doubling the frequency until it behaves better.

The ideal RC values for a low-pass filter also depend on the frequency, note - you want
a timeconstant much longer than the PWM period. time constant = R x C (measured
in seconds, ohms and farads respectively)

Why are you trying to use speed control on a solenoid ? (which is not a rotating mechanical device like a motor)

@Raschemmel - there are MANY commercially available Solenoid Drivers that use PWM to control the position of the spool. Take a Hydraulic valve for instance. How do you suppose one varies the flow in a hydraulic circuit? It's done with PWM and generally uses an LVDT attached to the solenoid spool so you have position feedback. PWM is not just used to control motors! What about if I have a heating element and I want to control temperature? ( I wouldn't use a DC circuit but it would work).

I know PWM is used for heaters. I am not familiar with PWM controlled valves.
A quick google search revealed this:
http://www.ti.com/lit/ds/sbvs009b/sbvs009b.pdf
and this:
http://www.axiomatic.com/pwm-proportional-driver.pdf

and this:

So now that you have explained the use of PWM with a solenoid, can you explain the OP's question about the:

Low Pass Filter Usage After Motor Driver Card?

After some research, there is sth called low pass filter smoothing frequency curve. Can i use this filter after motor driver (serial connection or which way is suitable) Does it make sense to use?

It sounds like the OP wants to filter the PWM before the solenoid. A low pass filter could completely convert the PWM to an analog value (I've done it myself many times with the arduino PWM using a 4.7 k ohm resistor and a 1uF to 2.2uF cap. Those values wouldn't work on the output of driver circuit (I don't want to call it a motor driver since a simple mosfet should do. He doesn't need to reverse directions does he ?)
?
Where does the LP filter fit into this scheme ? If he drives a mosfet with PWM from the arduino, why does he need an LP filter ?

The reason I didn't reply to the OP regarding the low-pass is I think it's silly. You have a huge inductor sitting there already, so all you have to do is increase the PWM frequency. The inductor is the lowpass!

I had a feeling you were going to say that. It's the same answer other posters have gotten to the same question about putting a LP filter on a PWM motor driver circuit output.

Hey Guys,

I really appreciate your valuable information and comments. The reason why i think pwm control, is many hydraulic proportional valves can be controlled by pwm. When you increase or decrease frequency, position of spool changes. So hydraulic flow may be increased or decreased depends on needs. That is what i think, i wish to do. Purpose of measuring voltage gives me clues about the function of system. I think (if i am right,) when i measure 24 v that means i give %100 duty cycle, if i measure approx 12 V that means i give %50 duty cycle. I also tried this on a on-off type solenoid, pwm seems working but, since valve is not a proportional type, mid values either open valve or shuts the valve. this is because ,i think, spring behind the spool is very tough and does not allow spool position stands in mid values of extremities.

my intention to use low pass filter before solenoid, maybe it smooths the frequency values, than i can get a proper ramp function and solenoid behavior.

That is my way of thinking, maybe i am wrong?

(Note: i dont need to reverse the solenoid. Only one way. I know i can use a small mosfet but this product seems for me a heavy duty device that can stand up to 43A. This is only for safety).

rmetzner49:
The reason I didn't reply to the OP regarding the low-pass is I think it's silly. You have a huge inductor sitting there already, so all you have to do is increase the PWM frequency. The inductor is the lowpass!

After you say, i am thinking as you, also valve manufactures say, as far as i understand, some dither is good for valve efficiency and this small movements caused by pwm drive will create a dither also.

By the way as you understand, i am not an expert, so i will try this in a real proportional valve. The reason that i ask is before buying a 400 EUR valve , learning as much as i can.

Thank you again. More suggestions would be appreciated.

Best Regards.

No, the PWM is not the dither.

Inductors resist change in current. The magnetic force from the solenoid
depends on the current. The voltage is irrelevant other than it causes the
current to change.

With a sufficient PWM frequency the current ripple will be small compared
to the current. This is where you want to be.

For valves there is a lot of frictional hysteresis to overcome, so you normally
modulate (at say 10 Hz or lower) a varying duty cycle to the PWM - this just
compensates for friction, and typically is adjusted to suit the actual valve.
Its simply a hack to make up for the lack of closed-loop control in the absence
of an encoder/LVDT. Humans use the same technique when driving a vehicle
with slack in the steering (such as a boat).

Its not technically a dither, since its not random.

my intention to use low pass filter before solenoid, maybe it smooths the frequency values, than i can get a proper ramp function and solenoid behavior.

Purpose of measuring voltage gives me clues about the function of system. I think (if i am right,) when i measure 24 v that means i give %100 duty cycle, if i measure approx 12 V that means i give %50 duty cycle.

The first comment of yours above indicates where you want to put the LP filter.
The second comment indicates you want to implement a form of feedback by measuring the voltage.
Please confirm that you have two project objectives and not one.

Dither

Now I understand why the question of a Low-Pass. You want to be able to measure the average voltage applied to the coil, and read this voltage back with the Arduino, where the Arduino is also doing the PWM.

If I remember correctly, the PWM function runs at about 400Hz. You can do filtering in software by averaging several readings. If it was I doing this project, I would put a 1-stage op-amp circuit ahead of the Arduino that is built as a 2-pole lowpass. I would set the cutoff frequency at 20hz. You will need to scale the resistors appropriately to stay under 5V at the op-amp output. Be sure to use an op amp that includes the supply rails such as the LM6132.

After some research, there is sth called low pass filter smoothing frequency curve.

If it was I doing this project, I would put a 1-stage op-amp circuit ahead of the Arduino that is built as a 2-pole lowpass. I would set the cutoff frequency at 20hz.

http://www.electronics-tutorials.ws/filter/second-order-filters.html

Let R=1000 ohms,
fc= 20 hz
C1 =0.0011252254476597002 (INCORRECT because I entered "10000" instead of "10") (correct value= 1.1252254476597 uF)
C2 =0.000562692301301396 (INCORRECT because I entered "10000" instead of "10") (correct value= 0.5626923013013959) uF)
http://www.wa4dsy.com/robot/active-filter-calc

The problem with just sensing the average voltage is that it doesn't tell you anything
useful, since (in the normal regime) its just dependent on the PWM duty cycle.

You could sense the current, but that's only a witness for the force (minus any friction),
and is again strongly related to the duty cycle, and not the load. And its worse than
that, because the current controls the magnetomotive force (MMF), whereas the physical
force depends on that and the magnetic circuit's reluctance (ie the position of
the plunger) There is no guarantee of even a one-to-one mapping between MMF and
physical force (even before friction).

If you want to sense the position you'll have to sense the position itself, it cannot be
inferred from any electronic signal.

@Raschemmel: Those filter values you supplied are about a factor of 1000 off! Try using a proven program such as TI's Filter Pro. It comes up with resistors of 10K and capacitors of 1.0uF and 1.33uF respectively.

Even at first glance, I could tell they were wrong. There's no way a .001uF and 1K resistor gives you anything close to 20Hz.

Thanks for catching that error. I confess I was lazy and didn't crunch the numbers manually like I ussually do. I was busy and I should
have taken the time to do it.

@Metzner49,
Ok, I finally got around to calculating the values for the 2-pole low pass filter using the design from :

and these are the values I got:
Let R = 10 k ohm = R1 =R2
Let fc = 20 hz
SQRT(2) 1.414213
C2 = -------------------------- = ---------------- = 0.562 uF (0.000000562)
[4*( Pi)*( R)( fc)] (0.0706230)

SQRT(2) 1.414213
fc = ------------------------------ = -------------------------------------------- = 20.0248 Hz
[4*( Pi)*( R)( C2)] (0.07062300285269855200064022325612)

R= R1 = R2 = 10 k ohm
C2= 0.562 uF
C1 = 2 * C2 = 1.13 uF

Our results are close but different . I have no explanation. I checked the numbers twice and did a proof using the calculated C2
value and got 20 Hz.

If you take the time to review TI's Filter Pro and do a design with it, you can see that by tweaking the values you can obtain different damping and Q factors. Damping is expressed by type of filter (Butterworth, Chebyschev or Bessel). There are also different topologies such as Multiple Feedback and Sallen-Key. I don't recall what I had that parameter set to when I ran the calculation. I just took one look at YOUR previous numbers and found them to be way off.

I already admitted my first calculations were way off.

I linked the design for my calculations . If you have found an error, then show me your calculations that prove I'm wrong.
I don't doubt Filter Pro is very helpful, but that has nothing to do with my calculations for the design I linked. Without presenting your calculations that show I made an error your claim that my numbers were way off has no merit.Now I'm talking about my calculations in my last post (Reply#16).

The calculations for the circuit values are very straightforward for the Butterworth response and unity gain scenario. Critical damping is required for the circuit and the ratio of the resistor and capacitor values determines this.

Here are the equations given.
Let fc= 20 Hz
R = 10 k ohms

Let's see how your calculations differ from those presented in Reply#16

I downloaded Filter Pro but I need time to learn how to use it.
Thanks for the recommendation.

op-amp-two-pole-active-low-pass-filter-equations.gif

I never said you had an error in your #16 calculations I merely stated the TI program may have other considerations for arriving at its values. I have no desire to reverse-engineer the TI program but it obviously sticks in your craw that I could come up with a reason for the difference. Could it be BOTH solutions are correct? That one offers different damping and phase characteristics than the other? Filter Pro has been around for decades, I started using an earlier version before TI even acquired Burr-Brown. Burr-Brown wrote the book on Filter Design showing you how to arrive at the different named characteristics.

Since the Active Filter Design discussion hijacks the OP's thread anyway, I'm not going to debate this topic further, especially with someone who is compelled to always have the "last word". Now you want to hijack it further by analyzing Filter Pro?