- I am working on a simple DVM so I can easily see control voltages without having to crack out my Fluke DVM or Siglent Scope.
- This Arduino based DVM that can read positive and negative voltages relative to ground without having to flip switches or whatever.
- Works with a +/- 15V linear power supply
- Input is buffered so nothing "upstream" can detect it's being detected.
- Able to read from -10V to +10V DC--with as small an error factor as possible--within say 100mV tops--less is preferred.
- Have the readout be on a TFT display that's mounted on a 2 or 3u FracRack panel so I can put that into a rack.
- Extra credit: be able to get P/P AC read as RMS voltage.
- But for phase I, stick to DC.
The first takeaway from the research: lots of folks are building various voltmeters out of Arduinos, but right away you start to see that their accuracy of most basic designs isn't going to be that good.
One problem: by default the Arduino uses 5V derived from USB to suss out the voltages present at the analog pins, which can be dodgy; when I used USB, my internal ADC readings were inaccurate to over 500mV either way--unacceptable.
Another problem: We need to read negative voltages relative to ground, and the Arduino's analog pins will to clamp unwanted current flow through a diode to flush 'em down the electron toilet, but if you put too much current going the wrong way into the diode, you blow up the Arduino. So we have to protect against that.
Question: there are "shields" and add on board doodads whose sole purpose is to read currents, and can display voltages and power to boot (an aside: how frigging cool is that??? Remember when this stuff was really hard to do?).
Can I just use one of those?
One of the cool little boards is based on TI's INA219, here's a Great Scott Vid about that add-on--I really like Great Scott. love that accent! But INA219 based ADC's don't seem to deal with negative voltages very well (e.g., Great Scott's vid is positive V read only, right?) and doesn't seem to have any sort of built in clamping circuitry. So as cool as the INA219 idea is, I didn't think it'd work here.
OK next I was looking at setting a DC offset at input to 7.5V above ground so everything coming in is positive, then use an INA219, and then code around that....but then we start coming up against rail to rail voltage limitations on the op amp and my +/- 15V power supply.....Remember I am trying to get +/- 10V to be read here....and we only have a 15V positive swing, so even if I put the incoming voltages at a 7.5V offset, we are outside the design parameters, and would only be able to read about +/- 7V DC.
So what I think may work is something like this:
- The input goes through 2 buffers wired in parallel; one inverts; the other doesn't.
- The incoming gain is divided by 3, so this could theoretically read inputs as high as +/-12V with an accuracy of about +/- 12mV's. Remember that we are using 4.096 as external ref, and the ADC has an accuracy of 0-1023, so ADC=0 means 0-4mV, ADC=1 means approv 4.1mv-8mV, etc., up to 1023, or close to 4.096V. That's how I am doing the math anyway....
- The sketch will look for data > than 0V at 2 analog pins during each 1ms loop. If it finds this on the -1 op amp, throw a minus sign in front of the output TFT numeral on display. Otherwise, leave the number as is (Easy right? Why wouldn't that work?)
- How to keep the Arduino from blowing up? The Arduino analog inputs want to see high impedance sources, but not too high. So I figure I can just hook the op amp buffer output right to the analog input....but the solution is easy in any event....Each Analog input could have a resistor in series to current limit the input of the Arduino analog pins. It might be 22K, or less? I figure it won't make a difference?
Turns out that was super easy--took about 10 minutes from going from the setup last time to a very accurate 0-4V or so DVM. Here's what I did.
On Amazon I bought this cute little Adafruit LM4040 module and wired it up:
5V from Arduino > VIN on LM4040
GND from Arduino > GND on LM4040
AREF input on Arduino > 4.096 pin on LM4040
- Modified my code in the [setup] function to include analog Reference so I wouldn't blow up the Arduino--Again here is a good link explaining how this all works.
- Changed my code so that the voltage read at the analog pin was multiplied by .04.
Finally with everything wired up I tested my TFT display of voltages between 0 and 4V by comparing the Arduino voltages read to my trusty Fluke DVM. It was "dead nuts on", as my EE brother says:
OK onward and upward. This part turned out to be so much easier than I thought that I almost laughed. The Arduino platform is stupid easy to use!
To finish this I need to create a PCB for the electronics and 5V power conversion and a 2U front panel for Fracrak, but that's another post. See ya....