Author Topic: Analogue tricks to get 16 bits from an 8 bit ADC  (Read 16295 times)

0 Members and 1 Guest are viewing this topic.

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Analogue tricks to get 16 bits from an 8 bit ADC
« on: September 03, 2016, 10:30:54 am »
I have had this little idea. If I take a measurement with my ADC on my AVR and I take it as 10 bits for maximum precision (or whatever other word the pedantic might come up with) and then discard the last 2 bits the least significant ones. That gives me a fairly good 8 bit value. If I then subtract 255/256 of my input voltage leaving only one 256th and multiply it 256 times and take another reading in the same manner I can then put these two 8 bit values together into one 16 bit value with appropriate bit shifting of course. The 2nd step is of course a bit extreme so maybe I could work with less bits and slightly higher voltage levels before I end up just reading operational amplifier offset voltages. But I'm sure you get the general theory. Is this something people have done? I need to buffer my input anyway all I would need to do is put it through a differential amplifier with some gain (yes 256 might be a bit excessive) and feed it into a different analogue to digital input. Not much in it really.
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #1 on: September 03, 2016, 10:38:11 am »
anything is possible ! the question is the complexity and cost ;) 16bit ADCs cost next to nothing compared to the complexity of the setup which would be needed by your approach (sample MSB 8 bits + amplify & shift signal and sample LSB 8 bits).
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #2 on: September 03, 2016, 10:40:51 am »
True, although all I am using is 1 op amp more I have to buffer the signal anyway and that can be a dual opamp. the uC is not doing a lot so it's not like code overhead is a problem.
 

Offline ebclr

  • Super Contributor
  • ***
  • Posts: 2328
  • Country: 00
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #3 on: September 03, 2016, 10:44:20 am »
 

Offline rob77

  • Super Contributor
  • ***
  • Posts: 2085
  • Country: sk
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #4 on: September 03, 2016, 10:49:22 am »
True, although all I am using is 1 op amp more I have to buffer the signal anyway and that can be a dual opamp. the uC is not doing a lot so it's not like code overhead is a problem.

the shift & amplify would be the tricky part, it would require a very precise shift and amplification to keep the ADC linear and avoid missing codes (you might introduce quite a gap or overlap with incorrect voltage shift). the error in voltage shifting would need to be less than 80uV to avoid a gap/overlap in codes.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #5 on: September 03, 2016, 10:51:37 am »
Which is why I'm thinking that if I use less than the full resolution after the the conversion hopefully most of the error will be lost in dumping 2 or more LSB but yes I see what you mean.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #6 on: September 03, 2016, 11:04:11 am »
Won't happen. Half bit uncertainty/change in the first measurement (and it will happen, even if you cut off 2 least significant bits), will make your second measurement completely meaningless. Also it's not like you can do in reasonable way the analog part of it either.
« Last Edit: September 03, 2016, 11:05:56 am by wraper »
 
The following users thanked this post: montemcguire

Offline voltsandjolts

  • Supporter
  • ****
  • Posts: 2300
  • Country: gb
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #7 on: September 03, 2016, 11:48:00 am »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #8 on: September 03, 2016, 11:53:43 am »
Sort of. I am surprised that they make such a thing of rescaling the range of the actual signal as this is an obvious step to increasing resolution. I am now looking at ADC's, with a seperate reference pin i can fine tune the range and get better resolution.

My problem is that I am looking at a NTC sensor and from experience i know that they are awful over 20C as the slope is so slight.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #9 on: September 03, 2016, 11:56:58 am »
I am now looking at this chip: http://www.farnell.com/datasheets/1814529.pdf?_ga=1.9153074.646536181.1456469885 just a shame it does not have a low voltage ref but that is the least of my problems. The SPI protocol is so easy I'm sure i could hard code it if neccessary.
 

Online 2N3055

  • Super Contributor
  • ***
  • Posts: 6660
  • Country: hr
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #10 on: September 03, 2016, 12:14:45 pm »
So you want to measure temperature in a range of about room temperature..
What precision do you want...  If you want high precision (and repeatability) you might need to go PT sensors...
If you don't need much of resolution, use a solid state digitised sensor ...
NTC are used because their sensitivity.. they are great for thermostats and likes..
With precision NTCs you can measure very precisely, but that is expensive stuff..

I just ordered one ADT7410 to try it out.. looks promising if you don+t need lab grade measurement..
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #11 on: September 03, 2016, 12:16:17 pm »
I need to cool and environment with a fan. I have 5 target temperature 5C apart so I'd like to not over or undershoot by more than 2.5C eiher way.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #12 on: September 03, 2016, 12:23:50 pm »
Are you describing a zoom ADC architecture?

https://www.semtech.com/images/promo/ZoomingADC%20White%20Paper_STD.pdf
That's not really getting 16 bit out of two 8 bit measurements. It's name says what it means. You zoom in into the particular area of interest, not miraculously increasing the resolution. In that paper they just show how they use full range of 10 bit ADC. IMO Simon, you should better explain what is the problem in the first place, not the solution of it you try to implement. As the solution may be wrong. What is the range of the temperature, and required accuracy and precision?
« Last Edit: September 03, 2016, 12:27:53 pm by wraper »
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #13 on: September 03, 2016, 12:37:43 pm »
I need to cool and environment with a fan. I have 5 target temperature 5C apart so I'd like to not over or undershoot by more than 2.5C eiher way.
Even if the range would be 100oC, not <30o C (5x5), I don't see why this needs more than 8 bits.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #14 on: September 03, 2016, 12:43:54 pm »
I guess you could use oversampling to achieve higher resolution:

http://www.atmel.com/images/doc8003.pdf

For each additional bit you need four samples ie. 4**N samples for additional N bits. For example, In order to gain six extra bits you need 4**6 = 4096 samples. That is in theory, of course. You need to do some testing with your Arduino, but it shouldn't be too difficult as you have already the ADC up and running anyway.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #15 on: September 03, 2016, 12:45:08 pm »
Yes I could oversample. Yes I have basic code for the ADC on an ATtiny24A
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #16 on: September 03, 2016, 12:46:28 pm »
If you need to zoom in into particular area of NTC curve, it could be as simple as a few switchable resistors to regulate the current through it.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #17 on: September 03, 2016, 12:48:21 pm »
Well I have found that using a higher voltage and possibly a larger series resistor helps extend the range and increase linearity of the voltage. I'm just trying to get thick libre office calc to do me a table of values and start playing with values if I could get the damn thing to work.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #18 on: September 03, 2016, 12:56:23 pm »
If you are only using the NTC as a temperature sensor, you could possibly use a simple 1N4148 diode as a temperature sensor since it will have approximately 2mV/C tempco. Need more sensitivity? Add two or more diodes in series.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #19 on: September 03, 2016, 12:57:31 pm »
The sensor needs to be on the end of a cable made with suitable material do I'd rather buy an off thre shelf assembly. This is not a one off.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
« Last Edit: September 03, 2016, 01:07:13 pm by Kalvin »
 

Offline madires

  • Super Contributor
  • ***
  • Posts: 7765
  • Country: de
  • A qualified hobbyist ;)
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #21 on: September 03, 2016, 01:05:45 pm »
The AVR got an internal bandgap reference, which improves the resolution, when the voltage to measure is lower than the reference's voltage. It's not accurate but stable. So you need to measure the bandgap reference first, assuming you got an accurate 5V Vcc (all done in the firmware). Then select a NTC considering the required voltage divider and temperature window.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #22 on: September 03, 2016, 01:14:30 pm »
I need to cool and environment with a fan. I have 5 target temperature 5C apart so I'd like to not over or undershoot by more than 2.5C eiher way.
Don't use an NTC but a PT1000 then. Also go for a decent 12bit ADC (which is enough to get about 0.25deg C per bit without needing oversampling) from AD or TI (and not Microchip!).
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #23 on: September 03, 2016, 02:34:15 pm »
I've finally got a spreadsheet to work and found that I will have 15-25 counts per degree C with the AVR 10bit ADC so I think an external one will be unneccesary. I'm using a 10V supply with a 18K pull up on a 10K@25C NTC, I should probably look at my options with the 1.1V ref using 5V so as to save me some circuitry.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #24 on: September 03, 2016, 03:07:52 pm »
Any reasons not to use a pre-calibrated I2C or 1-wire temp sensor?
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #25 on: September 03, 2016, 03:24:51 pm »
If this is way off, just forget about it...

You can change the range and scale of your sensor with an op amp and 4 resistors.  As a side benefit, you have low output impedance to drive whatever ADC you want.

Check out Section 4.3 of Op Amps For Everyone

http://www.cypress.com/file/65366/download

It's a simple y=mx+b exercise and can be done with a single supply op amp if you choose.

That said, it is unlikely that the component parts lead to a perfect solution so don't be surprised if you have to code up a calibration table but the good news is that you can use the entire span of the ADC over a small portion of the sensor output.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #26 on: September 03, 2016, 03:39:13 pm »
Any reasons not to use a pre-calibrated I2C or 1-wire temp sensor?

It has to come on the end of a peice of wire that is flame retardant and be plastic coated to protect from a marine environment
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #27 on: September 03, 2016, 04:24:51 pm »
Any reasons not to use a pre-calibrated I2C or 1-wire temp sensor?

It has to come on the end of a peice of wire that is flame retardant and be plastic coated to protect from a marine environment
Dunno how this requirement narrowed down your choice to particularly NTC...
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #28 on: September 03, 2016, 04:25:49 pm »
Well that an the fact i've not used I2C yet and i have a customer in a hurry for a quote and i expect they want a prototype as soon as possible.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #29 on: September 03, 2016, 04:31:56 pm »
I am looking for an instrumentation amplifier to buffer my input and while I am at it remove some of DC offset from my thermistor. If I am using the 1.1 V reference in the AVR I will end up with 380 mV at 50 degrees. I only need to measure up to 42 1/2 degrees C so I could take that 380 mV away with the instrumentation amplifier and increase my dynamic range. I don't need any gain which this particular amplifier seems to be okay with but a bit concerned about the grass showing the common mode input voltage of input versus output. I've never seen anything like this before. Thus is part look like it will work?

http://www.ti.com/lit/ds/symlink/ina826.pdf

I thought I might as well use an instrumentation amplifier instead of a standard op amp as it seems they are all just differential amplifiers which is exactly what I want anyway I want to have an output that is a difference of my input and the offset voltage I intend removing whilst buffering my signal to the ADC input.
 
The following users thanked this post: FlyIt!

Offline MarkL

  • Supporter
  • ****
  • Posts: 2131
  • Country: us
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #30 on: September 03, 2016, 05:17:15 pm »
Any reasons not to use a pre-calibrated I2C or 1-wire temp sensor?

It has to come on the end of a peice of wire that is flame retardant and be plastic coated to protect from a marine environment
I've used the 1-wire temperature sensors (DS18B20) extensively.  They are accurate (+/-0.5C from -10C to +85C) and easy to use.  Don't know about the flame-retardant aspect, but here are some choices for sealed DS18B20 sensors with various mounting options:

  https://www.adafruit.com/products/381
  http://www.embeddeddatasystems.com/Environmental-Sensors_c_44.html
  http://www.datanab.com/sensors/sensors_1wire.php

Driver libraries are readily available.  If your distance requirements are modest you don't need a 1-wire controller and you can drive the sensor(s) directly with the AVR IO pins.
 

Offline tggzzz

  • Super Contributor
  • ***
  • Posts: 19509
  • Country: gb
  • Numbers, not adjectives
    • Having fun doing more, with less
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #31 on: September 03, 2016, 06:33:24 pm »
I have had this little idea.

Unfortunately that idea has occurred to many people, and consider how flash converters are constructed. The problem can be summed up in my best Harold MacMillan voice as "Tolerances, dear boy. Tolerances"[1]. Plus my .sig is there for a reason!

Having said that, there are techniques (involving adding uncorrelated white noise) that eke out a few extra bits under some circumstances.

[1] When asked what he feared, MacMillan famously answered "Events, dear boy, Events".
There are lies, damned lies, statistics - and ADC/DAC specs.
Glider pilot's aphorism: "there is no substitute for span". Retort: "There is a substitute: skill+imagination. But you can buy span".
Having fun doing more, with less
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #32 on: September 03, 2016, 06:54:59 pm »
ATtiny24A has differential reading and gain, so you may already have the needed machinery in the chip to drop the "base voltage" and still get a good resolution. You would need a calibration step on each chip, as the gain is nominal (20x), but stable. The chip also has an internal bandgap, but on this particular AVR ("new generation") I'm not sure it's stable enough over temperature - but an ATtiny26 (not an ATtiny261) probably is.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #33 on: September 03, 2016, 07:38:39 pm »
Ah and I even checked for that and didn't see it. Yes i could use the diferential inputs of the internal ADC and do the same. I wonder what the input impedence is as a 10K thermistor with a 25K pull up may have a bit too much internal impedence.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #34 on: September 03, 2016, 08:12:30 pm »
Although I'll loose half the scale as now it's a 9bit ADC not a 10 bit one because it has to represent values with a sign. My values will almost always be positive loosing a whole half of the range.
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #35 on: September 03, 2016, 11:44:20 pm »
Although I'll loose half the scale as now it's a 9bit ADC not a 10 bit one because it has to represent values with a sign. My values will almost always be positive loosing a whole half of the range.

I think it supports both modes, bipolar and unipolar on differential conversion - read that part of the datasheet carefully, and check the fields in the ADC registers. But anyway, you could just give it a "base voltage" that is higher than your desired one (your base + half of your interval of interest) and still use the full 10 bits of the ADC.
« Last Edit: September 03, 2016, 11:48:29 pm by nuno »
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #36 on: September 04, 2016, 06:26:26 am »
Yes indeed it does, after a lot of searching, now why didn't they put that in the initial description.......
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #37 on: September 04, 2016, 07:12:42 pm »
Has the cabling been specified yet? And at what distance? And the consequences of noise picked up on that line? What is the operating temperature range?

So far, without further info, it sounds like the amount of time you might spend coming up with an analogue solution could be solved with an off-the-shelf open source library and a 1-wire (possibly even parasitic power) solution. 1-wire can work over several 100s of meters over CAT5, and you can certainly get pyro-style as well as flame retardant CAT5 if required.

 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #38 on: September 04, 2016, 07:15:09 pm »
Err the sensor previously linked to specifically says it's not for corosive environments. Others are not suitable. It's only a few centimetres just to get the sensor out of the enclosure. Plenty of filtering will go on.
 

Offline SeanB

  • Super Contributor
  • ***
  • Posts: 16284
  • Country: za
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #39 on: September 04, 2016, 07:37:14 pm »
Major problem with your approach is that the ADC has to be both linear and monotonix, which in a MCU integrated one is not going to happen, unless you are willing to sleep the MCU and do the conversion, then wake again on IRQ after conversion. This will reduce the noise by a lot, but will not make the on chip converter any more linear or monotonic.

Best is to use a PT100 film unit in a probe, which is available off the shelf in a PTFE sheathed cable unit with stainless steel sensor, 6mm diameter ( ok quarter inch by 1 inch) with any length of cable you want up to 5m. Stick in a Pt100 input stage for 3 wire operation ( either as discrete parts or as a single module, whatever floats your boat, but the module is cheap, good enough and guaranteed to work off the bat) and you get a voltage which the MCU can read easily with good resolution. just do a few samples and use a moving average ( or simply do 20-100 samples and a simple averaging, which is easy to do in a MCU by adding the 8 bit numbers into a 16 bit integer, take 256 samples and then simply lose the lower 8 bits) to get the temperature as a stable value.

Basically the input stage off a commercial temperature controller, and as a bonus no calibration required for your application, and will support sensor temps from -50 to +150C with sub 1C accuracy.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #40 on: September 04, 2016, 07:40:43 pm »
Yes i would do plenty of software filtering, I have all the time in the world to do it.
 

Offline nctnico

  • Super Contributor
  • ***
  • Posts: 26906
  • Country: nl
    • NCT Developments
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #41 on: September 04, 2016, 08:22:16 pm »
Err the sensor previously linked to specifically says it's not for corosive environments. Others are not suitable. It's only a few centimetres just to get the sensor out of the enclosure. Plenty of filtering will go on.
Look at https://www.sensorshop24.de They have all kinds of temperature sensors on wires. I recommend using a PT1000 sensor though because you don't need any amplification with a well choosen divider resistor and 12 bit ADC.
There are small lies, big lies and then there is what is on the screen of your oscilloscope.
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5319
  • Country: gb
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #42 on: September 04, 2016, 08:26:45 pm »
Yes i would do plenty of software filtering, I have all the time in the world to do it.

Hang on, I thought this was urgent!? ;-)

Quote
i have a customer in a hurry

Are you looking for a ready-made flame redardant cable with the sensor already fabricated into it on the end, or are you looking to have a custom assembly?

Anyway, I realise it's of no use to you for this application, but I did do a little test on a parasitic 1-wire DS18B20-PAR just now using a (ahem) 13A 50m mains extension reel. Worked a treat.

And no, I do not stick screwdrivers into mains outlets everyday of the week.


 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #43 on: September 04, 2016, 08:46:11 pm »
Yes i would do plenty of software filtering, I have all the time in the world to do it.

Hang on, I thought this was urgent!? ;-)



I mean the uC has all the time in the world to do filtering and everaging. As things stand I have 20 to 50 bits of resolution per degree C so I'm quite happy with a thermistor and analgue input.
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #44 on: September 04, 2016, 09:35:40 pm »
As things stand I have 20 to 50 bits of resolution per degree C so I'm quite happy with a thermistor and analgue input.

I guess you meant counts and not bits, right?
 

Offline Marco

  • Super Contributor
  • ***
  • Posts: 6721
  • Country: nl
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #45 on: September 04, 2016, 09:51:22 pm »
Major problem with your approach is that the ADC has to be both linear and monotonix

Monotonic yes, but linearity not necessarily. Depending on the application you might be satisfied with having high INL but still wanting high resolution.

Having said that, there are techniques (involving adding uncorrelated white noise) that eke out a few extra bits under some circumstances.

It has to be uncorrelated, it doesn't have to be noise. In fact if it's a known signal you can get extra bits faster than if it's noise.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #46 on: September 05, 2016, 05:15:00 am »
As things stand I have 20 to 50 bits of resolution per degree C so I'm quite happy with a thermistor and analgue input.

I guess you meant counts and not bits, right?

Yes
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #47 on: September 05, 2016, 06:27:41 am »
Step 1. Reduce range.

Only use what you need, no more!

This applies to EVERYTHING, by the way -- not just a voltage or temperature as in this case, but to analog inputs (V/I range, protection), digital inputs (logic high/low, protection), bandwidth / frequency response / bit rate (at inputs, outputs, internal nodes, whatever), dynamic range (noise level, number of bits computed) and more.

Mark with chalk and cut with an axe!

(This isn't absolute, as it depends on what's handy and cheap (a 32-bit ARM "axe" is pretty darn cheap these days, even when you only need an 8-bit butterknife).  Engineering is comprehensive, and the best solution is the one that meets all specs, including time and cost!)

So what to do here?

First, what's the cheapest and easiest approach?
- NTC thermistors have high tempco (and only modest uncertainty -- kind of marginal for present purposes, really). That sounds good for starters.
- Make a voltage divider.  Over the full NTC range, this won't give the best precision (readings bunch together at very low and very high temperatures), but for R_pullup = R25 (i.e., the thermistor's nominal value at 25C), precision is maximized in the middle (around 25C), which is ideal for a limited range.
- Amp up the signal.  Put an op-amp in front, to subtract the offset (it'll be around VREF/2) and magnify the difference.  Use a good DC-stable op-amp.  Chopper amps (Vos < 50uV, typically under 1MHz GBW -- still way more than needed here!) are available with low current consumption, at cheap prices.
- Convert it as normal.  You can -- nay, should -- still do at least a little digital filtering.  You start by filtering the analog signal (maybe with a basic RC(RC) section) to the bandwidth required (for a thermostat, 10Hz is more than enough!), which ensures the analog signal being sampled, isn't moving around much between samples.  This makes the analog voltage consistent, so you know any sample-to-sample errors will be due to the converter.  Filter this with something basic, like a 1st or 2nd order IIR filter.

You can sample at a pretty high rate, like kHz, and accumulate a few extra bits of precision.  But don't put too much trust in these, because the distance between steps is not guaranteed to be very good.  That is, the analog voltage change between ADC steps 0x20 to 0x21, need not be the same as steps 0x7D to 0x7E, or anywhere else (this is the differential error DNL).

The analog signal might not be changing all that frequently, either; if it's sitting stable on one ADC code, then you can't get extra precision no matter how many times you oversample that one code!  You can intentionally add noise (often not white noise, but something that has a long period against the ADC sample rate) to dither between values.  If the noise has an even distribution over several codes' range, then those codes will be represented equally often, except for the ones at the ends of the spread, which vary with input.

A trick might be to set the ADC sample rate at 1kHz, and set a PWM timer for 1.01kHz (or whatever's closest to 10Hz away from the actual ADC sample rate).  Run it through a good solid filter, so the square wave gets filtered down to a triangle or quasi-sinusoidal shape.  Use a voltage divider to shrink it to a few mV, then add this into the ADC input.  Now on the digital side, if you accumulate samples for 100ms and use that as a decimating filter (i.e., save the accumulator value, then reset it, every 100ms; thus generating an internal 10Hz sample rate), the dithering will have gone through a full 360 degree rotation with respect to the sample rate, so you've sampled every possible dither value, not just random ones.  Nice!

- This general plan can be tweaked and expanded, however you like.  Swap out thermistor for semiconductor sensor (LM34?).  Or Pt1000 sensor and suitable adjustments to the analog circuit (divider with compensation resistors).  Or thermocouple plus cold junction compensation (there are ICs that handle this all for you).

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #48 on: September 05, 2016, 06:33:54 am »
attached is my spreadsheet. Amplification is not neccesary, if i pull up to 5V and use the 1.1V reference then I automatically ignore the pull up headroom. All I need do then is subtract the offset.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9951
  • Country: nz
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #49 on: September 05, 2016, 06:58:16 am »
If the signal to measure is static or very low frequency you could generate a 16/32bit pwm dac. Feed it into the AVRs analog comparator along with your sample voltage and then search for the transition point in software.
Bam.... Software adc

Im not saying its a good solution. But it is pretty funny  :-DD
« Last Edit: September 05, 2016, 07:01:11 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #50 on: September 05, 2016, 07:30:59 am »
attached is my spreadsheet. Amplification is not neccesary, if i pull up to 5V and use the 1.1V reference then I automatically ignore the pull up headroom. All I need do then is subtract the offset.

If you're planning on using ATtiny24, I advise you to check what's the internal 1.1V Vref stability over temperature in your range of interest.
 
The following users thanked this post: I wanted a rude username

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #51 on: September 05, 2016, 11:49:45 am »
Hm yes 1-1.2V, not great almost a 10% shift either way. Might use an external reference. or run the thermistor from a 10V zener.
 

Offline wraper

  • Supporter
  • ****
  • Posts: 16865
  • Country: lv
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #52 on: September 05, 2016, 12:02:04 pm »
As long as NTC power is used as voltage reference for ADC (or vice versa), Their tolerance and long term stability do not matter. Everything will scale accordingly and the value read by ADC won't change. Stable ratio is all need to be kept. So I suggest using resistive divider as a voltage reference.
« Last Edit: September 05, 2016, 12:08:14 pm by wraper »
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #53 on: September 05, 2016, 12:24:08 pm »
1 - 1V2 is Vref voltage variation from chip to chip, stability over temperature is another thing.

As wrapper suggests, if you use the ADC Vref for the NTC resistor divider you'll be taking ratiometric readings and Vref can change without impact. But if you use the Vref from the AVR, you'll have to buffer it (at least in the older generation, they had nominal 32K output resistance).
 

Offline T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21686
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #54 on: September 05, 2016, 06:08:37 pm »
Note that ADC performance is degraded at lower Vref.

ATmega/tiny ADCs are shitty enough to begin with, at 5V!

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #55 on: September 05, 2016, 06:47:33 pm »
Well i can pull a Vref from the 5V supply to the AVR also used to power the NTC so ratiometric. I was thinking 2.5V for the pure simplicity of using 2 resistors of the same value.
 

Offline SimonTopic starter

  • Global Moderator
  • *****
  • Posts: 17816
  • Country: gb
  • Did that just blow up? No? might work after all !!
    • Simon's Electronics
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #56 on: September 05, 2016, 07:10:11 pm »
Even better idea. stuff the internal amp in the AVR, I'll stick with my instrumentation amplifier and amplify the result so that I recover the full 5V range, that also allows freedom of choice in the pull up and I've been able to rough linearize the counts per celcius to 9 or 10 (and can amplify by 2.5 easily getting 25 all round).
 

Offline danadak

  • Super Contributor
  • ***
  • Posts: 1875
  • Country: us
  • Reactor Operator SSN-583, Retired EE
Re: Analogue tricks to get 16 bits from an 8 bit ADC
« Reply #57 on: September 06, 2016, 01:16:49 am »
If you work with Cypress PSOC 5LP or 3 family, you get an Arm or 8051 core respectively, 20 bit
diff A/D with gain front end, onchip Vref, several OpAmps, rout-ability......plus DSP to filter
the signal path, FIR, IIR.  Tons of logic, either GUI drag and drop, or use Verilog to roll your
own from scratch. COM, LCD......

Do the error math, taking an 8 bit, then digitizing again to interpolate, you will wind up getting
less than 8 bits when all is said and done.


Regards, Dana.


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


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf