Is there a way I can generate 0 to 50mV for a meter (dc most likely) from an Arduino Mega?? Any thoughts would be appreciated.
I need two of the sources. so the cheaper the better.
~~Cris
Be sure to click 'more' and select 'suggest as answer'!
If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!
Is there a way I can generate 0 to 50mV for a meter (dc most likely) from an Arduino Mega?? Any thoughts would be appreciated.
I need two of the sources. so the cheaper the better.
~~Cris
The analogWrite instruction uses PWM and a resistor and capacitor on the pin to generate an analog voltage:
https://www.instructables.com/Arduino-RC-Circuit-PWM-to-analog-DC/
The Mega can have 14 PWM pins, each with a different PWM output.
If you want better resolution, you could divide the max 5 V output with a resistor divider. Say a 10K and a 100 ohm, gets pretty close to 50 mV.
The analogWrite instruction uses PWM and a resistor and capacitor on the pin to generate an analog voltage:
https://www.instructables.com/Arduino-RC-Circuit-PWM-to-analog-DC/
The Mega can have 14 PWM pins, each with a different PWM output.
If you want better resolution, you could divide the max 5 V output with a resistor divider. Say a 10K and a 100 ohm, gets pretty close to 50 mV.
The capacitor value may not be ideal.
The time constant of the RC filter is 10us as drawn.
With a PWM frequency of 64kHz (about as fast as an Arduino can go) this will make a lot of ripple.
The ripple is at 64kHz and may not matter. But if it does then increas the value of R1 and R2 by a factor of 10 or more (the limit is the source impedance you can cope with).
Or increase C1.
The lmit of the max RC that is tolerable will depoend on the response time you need. With these values it's less than 100us which is probably much too fast.
With C1 = 10uF the response time will be less than 10ms and the ripple down to 0.3mV pk-pk (about 1.2%).
MK
Good point Michael. I didn't calculate the ripple. While an analog meter is a type of filter, getting the ripple down is as easy as picking a better cap.
I had missed that the load is a meter - and from what we know of phoenixcomm work it will likely be a moving coil device.
In which case the ripple probably won't matter very much.
MK