3
\$\begingroup\$

I have a car seat motor that I am driving via PWM and am aiming to measure its position by counting the minor variations in voltage across a current sensing resistor attached to the low side of a FET as the motor rotates. At higher duties the Vpp is significantly less (30mV) than those at 25% duty (4.7V). I currently tap the signal for measuring by a microcontroller ADC at two different gain stages to handle this, but desire to make this all happen in one stage with a variable gain circuit so only 1 ADC is needed.

Before I go into what I've attempted I want to state my primary question. How do I dynamically adjust the gain of my waveform to output a signal at a constant Vpp when my input Vpp ranges from 30mV to 4.7V?

I use a TI LMV344 op amp with rails on 0V and 5V. The motors are 12V.

Currently the circuit flow is:

  1. Sensing Resistor Output
  2. Diode voltage clamp to remove DC bias
  3. High gain, non-inverting LPF op amp. Filters out 20kHz PWM signal
  4. Diode clamp to reduce bias. I now know that I can put a capacitor between the resistor an ground on the gain portion of the above LPF
  5. Sallen-Key LPF to further reduce 20kHz PWM signal. Low gain. This is where I tap for low duty signals as any more gain causes the lowest of duties to cause the current signal to saturate the op amp.
  6. Diode clamp to reduce DC bias.
  7. Another Sallen-Key LPF identical to the above filter, no tap. I really wanted to filter out that noise.
  8. High gain, non-inverting LPF op-amp. Higher duty signals are tapped here.

The problem that I have run into is that at the highest duty, the Vpp output is low enough that its sometimes hard to make out pulses. At the cross-over duty, around 60%, the Vpp on the high duty side is saturating and the Vpp on the low duty side is too small.

My current attempt to solve this issue is to use the PWM signal used to drive the motor as a means of adjusting gain on a separate gain only amp. The gain is set to put the high duty signal at the desired Vpp. As the duty increases and inverted copy of the duty is filtered into an analog signal (represented by V3) and fed through a voltage follower connected to the inverting pin on the amp with the gain stage. But when I do this, the DC outputted in step 5 causes the signal to saturate at the op amp's upper rail when low duties are used. If I put a diode clamp between the signal from step 5 and the gain only amp, I can control the gain as I had hoped. When I put a capacitor between the gain resistor attached to ground and ground to reduce DC gain to unity and eliminate the need for the diode clamp, the gain is no longer controlled and the DC gain isn't unity. The diode clamp needs to be replaced since the various Vpp values need different offsets so they won't saturate.

Here's that last paragraph as a schematic. The op-amps are LMV344 op-amps, not LMV324 as the illustration suggests. The input signal has a Vpp from 30mV to 4.7V depending on the motor duty.

schematic

simulate this circuit – Schematic created using CircuitLab

And here are two examples of the input signal. THe first is the current draw waveform at 100% duty and the second is the current draw at 25% duty. Waveform of current draw at 100% dutyWaveform of current draw at 25% duty

How can I get a variable gain circuit, amplify signals with Vpp between 30mV and 4.7V to around 4.7V, while avoiding saturation due to input DC levels? Thank you in advance. This has consumed me for the past month.

\$\endgroup\$
3
  • \$\begingroup\$ (1) Have you got any scope shots? (2) What in the motor causes these pulses? It seems a difficult choice of position tracking. \$\endgroup\$
    – Transistor
    Sep 1, 2016 at 5:38
  • \$\begingroup\$ Scope shots have been added. I believe that the pulses are from the commutator rotating and switching between brushes. Yes, this is a difficult way of tracking, but I have to stay with how this system's motors are currently tracked. I wish it used hall effect sensors. \$\endgroup\$
    – user122407
    Sep 1, 2016 at 13:21
  • \$\begingroup\$ Those two scope shots imply to me that a simple fast comparator would work so, show a scope shot of where you believe the problem waveform occurs. \$\endgroup\$
    – Andy aka
    Sep 1, 2016 at 17:35

1 Answer 1

1
\$\begingroup\$

One issue is that the filters to get rid of the PWM may be attenuating the signal you want to measure, so I would suggest a notch filter to get rid of much of the PWM signal.

The Fliege notch filter is a versatile and somewhat forgiving filter, and I have run one up for the 20kHz:

20kHz notch

It has this simulated response:

Notch response

The notch depth is -55dB here, although I would expect -40dB as a more realistic response with real devices and layout. The bandwidth between the -3dB points is about 2kHz.

As this filter is unity gain at DC, it would be simple to introduce a DC offset to run on single supply.

Note that R7 is only present to enable the simulation to converge, and the notch depth is proportional to the ratio \$ \frac {C_0} {R_0} \$

You could then use a high pass filter to attenuate any harmonics of the PWM drive signal which may simplify the rest of the signal chain.

\$\endgroup\$
1
  • \$\begingroup\$ The signal that I care about is between 300 Hz and 500 Hz. The filter portion of the circuit has an +8db gain at 300 Hz, +6dB gain at 500Hz, and -50dB gain at 20kHz. It drops below unity gain around 815Hz. I don't believe that my filters are attenuating the part of the signal I need. Thanks. \$\endgroup\$
    – user122407
    Sep 1, 2016 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.