Control analog meter with microcontroller

Discussion in 'Embedded Systems and Microcontrollers' started by andy.wpg, Dec 21, 2013.

  1. andy.wpg

    Thread Starter New Member

    Jun 15, 2013
    4
    0
    I've seen projects where a couple of analog meters are used to display the time. The meter markings are redone and its a cool looking workshop clock.

    I have searched and searched here and generally on the internet and can't seem to find anything about how to control the voltage to a panel meter with a microcontroller.

    One idea I came up with was to use a digital potentiometer as part of a voltage divider - control the pot and you control the voltage the meter sees.

    The other idea I had was using PWM, but I'm not sure how an analog meter would react to, say, a 1Khz pulse slamming it - or whether it would react at all!

    Anyone have any ideas on how this is generally done?

    Thanks,

    Andy
     
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
  3. JohnInTX

    Moderator

    Jun 26, 2012
    2,339
    1,020
    I've used analog meters as quick indicators for both DAC and PWM out circuits using PICs. They work well.
     
  4. andy.wpg

    Thread Starter New Member

    Jun 15, 2013
    4
    0
    Thanks guys! Looks like I'll have to do a little playing with PWM.
     
  5. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    PWM works fine, just put a resistor (or trimpot) between the digital PWM pin and the meter, so that the meter reads full scale when pwm is 100%. You can also put a cap across the meter, so it is getting smooth DC not pulses.
     
  6. andy.wpg

    Thread Starter New Member

    Jun 15, 2013
    4
    0
    I'll do a trimpot


    What are we talking here? .1uf ceramic? Or an electrolytic of a few uf or so?

    Thanks for the help!
     
  7. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    That would be my last choice: trim pots wander. Fixed resistors tend to stay, well, fixed. Just get close, the meter can tolerate a small over voltage so aim close to there.

    The closer you get to full scale = 100% PM the better control you have, but leave a few % in your pocket anyway for (if nothing else) power supply tolerance.

    Small. I'd use zero and let the mechanical inertial of the meter do the averaging. That means finding a PWM rate high enough to be imperceptible. Otherwise a cap may slow the response as it has to charge and discharge to approach new settings.
     
  8. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    I would use a fixed resistor and a trimpot, if you are looking for the best of all options. The fixed resistor makes up maybe 90% of the resistance and the trimpot makes the last 10% of the series resistance when it is turned near the middle. That gives ease of calibration (less sensitivity).

    I disagree with ErnieM's point about trimpots having low reliability. A decent brand trimpot that has not been abused should be very reliable. I prefer the plastic box type, not the cheap open frame type.

    Re the cap there's no reason not to use a largish value cap of at least a couple of uF. Assuming a series resistor of a few thousand ohms the time constant is still quite short, in the order of a handful of mS to go from 0 to 100%.

    But the cap will still smooth the PWM current pulses to a smooth average DC current, much better for a delicate moving coil meter.
     
Loading...