More accurate ADC on SPI

From the post: http://www.tinyclr.com/forum/topic?id=8951

Let’s say that i use SPI. Google said that SPI is more appropriate for ADC. What do you think about this one (http://si.farnell.com/texas-instruments/ads1158irtct/ic-adc-16bit-16ch-delt-sig-48qfn/dp/1754685)?
It has 16 channels which is perfect for me.

Then what? I need to make own module based on S socket.

You have to think about a project like this as two separate pieces.

First piece is selecting a chip that performs your function.

When I search for ADS1158IRTCT on the AU Element14 site, the chips on offer are expensive… $16 each. Ouch. If that chip you point out meets your needs and doesn’t break the balance, great. But lets ask a few questions to see if you need it’s features, what sample rate of how many voltages do you need to measure, and with what resolution? That chip seems overkill to me, on many levels :slight_smile: If you want multiple inputs you can always use a single channel ADC and a multiplexer, for example https://www.sparkfun.com/products/299 that will give you your 16 inputs.

Second piece you need is to understand how it communicates data back to a host processor. In many cases, I2C or SPI are common ways to do that. Once you pick a chip, if you have options in that family you could choose whatever comms option you felt most comfortable with - if you love SPI but have never used I2C then you should go with I2C so you learn something :slight_smile: Nah choose one you want; in a Gadgeteer scenario you may choose one that doesn’t consume a critical resource, if you have any.

Then it’s just a matter of figuring out how to wire it up! This usually means you’ll want to design a PCB and make one unless you can find a breakout board for your particular chip (in fact, sometimes it’s better to start by looking for a breakout board to suit your needs).

Maybe it would be better to tell what i need.
I have 10 temperature sensors (from -50°C to 300°C; accurate to 0,1°C).
With Spider 10 bit analog inputs I get 1024 combinations. 350 / 1024 =0,34°C. I would like 0,1°C. Theoretical 12 bits would be enough (350/4096=0,085). But what if i replace sensors with higher temperature. So why not use 16-bit ADC.
In 1 second I want to measure temperature maximum 10 times for each sensor. That gives 100 calculations.

After your post, I am thinking to use 16 channel multiplexer and 16-bit ADC with SPI. Is this OK?

What is the voltage output of the sensor? Is it 0V at -50C and 3V3 at 300C? If it isn’t then you need to do your calculations again.

Hey. The manufucturer provide this table:
-20°C = 922 ohm
0°C = 0 ohm
100°C = 1385 ohm
195°C = 1740 ohm

Hope this helps?

Nope, we’re not going to do the conversion to voltages for you :slight_smile:

Seriously, that sensor looks freakily hard to use. 0 ohm at 0 degrees, and somewhere about 60 degrees it’s the same resistance as -20? Woooooow. That’s tricky.

Have you even tried the sensor on your standard ADC on a Fez? Make that work at 10-bit resolution and figure out your lookup table for temperatures from voltages would be my #1 suggestion !

Ou. I am sorry. My mistake:
-20°C = 922 ohm
0°C = 1000 ohm
100°C = 1385 ohm
195°C = 1740 ohm

They say that this sensor is standard Pt1000.

That is better.

There is no way that you will get 0.34°C on an 10bit ADC. You will probably not get that at 16bits. But I don’t have time, or energy( :slight_smile: ), to do that calculations right now.

I don’t think that calculations is the problem.
2^16 = 65536
So if resistor go from 922 to 1740 ohm that means that the difference is 818 ohms.
If we divide 818 ohm with 65536 possible combinations we get 0,0125.

So, if I am correct, then i can get with 16-bit 0,0125 step. This is my accuracy.

The only question left is, which multiplexer (probably something like this https://www.sparkfun.com/products/299) and ADC to choose. The manufucturer said that the best voltage for this sensors would be 1,2 or 1,5V.

Makla, you need to calculate what the VOLTAGE will be, not the resistance, and then divide that by the number of bits. You have to design how best to generate 0v to 3v3 with the resistance range you have. Otherwise you will not get the ability to use the full 65k increments.

But again, just because you can read something with a particular resolution does not mean the value you then calculate is more accurate than it would have been using a lower resolution. That is a function of the device.

And finally, remember to improve the accuracy of your readings you need to be doing all this with a good understanding of your circuit design impacts (trace width and length differences for example). Are you up for the challenge? What are you measuring anyway - all 16 sensors will be sitting next to each other ?

1 Like

I want to measure water temperature in solar water tank, solar panel …

I will find someone to help calculate things. As you probably already discover I am not a hardware guy, but I want to learn some basic stuff.

ok, a quick Bing will find you other projects that use PT1000, to give you a leg up on figuring out how to wire one up to get a decent detection range. And since you have a likely range of temperatures, you may be able to bias it to give a better range in the usable area.

But here’s the thing.

You’re going to measure the temperature of water, or the air around the panels. Does it matter that the temperature is 54.4deg versus 54.41deg or 54.49 deg? Does it matter that it’s 54.4 or 54.3? And does it change by any reasonable percentage in one second, let alone a minute?

Don’t worry, I’m all for overkill, but this is one particular instance where you don’t need to go to the lengths you’re contemplating.

And in fact, I personally would suggest you’re using the wrong tool for the job - let me tell you why. Assuming you’re not going to mount a fez on the roof with the sensors, you’re going to run cables from the panel on the roof to the Fez. Assuming that’s located relatively conveniently so that you can see what the temperature is, you’re going to run cables. And those cables will have electrical characteristics that will vary - and possibly so over time, especially those exposed to temperature and the elements (esp UV!) At the end of those cables, you’re measuring the difference in voltage when the resistance of the sensor varies from 922 ohms to 1740 ohms - a very small change. So those cables, even if you take time to calibrate your sensor on those cables, in-situ, will change over time and your readings will become at least out-of-calibration and possibly unreliable.

So here’s where I would consider using a DS18B20, which is essentially a device that measures temperature at the sensor location and then provides a digital signal that you will much more reliably read than a small voltage differential at the end of a dodgy string of wire.

1 Like

Thanks for your time.

I must say that i already use this system. The guy who sold it to me build it and use http://www.seltron.eu/index.php?mod=products&prod_id=2184
I agree with everything you say.
The good thing about this system is that sensors are build just for this kind of system. (http://mcs.si/web_slike/1483_Pt1000_senzor.jpg).

I was thinking to use 4-wire telephone cable (already placed) and use this ADC with SPI beneath the roof (sensor cable is 3m long).

But now, i am not sure for anything.

If you have stuff working, and have bought everything, there’s not really any reason NOT to use it. But for me it wouldn’t have been my first choice. The accuracy of those sensors with that distance from sensor to Fez is not a problem, but does’t really require high resolution (this is the real piece I’d try to dissuade you from bothering with, at least initially).

Anyway, so from here, how many sensors do you have now, and how many do you really intend to use?

For your purposes I really think the inbuild 10-bit ADC sample will probably be fine; in fact, I think it’d be worth setting up one sensor and measure it over time to see how much it really changes; log your temperature to SD card and look at it after a couple of days. You’ll get an idea how much variation there is (my bet is it won’t change fast; sure, day to night the delta will be visible but second to second or minute to minute are less likely to see big changes).

The Sparkfun multiplexer you showed is fine in my view; again it’s unlikely that any issues with it will be an issue when all the variabililty in your system is taken into account. That, in front of the Fez ADC, will work fine for your experiments and it’d be a low-cost way to try it out.

Oh, and the Seltron controller; do you have any idea what resolution the ADC is in that? How many samples they average before saying the temperature is actually that value? I suspect they have quite a lot of inbuilt logic to handle this, and I doubt they have a $20 ADC running the show.

1 Like