Author Topic: Easy DIY 5.5 Digit DVM + Volt Ref./Cal. (LTC2400+LTC6655 / SPI uC / Arduino)  (Read 145783 times)

0 Members and 4 Guests are viewing this topic.

Offline echen1024

  • Super Contributor
  • ***
  • Posts: 1660
  • Country: us
  • 15 yo Future EE
What optoisolator did you use?
I'm not saying we should kill all stupid people. I'm just saying that we should remove all product safety labels and let natural selection do its work.

https://www.youtube.com/user/echen1024
 

Offline branadic

  • Super Contributor
  • ***
  • Posts: 2448
  • Country: de
  • Sounds like noise
Quote
without using a differential front end DVM

What? Are you serious?
Computers exist to solve problems that we wouldn't have without them. AI exists to answer questions, we wouldn't ask without it.
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
What optoisolator did you use?

I am away from home working, so I haven't tested it yet. But I found some 4N25 that I bought last year. If they cannot be used, I will have to order something more appropriate. I have no experience with optocouplers, so I will just try and fail.


Quote
without using a differential front end DVM

What? Are you serious?


Yes, I think I am. If the DVM module (ADC+REF) runs on a separate (galvanically isolated) power supply or battery, then the only connection between the meter and the circuits under measurement is the digital data transfer through optocouplers to the Arduino (which shares ground with the circuits being measured on). No ground shared between meter and uC or other circuits - only some kind of photonic pulse train throught the optocouplers.

So (in my world) the meter can measure everywhere (within it's voltage range) - the high side of resistor dividers (for example around 3 volt at the high side resistor for the LM399 10 V reference amplification) or at a low side ground current sensing shunt (let's say 2 amp through 0.01 ohm - should be 20 millivolt). The meter has no current path shared with the devices-under-measurement, and should be as ignorant about common mode voltages and common referencing (ground) as any cheap hand held battery powered DMM.

But I might be wrong ...
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
Well - I did manage to get optocouplers on SPI. But the ones I had - PC817 (meant for my model railroad) are far to power hungry (I needed drivers, placed under the shield  |O - there is no room for components on the top). Also - which is more important - I had to change the code and Arduino libraries because there is no communication from microcontroller to ADC any more.

So I have changed my mind - I'll tear it down and isolate RS232 instead the same way as Andreas has described in an earlier post. I have a lot of Arduinos, so I will dedicate one for the DVM module. When running on separate power supply it will be a voltmeter with it's own uC having floating ground and only communicating through optocouplers to USB and/or other microcontrollers with a different ground potential.

« Last Edit: October 13, 2013, 06:17:14 am by quantumvolt »
 

Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3305
  • Country: de
PC817 (meant for my model railroad) are far to power hungry
I use them also, at around 1mA. Ok this makes them relatively slow. In this case you will get (with a well adjusted receiver resistor to CTR) around 4800(-9600) baud. The clou is to find the working point where the receiver transistor is not saturated. Otherwise only around 2400 Baud can be achieved at 1mA.

With best regards

Andreas


 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
Thanks Andreas - I will try different currents.

I think I will not do much more with the LTC2400 before I have managed to make a PCB with room for the LTC1043 and LTC1050. I also have a LM399 I will try to use as reference (divided down without resistors).

I am writing some code for real-time data analysis - and when looking for code to re-use, I found that MicroChip publishes the full C++ code for acquisition and scope/histogram/statistics display for the 22 Bit ADC MCP3551. So I ordered one from England - overpriced. But even if MicroChip ships from Thailand where I live, the minimum shipping cost is USD 22.50 or something like that for a chip that is almost free.

I also ordered a board with a 24 Bit ADC HX711 for USD 6.99 from fleabay (just for fun  ;D). Later I will also buy a 24 Bit ADC from TI. I want to set up a big board 18x30 cm with all my best references and these ADC's (+ relays/uC/RS232). If I go for heating I will put the whole board in a lunch polystyrene box heated to 45 degC.
« Last Edit: October 14, 2013, 10:00:23 pm by quantumvolt »
 

Offline Christopher

  • Frequent Contributor
  • **
  • Posts: 429
  • Country: gb
Simon from LT just came to see me at work, because I sampled these chips and offered me a couple of eval boards for these chips! He's making a 24-bit DMM for a home project, too.

He said keep the reference on your desk burning-in for 2,000 hours to improve reliability.
 

Offline babysitter

  • Frequent Contributor
  • **
  • Posts: 899
  • Country: de
  • pushing silicon at work
Finally I get here, too - from the almost orphaned LTZ1000 thread.

As somebody who spend parts of his childhood in relay-based telephone exchange offices, counting the steps that x-y selector switches do, I want to ask:

What do you guys think about using reed relays for the capacitive dividers ?
They have very low ON, really high OFF resistance, are suitable for high voltage, cheap and you can custom-make them at home with your own windings and ms-tubing as electrostatic shield.

(Edited about e Minutes later: And while you are at it, use them to short your ADC inputs together to check null, and connect the input to your reference to do a 2-point calibration)

Greetings
Hendrik
I'm not a feature, I'm a bug! ARC DG3HDA
 

Offline Andreas

  • Super Contributor
  • ***
  • Posts: 3305
  • Country: de
He said keep the reference on your desk burning-in for 2,000 hours to improve reliability.
A real burn in or only a "run-in".
2kHrs are not much. My references need around 4kHrs run in phase until I can tell if they will
give a "good" or "poor" device.

What do you guys think about using reed relays for the capacitive dividers ?
Many older equipment used mechanical choppers (relays) to stabilize the DC path.
But limited lifetime and poor reliability has led to the development of the newer techniques.
Of cause it would be interesting what can be achieved with "wetted" reed relays compared to
a LTC1043 divider.

On the other side the high switch resistance of the LTC1043 makes it possible to use the voltage divider directly at a unbuffered LTZ1000. With a pure capacitive divider you would need a buffer amplifier or resistor at the input of the divider. Otherwise the output of the LTZ gets shorted capacitively, so the temperature setpoint will be very high, and will leading to a hysteresis/ageing of the LTZ1000.

With best regards

Andreas
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Quote
2kHrs are not much. My references need around 4kHrs run in phase until I can tell if they will
give a "good" or "poor" device.

Sounds like a perfect pre-requisite for that 125.5 digit meter I was thinking about building, :)
================================
https://dannyelectronics.wordpress.com/
 

Offline echen1024

  • Super Contributor
  • ***
  • Posts: 1660
  • Country: us
  • 15 yo Future EE
How would we up this one level, and add capability to go over the 5v max. Maybe buffer the input?
I'm not saying we should kill all stupid people. I'm just saying that we should remove all product safety labels and let natural selection do its work.

https://www.youtube.com/user/echen1024
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
How would we up this one level, and add capability to go over the 5v max. Maybe buffer the input?

This theme is extensively debated and described in many other threads on the forum. Mostly it involves a precision resistor voltage divider or the capacitive divider LTC1043 (the capacitive divider will AFAIK only help up to 2*5*1.125 V- i.e. some 11 Volt - which is enough for measuring 10 V references).

If one has a precision voltage source (adjustable output preferred) with some 10 to 1 ppm accuracy (resolution) and its own separate power supply/battery, one can expand the range of the measurement by subtracting a known quantity from the input signal before measuring the resultant 0-5 V residue.

Please search the forum for subsets of "PRECISION RESISTOR VOLTAGE DIVIDER LTC1043 CAPACITIVE SWITCH BACK-TO-BACK DIFFERENCE MEASUREMENT" or whatever you can imagine relevant. There is many highly knowledgeable posts written by the more volt-nut-oriented brigade of this forum.
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
Buffers is a different theme (buffers have little to do with measurement - they are only supporting impedance-transforming infrastructure). Please see earlier posts and the datasheets / application notes from Linear technology that are linked to in this thread.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Quote
Mostly it involves a precision resistor voltage divider

I give you a different approach:

1) use a (composite) dac to output the desired voltage (say 0-10v). This dac is driven by a mcu specified in 3) below.
2) use a high resolution adc to adc the output voltage generated in 1);
3) use a mcu to change the output from the (composite) dac to minimize the error, via a PID controller for example.

To maximize effective (output) resolution,  you will need to use a high resolution dac - 16-bit or higher dacs are very rare and expensive. You could then use two dacs (or more), one output the most significant digits and another the least significant digits and run the output through a summing opamp.

In this set-up, you can output pretty any much any desired voltage from a fixed reference. The only limitation to accuracy is the adc + its reference. The only limitation to resolution is the (composite) dac.
================================
https://dannyelectronics.wordpress.com/
 

Offline casinada

  • Frequent Contributor
  • **
  • Posts: 599
  • Country: us
 

Offline Harvs

  • Super Contributor
  • ***
  • Posts: 1204
  • Country: au
I'm pretty sure the question was about how to measure a voltage above the ADC input voltage limits, not how to generate a precision output voltage.

Hence the need for a precision voltage divider...
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Quote
http://cds.linear.com/docs/en/application-note/an86f.pdf

Wow! looked like I managed to get a few things right there. Pure luck. I grossly under-estimated the error correction, and stability issues, however.

That is a great app note. Worthy of anyone's annual read.
================================
https://dannyelectronics.wordpress.com/
 

Offline echen1024

  • Super Contributor
  • ***
  • Posts: 1660
  • Country: us
  • 15 yo Future EE
I'm pretty sure the question was about how to measure a voltage above the ADC input voltage limits, not how to generate a precision output voltage.

Hence the need for a precision voltage divider...
Thank you. So the prevailing opinion is a precision resistor divider?
I'm not saying we should kill all stupid people. I'm just saying that we should remove all product safety labels and let natural selection do its work.

https://www.youtube.com/user/echen1024
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
I'm pretty sure the question was about how to measure a voltage above the ADC input voltage limits, not how to generate a precision output voltage.

Hence the need for a precision voltage divider...
Thank you. So the prevailing opinion is a precision resistor divider?

Since none of the volt-nuts answer you - the traditional answer is a definitive YES. Please read the forum and search the web. If you are more than faintly interested, consult Low Level Measurements Handbook - Keithley Instruments. To see why a capacitive switch divider has some benefits that are wanted in very high precision measurements, search "EEVBLOG LTC1043" from a web search engine.
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
Very good news for me and others who want to use the LTC24xx family ADCs.

In the tread about the Linear Technology Arduino clone - LINDUINO https://www.eevblog.com/forum/projects/linduino-smart-isolated-arduino-compatible-board-for-daq-demo-boards-etc/ - an applications engineer from LTC posted that there is starting to be C++ code examples/libraries associated with the parts.

Below is the code for the 2 Channel 20 Bit ADC LTC2422. I have studied it and the libraries - they are professionally written and well documented. LTC even encourages "hacking" and all reuse of the free code. This also goes for "new unintended use" of the GUI Software QuikEval that is free as an .exe-file and now can be interfaced from Arduino (and PIC if you rewrite the I2C and SPI routines).

All you need to build a 4.5 to 6 Digit DVM with ready running software is the USD 5-10+ (depending on no. of channels and bits) LTC24XX chip and a suitable reference (another 5-10 dollars). Combined with an Arduino (you can use any Arduino Uno or similar - no need to buy the isolated Linduino from LTC) and a cheap display, you have both the PC based GUI and a portable measuring instrument.

So no more reuse of junk code floating around the web. And for me - no more code development before I know every line in the free LTC Sketchbook library.

There is no code for the LTC2400 specifically, but there is code for LTC2418 (18 Ch 24 Bit), LTC2422 (2Ch 20 bit), LTC2449 (16 Ch 24 Bit) and LTC2484 (Single Ch 24 Bit). As they are all based on the same 4 Byte SPI protocol, it is a piece of cake to write the code for the LTC2400 itself.

Below is a copy and paste of the LTC2422 test code (you also need the libraries to make it run - it's all in the links in this post).

Code: [Select]
/*!
LTC2422: 1-/2-Channel 20-Bit uPower No Latency Delta-Sigma ADC in MSOP-10
 
@verbatim
 
The LTC2421/LTC2422 are 1- and 2-channel 2.7V to 5.5V micropower 20-bit analog-
to-digital converters with an integrated oscillator, 8ppm INL and 1.2ppm RMS
noise. These ultrasmall devices use delta-sigma technology and a new digital
filter architecture that settles in a single cycle. This eliminates the latency
found in conventional delta-sigma converters and simplifies multiplexed
applications. Through a single pin, the LTC2421/LTC2422 can be configured for
better than 110dB rejection at 50Hz or 60Hz +/-2%, or can be driven by an
external oscillator for a user defined rejection frequency in the range 1Hz to
120Hz. The internal oscillator requires no external frequency setting
components.
 
@endverbatim
 
http://www.linear.com/product/LTC2422
 
http://www.linear.com/product/LTC2422#demoboard
 
REVISION HISTORY
 $Revision: 1922 $
 $Date: 2013-09-07 08:48:00 -0700 (Sat, 07 Sep 2013) $
 
Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.
 
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
 
1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.
 
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.
 
The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/
 
//! @defgroup LTC2422 LTC2422: 1-/2-Channel 20-Bit uPower No Latency Delta-Sigma ADC in MSOP-10
 
/*! @file
    @ingroup LTC2422
    Library for LLTC2422: 1-/2-Channel 20-Bit uPower No Latency Delta-Sigma ADC in MSOP-10
*/
 
#include <stdint.h>
#include <arduino.h>
#include "Linduino.h"
#include "LT_I2C.h"
#include "LT_SPI.h"
#include "LTC2422.h"
#include <spi.h>
 
uint8_t LTC2422_EOC_timeout(uint8_t cs, uint16_t miso_timeout)
// Checks for EOC with a specified timeout (ms)
{
  uint16_t timer_count = 0;             // Timer count for MISO
  output_low(cs);                       //! 1) Pull CS low
  while (1)                             //! 2) Wait for SDO (MISO) to go low
  {
    if (input(MISO) == 0) break;        //! 3) If SDO is low, break loop
    if (timer_count++>miso_timeout)     // If timeout, return 1 (failure)
    {
      output_high(cs);                  // Pull CS high
      return(1);
    }
    else
      delay(1);
  }
  output_high(cs);                      // Pull CS high
  return(0);
}
 
// Read ADC code from the LTC2422. Does not wait for end-of-conversion.
// To automatically wait for conversion to complete, use the LTC2422_EOC_timeout before this function..
void LTC2422_adc_read(uint8_t cs, uint8_t *adc_channel, int32_t *code)
{
  LT_union_int32_4bytes data, command;      // LTC2422 data
 
  command.LT_int32 = 0x00000000;
 
  spi_transfer_block(LTC2422_CS, command.LT_byte , data.LT_byte, (uint8_t)3);
  if(data.LT_byte[2] & 0x40) // Obtains Channel Number
  {
    *adc_channel = 1;
  }
  else
  {
    *adc_channel = 0;
  }
  data.LT_byte[2] &= 0x3F;                  // Clear channel bit here so code to voltage function doesn't have to.
  data.LT_byte[3] = 0x00;                   // Make sure MS Byte is zero, data is right-justified.
  *code = data.LT_int32;                    // Return data
}
 
// Calculates the voltage given the ADC code and lsb weight.
float LTC2422_code_to_voltage(int32_t adc_code, float LTC2422_lsb)
{
  float adc_voltage;
  adc_code -= 0x00200000;                         //! 1) Subtract offset
  adc_voltage=((float)adc_code)*LTC2422_lsb;      //! 2) Calculate voltage from ADC code and lsb
  return(adc_voltage);
}
 
// Calculates the lsb weight from the given reference voltage.
void LTC2422_calculate_lsb(float LTC2422_reference_voltage, float *LTC2422_lsb)
{
  *LTC2422_lsb = LTC2422_reference_voltage/(1048575);        //! 1) Calculate the LSB, ref_voltage /(2^20-1)
}
 
 
</spi.h></arduino.h></stdint.h>

Source: http://www.linear.com/product/LTC2422#code
Libraries: In Linduino sketchbook at http://www.linear.com/designtools/linduino.php


So now you can make a breadboard/Arduino/PC ADC/DVM platform like in the video below for USD 10-20. No need to buy demo boards, USB board and software. Just get an ADC and a ref chip. Nice ...


 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Quote
So the prevailing opinion is a precision resistor divider?

For fixed voltages. If you want to generate a reference voltage at any levels, follow the aforementioned app note from LT.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Quote
There is no code for the LTC2400 specifically

It can be ported to ltc2400 fairly easily.

I would note two things:

1) it does not utilize error correction;
2) it uses float - 5/6 digit precision.

Those two would kill its chance to be used as a 5-6 digit volt meter.

The could would have been a lot useful had it stayed in the integer land, I think, so the conversion can be done by users on platforms that support doubles.
================================
https://dannyelectronics.wordpress.com/
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th

...

Those two would kill its chance to be used as a 5-6 digit volt meter.

...


Really? Well - I am sitting on a functioning LTC 2400 based 6 Digit DVM that tracks my Agilent 34401A to a few PPM when properly set up. You seem to have a PhD in fast not-very-well-founded conclusions. I'll stick to my shield ...  ;D
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Quote
You seem to have a PhD in fast not-very-well-founded conclusions.

Calm down. Understanding what I was referring to before responding to my post would have been helpful.
================================
https://dannyelectronics.wordpress.com/
 

Offline quantumvoltTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: th
...

The could would have been a lot useful had it stayed in the integer land, I think, so the conversion can be done by users on platforms that support doubles.

Sorry if I have misunderstood you. A float has a precision of 23 bits - 24 if normalized. Mathematically this is around 7.2 decimal digits. By keeping the ADC output and resolution normalized with a bit shift operation, precision is lost only in a single 'division by float' operation on normalized numbers.

As I have answered to one of your earlier posts, I expect no more than 17-19 noise free bits from my experimental DVM. Even if LT and TI name their ADCs '24 bit' - they vaguely state elsewhere that it is unrealistic to expect more than 20+ bit 'performance'. Microchip's comparable ADC is only 22 nominal bits, and AD writes:

"AD7712: 24-BIT SIGMA-DELTA ADC   
This converter utilizes sigma-delta techniques to offer 16-bit accuracy (0.0015% FSR) and no missing codes to 24-bits"

Accuracy 0.0015% of full scale is the same as the basic (best) DC accuracy for Agilent 34401A. Last time I looked at it it states that it is a 6.5 digit DMM.

So IMO the float - when used with care - is for all practical purposes good enough to represent 16-19 relatively noise free bits and leave the result of a single division/rounding almost immune to numerically introduced significant errors.
« Last Edit: October 19, 2013, 11:37:39 pm by quantumvolt »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf