Author Topic: Possibility of using Audio codecs for measuring DC stuff  (Read 5504 times)

0 Members and 1 Guest are viewing this topic.

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Possibility of using Audio codecs for measuring DC stuff
« on: October 14, 2017, 09:42:26 am »
Hi,
I need cheap way of reading and generating precision DC voltages, I was wondering if something like UDA1380 which is an audio codec or similar ones can do the job, what are the pitfalls? also what's their ENOB?  for example in the UDA1380 it says the signal-to-noise ratio at fs = 48 kHz is about 97dB so can we calculate the ENOB is (97-1.76)/6.02 or something near 16bits? since this part has DC filters that can be disabled, have you done something similar? I need ADC and DAC with at least 16bit ENOB with low prices, do you know any other way around, the sample rate of 20K or more is enough for my job. I'm looking to do the job with a budget of under 2$ ;)
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #1 on: October 14, 2017, 12:16:57 pm »
I didn't look specifically at the data sheet from the UDA1380 but the general picture with audio codecs is they don't care too much about DC offsets or gain. In practice the gain variation of most of them is not too bad. A temp coeff of 25ppm seems typical. Its the DC offset you need to worry about for good DC measurements. Not only can it be quite large, it isn't always very stable.
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #2 on: October 14, 2017, 02:56:20 pm »
As has been said, audio codecs generally have horrible DC characteristics. Up your budget a bit and look at the LTC24xx parts for some serious DC precision at a bargain price. e.g. LTC2400 nominal 24 bits, actual ENOB determined by how much you want to pay for a voltage reference and low offset/drift op-amps, 5-10 ppm accuracy relatively easily achieved, under $5 in quantity, under $8 one-off.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #3 on: October 15, 2017, 06:48:46 am »
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #4 on: October 16, 2017, 06:05:50 am »
Thanks for the hints, the MCU's looks definitely cool, but I need two ADC and two DAC's the MCU's seems to have the the ADC but lack the DAC.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #5 on: October 16, 2017, 06:57:40 am »
I think the other next best thing would be HX710A part, but is there a way to change it to accept single ended ground reference input? do you have any Idea? they are so damn cheap!
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4953
  • Country: si
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #6 on: October 16, 2017, 07:05:04 am »
Problem with audio chips for precision DC is that the internal voltage reference is not very stable and they don't have a external reference input.
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #7 on: October 16, 2017, 12:08:42 pm »
You can easily make a very good dac with PWM
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #8 on: October 16, 2017, 01:51:57 pm »
What about the programming of the 8051 part? can I use my j-link? or do we have an opensource one?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #9 on: October 16, 2017, 02:17:59 pm »
You can easily make a very good dac with PWM

Yes, but with painfully slow settling time; excellent linearity, but slow to settle. Say you use a 16 bit counter on a 16MHz clock (e.g. Arduino). That will give you a 244 Hz fundamental square wave, so you'll want a low pass filter of at most 50 Hz, which will give you a settling time to 16 bits of 222 ms. Roughly speaking that is, these are only "back of a fag packet" calculations.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #10 on: October 16, 2017, 02:27:00 pm »
You can easily make a very good dac with PWM

Yes, but with painfully slow settling time; excellent linearity, but slow to settle. Say you use a 16 bit counter on a 16MHz clock (e.g. Arduino). That will give you a 244 Hz fundamental square wave, so you'll want a low pass filter of at most 50 Hz, which will give you a settling time to 16 bits of 222 ms. Roughly speaking that is, these are only "back of a fag packet" calculations.

Using two or three PWM-outputs one can reduce the settling time considerable:

https://www.edn.com/design/analog/4441113/A-faster-PWM-based-DAC

However, for many applications this may be still too slow.
 

Offline Cerebus

  • Super Contributor
  • ***
  • Posts: 10576
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #11 on: October 16, 2017, 02:49:19 pm »

Using two or three PWM-outputs one can reduce the settling time considerable:

https://www.edn.com/design/analog/4441113/A-faster-PWM-based-DAC

However, for many applications this may be still too slow.

It all depends what you're aiming for. The variant you've linked to introduces a dependence on the resistor ratios which, if you're after good linearity, requires very good tempco on the resistors which can get expensive. The great advantage of PWM is linearity - some of the very best calibrators use PWM DACs.

There's also a smoothing scheme that uses an integrator, a hold capacitor and some analogue switches to switch between them synchronously with the PWM. There's an EDN circuit idea on it somewhere. It effectively settles in a PWM cycle or two, but I've never got it to work quite satisfactorily, but it's a plausible compromise between linearity and settling time. Found it: https://www.edn.com/design/analog/4323340/Fast-settling-synchronous-PWM-DAC-filter-has-almost-no-ripple.
Anybody got a syringe I can use to squeeze the magic smoke back into this?
 


Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #13 on: October 16, 2017, 07:12:36 pm »
For less ripple on a PWM DAC one can also use a kind of partial SD modulation, like using 10 or 8  Bit HW PWM and modulation by +-1 step in software. This reduces the amplitude of the lowest frequency component considerably. However the problematic range near 0 and full scale gets larger.

In some cases a simple inaccurate, but high resolution (and not large gap) R2R DAC and a feedback loop with the ADC for corrections can work too.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4953
  • Country: si
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #14 on: October 17, 2017, 05:34:19 am »
This thread is mostly about ADCs tho, but yeah PWM can be quite useful when you need a cheap DAC.

There are not many cheats you can take to get a cheap high resolution  measurement ADC out of something that was not meant to be one. What you get in integrated form will mostly be sigma delta ADCs and the 24bit ones can provide some pretty impressive performance, if you are willing to pay 10 to 40 bucks for a chip that is.

The best bet might be building your own dual slope ADC. It only needs a few simple analog components while the time measurement of the slope can be done using hardware timers in a MCU.

But for any sort of AC measurement the audio ADCs are awesome. They let you look at -120dB signals pretty clearly and even do it at pretty nice sample rates of 192KHz and similar.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #15 on: October 17, 2017, 06:43:06 am »
Thanks guys for the useful hints,
Quote
This thread is mostly about ADCs tho, but yeah PWM can be quite useful when you need a cheap DAC.

There are not many cheats you can take to get a cheap high resolution  measurement ADC out of something that was not meant to be one. What you get in integrated form will mostly be sigma delta ADCs and the 24bit ones can provide some pretty impressive performance, if you are willing to pay 10 to 40 bucks for a chip that is.

The best bet might be building your own dual slope ADC. It only needs a few simple analog components while the time measurement of the slope can be done using hardware timers in a MCU.

But for any sort of AC measurement the audio ADCs are awesome. They let you look at -120dB signals pretty clearly and even do it at pretty nice sample rates of 192KHz and similar.

It seems that you know some good tricks ;) would you enlighten me on Implementing the Dual slope ADC,since I have a MCU in the design, doing almost nothing :D
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4953
  • Country: si
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #16 on: October 17, 2017, 07:25:42 am »
Best is to read up on this https://en.wikipedia.org/wiki/Integrating_ADC

Things start becoming a bit more complicated when you want high speed out of one of t these. As you want more resolution that means you have to make the integration time longer and this means you can't make as many measurements per second. Multislope designs get around this problem by only using the slow slopes once its close to the final value. Because these use different value resistors to switch between, this means that the resistors need to be very precise or they need to be calibrated for every PCB (One costs money, other costs manufacturing time).
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #17 on: October 17, 2017, 07:33:11 am »
Thanks Berni :)

Do we have a real app-note or open source project doing it in real hardware and explaining everything with practical  details?
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Online MasterT

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #18 on: October 18, 2017, 01:00:06 am »
I did measurements of ENOB for WM8731 ones, 15 bits approximately, with HPF "on".  For DC I would expect no more than 11-12 bits. You may get better accuracy  via implementing self calibration, adding precise DC reference and switch, than use uCPU to track DC drift in real time, interrupting DC voltage monitoring few times in a minute or so.
 In overall, IMHO, it makes sense if 20-48 ksps is necessary. 
  It's not clear what is your application, first topic says 20 ksps than 5-10 sample per second was brought into discussion.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #19 on: October 18, 2017, 08:57:58 am »
Thanks, I need to measure the DC voltages of a power supply for monitoring, so something like 100-200SPS to maximum of 20KS would be enoughso maybe in the future I have some room for improvement.
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Online MasterT

  • Frequent Contributor
  • **
  • Posts: 785
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #20 on: October 18, 2017, 09:59:28 am »
Ok, I see.
I was inclined to the same approach, of using audio codec for fast multi-channel  data acquisition, since 16-bit SAR ADC would cost 30$ and over & DAC way above 10$, having 12-13 ENOB noise free out of 16-bits by specification.
But in your case, for just 200 sps there are better options, NAU7802 for example, 2 channel 24-bits  320 sps, and < 3$ CAD
https://www.digikey.ca/product-detail/en/nuvoton-technology-corporation-of-america/NAU7802SGI/NAU7802SGI-ND/2769782
 
The following users thanked this post: edavid

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4953
  • Country: si
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #21 on: October 18, 2017, 10:09:34 am »
That looks like a rather impressive chip for the price.
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #22 on: October 18, 2017, 10:26:53 am »
The OP requires 20K SPS @ 16 bits.


Regards, Dana.
Love Cypress PSOC, ATTiny, Bit Slice, OpAmps, Oscilloscopes, and Analog Gurus like Pease, Miller, Widlar, Dobkin, obsessed with being an engineer
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #23 on: October 18, 2017, 11:41:38 am »
As others have pointed out, the problem with using Audio targeted ADC/DAC's is that the conversion references tend to be hidden and not well controlled.  Nobody in consumer audio really cares if your gain is a smidge out or has a high TC or varies a little with wander on your 3v3 rail.

But, there are ways to solve this.

Five years ago I designed a product that used 2 stereo DAC's (Wolfson kindly obsoleted them recently..) to create 4 DC voltage levels. We had a 'calibrate' function that would use a CMOS switch, comparator and voltage reference to work out calibration levels if the temperature changed or if a certain time had elapsed.  You could use the spare channel of an audio DAC to do the same without affecting the main output.   Watch out for the step response on audio DAC's!

ADC's are different, most audio ADC's don't like DC. They'll often null it out. However that doesn't stop you, if you turn your DC into switched DC - but that approach would only work a few hundred SPS - better to buy a proper ADC.  If you want 20KSPS/16 bit, your probably going to have to bite the bullet..

If your ADC level input is fairly consistent, then you could use a spare audio DAC to generate a precision subtraction voltage and then use a lower resolution ADC. All boils down to development time vs. production cost.

Some nice, cheap (& available!) audio ADC/DAC's that have exposed the internal references: UDA1334 and UDA1361.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline ali_asadzadehTopic starter

  • Super Contributor
  • ***
  • Posts: 1905
  • Country: ca
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #24 on: October 18, 2017, 12:22:36 pm »
Thanks, since I have a reference inside the design, is it wise to power the audio DAC with a Voltage reference, So we can make sure we have a stable and referenced ADC and DAC? ;) :)
ASiDesigner, Stands for Application specific intelligent devices
I'm a Digital Expert from 8-bits to 64-bits
 

Offline Wimberleytech

  • Super Contributor
  • ***
  • Posts: 1133
  • Country: us
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #25 on: October 18, 2017, 05:58:26 pm »
"Silicom" Labs  Too funny.
 

Offline Berni

  • Super Contributor
  • ***
  • Posts: 4953
  • Country: si
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #26 on: October 19, 2017, 05:30:33 am »
Running the ADC from a stable supply voltage wont solve everything. The internal reference at least won't be affected by supply variation but it is still affected by temperature and its possible that it slowly walks around on its own even.

As for audio ADCs handling DC i have put DC in to some of the higher end chips and they take it just fine, but they did have a configuration pin for turning off the internal high pass filter.

The only way to really know is to take a a few ADC chips and test it with the sort of input your application might provide it. Most audio ADC chips are easy to run where you only need to give it a clock and it spits out data so you could just bodge wire one on a SMD breakout board and hook it to a scope with I2S serial decode to display the data. One good measurement is worth a 1000 expert opinions.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #27 on: October 19, 2017, 02:06:59 pm »
As for audio ADCs handling DC i have put DC in to some of the higher end chips and they take it just fine, but they did have a configuration pin for turning off the internal high pass filter.
The problem with audio ADCs and DACs is not whether they can handle a DC signal. Almost all of them can. Its the huge DC offset you typically get. If this were rock solid you could probably calibrate away most of it, but it isn't always that stable.
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #28 on: October 19, 2017, 03:14:22 pm »
Wasn't it that the topology used in audio ADCs is not working for DC signals, cause they keep 'hunting' or something?

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #29 on: October 19, 2017, 04:27:28 pm »
Wasn't it that the topology used in audio ADCs is not working for DC signals, cause they keep 'hunting' or something?
Pretty much anything with a feedback loop has some amount of hunting going on. However, a sigma-delta converter starts out with a very high 1, 2, or whatever bit sampling rate, and decimates down to a much lower 16, 24, or whatever bit sampling rate. The great majority of the noise due to hunting, which is like a rapid minor oscillation in the pre-decimated domain, is way beyond the Shannon rate of the converter, and gets filtered off during decimation.
 

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #30 on: October 19, 2017, 04:48:24 pm »
Some DAC / ADCs might show rather large idle tones at DC. Some ADCs (don't know about DACs) do remove DC and thus won't work with DC at all.  Many audio codecs also need a constant flow of data, even if constant values are wanted. Usually the gain and offset drift is not that good, but often still not very bad.

As audio usually is at least 2 channels one could use one ADC channel to monitor an external reference and thus way tie the data to an external reference even if the ADCs/DACs use an internal one only.

For the ADCs there are some alternative, relatively cheap ADCs (e.g. MCP39xx series) with reasonably DC specs.
 

Offline b_force

  • Super Contributor
  • ***
  • Posts: 1381
  • Country: 00
    • One World Concepts
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #31 on: October 19, 2017, 05:38:58 pm »
Some DAC / ADCs might show rather large idle tones at DC. Some ADCs (don't know about DACs) do remove DC and thus won't work with DC at all.
This was actually what I was referring to.

I personally don't really get the issue, there are plenty of affordable 12 and 16 bits ADCs for DC signals.
Even 24 bit it not that much more.

Offline Kleinstein

  • Super Contributor
  • ***
  • Posts: 14196
  • Country: de
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #32 on: October 20, 2017, 11:46:13 am »
The ADC part is easy and also affordable. The MCP3911 is affordable (e.g. $2-3  range) and in many respects similar to the Audio ADC, but with good DC specs too.

The more difficult part is the DAC - essentially all cheap 16 Bit DACs are audio. At least I have not found a SD 24 Bit DAC with good DC specs and a low price. I am sure some people would like to have some, even if the price is not that low.

So it is a very legitimate question if there are some of the audio DAC  (or complete codecs) that do have good enough specs to make them attractive for DC use.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Possibility of using Audio codecs for measuring DC stuff
« Reply #33 on: October 20, 2017, 12:04:50 pm »
The ADC part is easy and also affordable. The MCP3911 is affordable (e.g. $2-3  range) and in many respects similar to the Audio ADC, but with good DC specs too.

The more difficult part is the DAC - essentially all cheap 16 Bit DACs are audio. At least I have not found a SD 24 Bit DAC with good DC specs and a low price. I am sure some people would like to have some, even if the price is not that low.

So it is a very legitimate question if there are some of the audio DAC  (or complete codecs) that do have good enough specs to make them attractive for DC use.
Put an audio DAC in the mode where it can output DC. Feed its output back to a spare ADC input, measure the error in the resulting output signal, and correct the value fed to the DAC. Monitor for drift, and update as needed.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf