Main Site Documentation

Drive Analog Panel Meter with PWM from Panda II


#1

I’m seeking some design assistance with a project involving a Panda II and an analog panel meter. In fact, it is this meter: http://www.sparkfun.com/products/10285.

My goal is to be able to drive the position of the meter using the PWM output. The accuracy is not critical, but (ideally) a PWM duty cycle of 0% should result in the meter being at it’s resting position (or very close) and a PWM duty cycle of 100% should be at the full-scale deflection position (or very close).

Since the PWM output is 3.3v and full-scale deflection on the meter is at 5v, I need to bump up the voltage. For that, my plan is to switch the 5v rail coming off the Panda II board to the meters using a NPN transistor (like a 2N2222) in the way you would expect (PWM output to base through a small resistor of 470 ohms, emitter to ground, meter between 5v rail and collector).

The meter reportedly draws 0.75mA at 5v.

Some questions about this plan:

  1. I assume that varying the duty cycle between 0% and 100% will linearly position the meter. That is, at 10%, I would expect the voltage to be 0.5v, at 20% the voltage will be 1.0v, etc. Is this correct?

  2. I assume that if the PWM frequency is around, say, 500Hz, the physics of the meter will effectively smooth the signal-- I don’t need to add any capacitors to keep the meter from visibly wigging. Is this correct?

  3. I assume that because the meter is effectively a coil around a magnet, that it presents an inductive load to the transistor. It’s probably very small, but because of this, I imagine I need to protect the transistor with a small diode. Is this correct?

I’m an experienced software engineer and comfortable with digital electronics. I’m less comfortable with the analog side of things and would appreciate any insights.


#2

Why not use the analog output pin?


#3

idd, use analog output pin with an OPAMP and trimmer potentiometer to adjust the gain.

If you don’t have analog out or you want to use a PWM, I would also connect the above circuit, but first create a DC voltage from the PWM with a series resistor and a parallel cap. Then feed that DC voltage to the OPAMP.

When you select an OPAMP, make sure it can set it’s output very close the V+ rail as you will probably want to feed it from a 5V source.


#4

I am driving six meters from the six PWM outputs. I am using the analog output for another purpose.

I appreciate offering other solutions, but I was specific for a reason.


#5

Thanks for the suggestion of using an op-amp. If I cared about accuracy, I might consider it, but given the inherent inaccuracy of these meters, I would think a simple transistor as I described would be a more minimal solution.


#6

With a transistor you loose 0,6 V of your full scale. I would use an n- channel fet instead. And put a reversed diode in parallel with the coil of the meter.


#7

Sounds like a cool project!

I’d use a ULN2803 as the buffer. It has the protection diodes built in and is cheap. At 500mA total it should handle 8 meters at 40mA each easily.

I think the darlingtons have a lower voltage drop too so you should get your full scale deflection. If not, drive from 6v or 12v and scale your pwm in software.