Voltage controlled current source to drive analog amp meter - Page 1
Forum section: electronics / projects

author: edwindb
author_rank: Newbie
timestamp: March 10, 2021, 03:09:00 pm
content: Hello all,at this moment I am working on designing a circuit to drive an lovely old ammeter using a voltage controlled current source. I started just driving it with a Mosfet and a PWM signal, this worked ok using software calibration on the micro. However the ammeter has internal 24V lightbulbes for backlight. This creates a lot of heat making the wire of the coil hot resulting in changes in resistance. So I turned to a current controlled solution. I have a working solution using two op amps to drive a mosfet to regulate the current.The first op amp measures the voltage across the shunt resistor R13 and amplifies the signal to a voltage that can than be fed in the second op amp where a voltage setpoint is given by a DAC (MCP4725). This works except that I get some sawtooth waveform on the feedback voltage that varies in frequency depending on the source voltage (+5v). In the attached photo this is visible where channel 3 (blue) is the feedback and channel 4 (green) the setpoint.The practical problem of this oscillation is that with varying source voltage (I want to be independent of varying source voltage) the frequency changes resulting in a different voltage for a given current. I think the source for this problem lies in the fact that a ammeter is a inductor and has capacitance. What I don't know is how to solve this issue. I know the ESR of the coil is 18 Ohms. Current through the meter is 250 mA max. Is there a solution to this problem or is my approach to the problem fundamentally wrong?Thank you in advance!Edwin

author: ajb
author_rank: Super Contributor
timestamp: March 10, 2021, 04:11:13 pm
content: The inductance of the coil will certainly matter. Inductors by definition resist changes in current, and this shows up as a phase shift in the control loop, which is a major factor in control loop stability, because it causes the control loop to overshoot in one direction, then overshoot in the other, etc, hence oscillation. The conventional way to solve this is to slow the loop down by introducing a capacitively coupled feedback path. The attached schematic shows a common configuration. The 1k resistor is necessary to allow the AC coupled feedback signal to mix with the DC coupled feedback signal, and the values of the resistor and capacitor together set the frequency response. With a sufficient model of the load, you can simulate this circuit in spice to ensure stability. It may not be worth getting too deep into accurately modeling the meter movement, but since the meter movement is not capable of particularly fast motions anyway, you probably don't need to really optimize the response very much and can err on the side of a slower loop. But simulating with an inductor of similar-ish electrical characteristics will show the basic idea.I haven't watched the whole thing, but at a glance at least this appears to be a reasonable intro to simulating this sort of thing:https://www.analog.com/en/education/education-library/videos/5579254320001.htmlOnce you have a rough idea of what you need to do, a key test to perform in the real circuit is step response, where you change the set point from a low value to a high value and inspect the response. You want to see the feedback value move to match the setpoint smoothly and without too much overshoot or ringing, and normally you'd tune the circuit to make it reach the setpoint as quickly as possible without overshoot, but again, the meter is slow anyway and a slower response is fine.The amplification in your feedback path also introduces some phase shift, but this will be will be small in comparison to the phase shift from the meter movement. In a really fast loop this would be more of a concern but it should be fine here.

author: magic
author_rank: Super Contributor
timestamp: March 10, 2021, 05:59:55 pm
content: The circuit above is the usual solution to stabilizing such current regulators.You don't need two opamps, just divide the input voltage to a level compatible with the shunt resistor.

author: Kleinstein
author_rank: Super Contributor
timestamp: March 10, 2021, 06:14:53 pm
content: If the current for the meter movement is low (e.g. < 10 mA), so that the OP can drive it, one can get away without the extra FET / Transistor. Just have the meter and resistor in series at the OPs output and take the FB from the resistors. Even if the transistor is needed, it is often better to have the movement at the source / emitter and not at drain/ collector. This helps with stability.Some movements want a relatively low drive impedance to dampen the movement. So one may want a capacitor (could be 100 µF range) parallel to the meter movement. Pure current drive gives less daming to the mechanical resonance.

author: edwindb
author_rank: Newbie
timestamp: March 15, 2021, 07:20:48 pm
content: Thank you very much for all the responses, they have set me thinking and I think I have found the solution to the problem and added some extra functionality/improvements:- To counter the problem I had I added a diode across the coil, this made the problem go away instantly. I guess I underestimated the back EMF from these coils.- I also added the filtering across the op amp output going to the mosfet. This helped clean up the signal.- I did implement a voltage divided (using a trim pot) on the setpoint line but for finetuning the upper voltage to the opamp to scale with the max readout on the individual gauge (they vary alot). I didn't use a voltage divider to save a opamp as in this case I have dual opamp packages available.- I have to use a mosfet (or other power device) to regulate the gauge as it is drawing quite a bit of current at full scale (between 100 and 250 mA). The suggestion from Kleinstein did give me the idea of using not a cap but a diode across the coil. A cap made the situation worse as it already has a lot of inductance, capacitance.Attached is the revised schematic.Regards Edwin