Author Topic: Possibility of using Audio codecs for measuring DC stuff  (Read 5511 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: 8647
  • 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: 4955
  • 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?
 


Online Kleinstein

  • Super Contributor
  • ***
  • Posts: 14202
  • 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: 4955
  • 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: 4955
  • 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: 4955
  • 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
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf