Increasing ADC resolution using a DAC & a PGA/opamp - Page 1
Forum section: electronics / projects

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 10:43:34 am
content: While working on my Bench Power Supplyhttps://www.eevblog.com/forum/projects/bench-power-supply-design/msg490679/#msg490679digital control part I ran into a small (read big) problem.To get 4 digit voltage and current readouts I would need at least a 12bit ADC in theory, practically only 10 bits or less are usable due to errors, so I started looking for a solution to get higher resolution while keeping the same 12bit ADCs (because they're cheap and fast) and I came up with this:use 2 ADC channels and a 4.096V reference (for convenience)read the full input voltage (VIN) on the first channel to get a 12bit conversion [B11:B0]logical 'AND' the result so [B3:B0] become 0 (ignore those bits)send the ANDed result to a 12bit DAC whose output is connected to the reference input (inverting input) PGA (Programmable Gain Amplifier) or a regular opamp (must have low offset voltage) set to a gain of 16the PGA's non-inverting input is connected to VINfeed the output of the PGA into the second ADC channel and do another conversionthe second conversion result should be basically what we ignored during the first conversionVINis a DC voltage and changes slowly compared to the ADC conversion time. The PGA I'm thinking to use is an MCP6S21http://ww1.microchip.com/downloads/en/DeviceDoc/21117B.pdf.Will this work or is it just plain stupid? I'm open to suggestions/constructive criticism.

author: mij59
author_rank: Frequent Contributor
timestamp: August 06, 2014, 11:17:51 am
content: Hi,Sounds a bit too complicated, don't think it will improve the accuracy.Maybe you can use something like the MCP3421.

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 11:31:10 am
content: Quote from: mij59 on August 06, 2014, 11:17:51 amUnfortunately that uses I2C and I use SPI in my project. I could use a MCP3551 which is 22 bit but I find it quite slow.To make the first post clearer, here's a schematic. I could simplify it further and use only one ADC channel.

author: sync
author_rank: Frequent Contributor
timestamp: August 06, 2014, 11:53:26 am
content: I think the performance would be worse than just using a single ADC. Especially when using the MCP4922 which is a bad performer (INL +/-12LSB).

author: dannyf
author_rank: Super Contributor
timestamp: August 06, 2014, 11:54:05 am
content: Sure. I would use a adc with built-in pga + differential channels.Some AVRs have that and all you need is an external DAC.

author: mij59
author_rank: Frequent Contributor
timestamp: August 06, 2014, 11:57:21 am
content: Hi,The MCP3551 looks fine to me, or any other 16 bit ADC would do.There's no need for speed, you want a stable reading, not numbers bouncing around.

author: David Hess
author_rank: Super Contributor
timestamp: August 06, 2014, 12:08:31 pm
content: You have reimplemented the pipelined or subranging ADC. Integrated designs use calibration to correct for linearity errors which would otherwise be dominated by the ADC and DAC of the first stage.

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 12:14:21 pm
content: I guess I'll go with a MCP3550/1/3 after figuring out how to bloody interface with the damn thing.I also found thishttp://ww1.microchip.com/downloads/en/AppNotes/01007a.pdf. The funny thing is that the circuit I came up with is the same as the one in FIGURE 3, I didn't know about that when I came up ith itOh well, I guess the initial idea will work anyway, but as sync mentioned, I'd need a really accurate DACI'll probably be sticking with two MCP3551 (because it's available at the supplier I'm going to order all my parts from, and they're the cheapest) and use the PIC's 10bit ADC for the other stuff which doesn't have to be so accurate, 3 digits only.

author: nctnico
author_rank: Super Contributor
timestamp: August 06, 2014, 12:25:25 pm
content: For accurate analog you really should avoid Microchip. TI has some really nice 16bit delta-sigma ADCs which are slow but also cheap.

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 12:58:09 pm
content: Quote from: nctnico on August 06, 2014, 12:25:25 pmUnfortunately, if I can't get a SPI interface one I'll have to go with the MCP. Currently digging on the TI website.

author: nctnico
author_rank: Super Contributor
timestamp: August 06, 2014, 01:05:59 pm
content: IIRC Analog devices also has similar chips with SPI interface. Why can't you use I2C?

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 01:31:52 pm
content: I avoided I2C because it's more complicated to implement than SPI and it's slower. Also, the MCU will have to handle some other things like a 128x64 LCD, a dual DAC, rotary encoders and pushbuttons (and whatever else I'll think of) so it wouldn't have time to wait for the I2C transfers to complete. I have most of the code written already and I don't want to go back and modify it, most of the SPI peripherals are already implemented.I found an Analog Devices ADC with SPI interface at a reasonable price, this 24bit onehttp://www.analog.com/static/imported-files/data_sheets/AD7792_7793.pdf.I also found a 16bit one which is obviously out of stock. Damn you Murphy's Laws! Here goes more digging... *grabs internet shovel*A LTC2433 could be used if a reading of only 4 digits is needed.

author: tszaboo
author_rank: Super Contributor
timestamp: August 06, 2014, 02:03:12 pm
content: Just oversample it and turn the extra speed to bits. You might need extra noise, but generating noise is usually easier than removing it.

author: free_electron
author_rank: Super Contributor
timestamp: August 06, 2014, 02:15:32 pm
content: What do you mean with slow ?Let's do a quick analysis. I2c is 400KHz. Let's say one write operation and a read of 16 bit , so thats 16 for the write and 24 for the read. Gives 40. You can bang that adc 10000 times a second.Plenty fast i think. Power supply panel meters using an icl7106 can barely scrape kne update per 1.5 seconds. You can do 10000.I do not want a power supply where the last digit always shows an 8 because the update makes it a blur.So : slower is not an excuseMore complicated ? Surely the cpu you use has a hardware i2c cell ... And comes with at least one example how to use it ?

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 03:16:11 pm
content: Quote from: free_electron on August 06, 2014, 02:15:32 pmYes, it does have hardware I2C and all the info to how use it in the datasheet but since I already know how to use SPI and wrote all the code around that (I'll have multiple peripherals like an ADC, DAC, maybe a RTC, I/O expander and expansion capability, each needing one extra chip select pin which corresponds to the hardware address in I2C if I'm correct) and I'm running out of time so I'm sticking to SPI on this project. I want to get my power supply up and running within 3 weeks. I'll probably use I2C in another project.Quote from: free_electron on August 06, 2014, 02:15:32 pmTrue, but the sampling rate still boils down to the ADC used.QuoteNeither do I, the update rate will be set between 3 and 6 times a second.

author: dannyf
author_rank: Super Contributor
timestamp: August 06, 2014, 03:20:09 pm
content: An outboard dac (with high resolution + pga) has its advantages - being simple.Otherwise, your approach can be made to work with a dac, pga, and adc (outboard or not).1) set up the adc to take differential readings - one input to the signal to be adc'd, and another to the dac's output;2) set the pga to gain of 1; output a zero on the dac; take a reading on the adc (reading 1);3) set the pag to a higher number; output reading 1 on the dac; take another reading on the adc;The real output would be read1ing 1 + reading 2 / pga gain;For a 10-bit adc, you can at most form a 20-bit adc using this approach.On an AVR, all you need is a dac (which can be done via pwm as well).

author: dannyf
author_rank: Super Contributor
timestamp: August 06, 2014, 03:21:08 pm
content: As to good adc chips, check out the ADS12xx family.

author: David Hess
author_rank: Super Contributor
timestamp: August 06, 2014, 04:44:21 pm
content: Quote from: NANDBlog on August 06, 2014, 02:03:12 pmThis will increase the resolution but do nothing for the linearity.

author: mikerj
author_rank: Super Contributor
timestamp: August 06, 2014, 05:26:30 pm
content: Quote from: David Hess on August 06, 2014, 04:44:21 pmDoes the OP have a problem with the linearity of his 12 bit ADC?

author: void_error
author_rank: Frequent Contributor
timestamp: August 06, 2014, 06:00:02 pm
content: Well I'd like to have decent linearity. I guess I'm sticking to my first idea and what dannyf suggested. That can maybe get me 16 bits with using 12bit ADCs. I'm not looking for an extremely accurate reading, anything which gets me a better result than a cheap multimeter will do.My initial idea was to find a workaround the ADCs errors which affect the LSBs. As for the DAC accuracy I can find a way to software calibrate the whole thing each time it starts up based on the reference voltage (which is going to be a separate chip, no internal VREF used). This is probably the cheapest and quickest solution since I already have the code written for the ADC & DAC. The total cost added with the DAC and PGA(s) is about $5.Hopefully all the errors will declare war to each other and wipe each other out (just kidding).

author: David Hess
author_rank: Super Contributor
timestamp: August 06, 2014, 06:00:35 pm
content: Quote from: mikerj on August 06, 2014, 05:26:30 pmHe will when he uses it as the first stage of a subranging ADC without some type of calibration which integrated subranging ADCs do internally. Delta-Sigma converters which use multibit quantizers have the same problem which is why 1-bit quantizers are so popular.

author: dannyf
author_rank: Super Contributor
timestamp: August 06, 2014, 06:46:23 pm
content: QuoteLinearity isn't his problem: he wants to be able to adc voltage lower than what his adc can resolve.The idea is basically sound.

author: void_error
author_rank: Frequent Contributor
timestamp: August 07, 2014, 08:58:30 am
content: Looks like I ran into another problem...The PGA I'm using (MCP6S21 - because I can get it from where I get all of my other parts) can't swing to the negative rail (0V) with 0V input at a any gain setting, just to about 0.6V.Since only two gain levels are required I could use two precision rail-to-rail opamps, each with a required gain and two ADC channels (got more than I can poke a stick at anyway). Actually, I can get away with only one opamp since the first one will have a gain of 1.

author: nctnico
author_rank: Super Contributor
timestamp: August 07, 2014, 09:15:49 am
content: Did you think about how you are going to calibrate for offset and gain errors?

author: void_error
author_rank: Frequent Contributor
timestamp: August 07, 2014, 10:03:06 am
content: This is getting quite complicated with all the errors that have to be taken into account.I'll be using a MCP3551 instead of the whole DAC-PGA-ADC mess the to keep things simple and reasonably accurate for a 4 digit readout - 1mV resolution.Some calibration will still be required though...