TMP36 Temperature Sensor/SB Protoshield
#21
Posted 19 February 2011 - 05:55 PM
How do I make the TMP36 temperature sensor more resistant to variances in input voltage? Can I compensate by dynamically reading the aref voltage? How do you read the aref voltage on the internal aref pin on the Netduino?
#22
Posted 25 February 2011 - 01:10 AM
#23
Posted 15 April 2011 - 02:31 PM
#24
Posted 12 October 2011 - 04:51 PM
I'm new in the Netduino community, thanks in advance for your help!
I've tried the Jason Smith schema with the Chris Walker recommendations and the tamberg annotation using a LM335 sensor instead of a TP36 one. I attach the resulting schema and the code I'm using to get the Celsius degrees.
private double GetLM335Temp(int ADC_Value) { double voltage = 3.3 - (ADC_Value * 3.3 / 1024); double tempC = (voltage - 0.5) * 100; return tempC; }
It seems it works correctly but I have some questions about it:
- There are no similar schemas in the LM335 datasheet (http://www.sparkfun....ature/LM135.pdf): what are the differences between both sensors? Should it work?
- I have seen a calibrated sensor schema in the datasheet. Do I need a calibrated sensor schema to get the correct temperature values? I'm not sure how to do it, can anybody help me?
Thanks so much!
#25
Posted 12 October 2011 - 06:37 PM
Oh, well...either you posted a wrong picture about how to connect the probe, or I'd suggest you to detach immediately!
Your bottom picture is the correct one, but the Fritzing wiring picture is not the same, and you may even burning the probe.
Here is the original datasheet.
The differences among the 135/235/335 are only about the temperature range capability (top-right of page 2).
The ideal circuit would be a constant-current source instead of R1. Anyway, let's keep it easy.
Instead, R1 should be chosen accordingly to the available V+, that is the supply of the probe. Since the probe is designed to drop 2.98V @ 1mA @ 25'C (page 2), I suggest to use the +5V supply instead of the +3.3V, because it is too close to the working point.
Thus, the Ohm's law tell us that:
R1 = (5 - 2.98) / 1 mA = 2020 Ohms
Of course it's a strange value, but you may obtain by placing in series two very common values as 1.8K and 220 Ohms.
The 10K trimpot is also required for a better calibration.
Last thing...
The specs (page 1) state that the probe increases its voltage drop of 10mV for each Kelvin (i.e. Celsius).
Since the max absolute voltage that can be applied on any analog input of the Netduino is +3.3V, you can't measure temperatures above:
Tmax = 25'C + (3.3 - 2.98) / 10mV = 57'C
If that is an issue, you must add some extra hardware to "squeeze" the voltage within the reliable bounds.
Hope it helps.
Cheers
#26
Posted 13 October 2011 - 01:41 PM
#27
Posted 13 October 2011 - 07:30 PM
I've tried it again Mario and this is the resulting schema.
And the code I'm using to get the Celsius degrees.
double voltage = ADC_Value * 5.0 / 1023; double tempK = voltage * 100; double tempC = tempK - 273.15;
I think I have done it correctly this time, but I get values between 180 and 190.
Is there something wrong? Do I need to do a calibrated sensor?
Thanks for your help!
#28
Posted 14 October 2011 - 03:55 AM
#29
Posted 15 October 2011 - 11:35 AM
I used a potentiometer and this is the resulting schema:
I calibrated the potentiometer for reading 2.982 V at 25 degrees, is that correct?
It seems to work properly! When the Ethernet connector is plugged in, I get values with differences up to 10 degrees. Without the connector the difference is less than 2 degrees.
Can I avoid the jittering? If not, I will program an average algorithm.
Thanks so much Mario!
#30
Posted 15 October 2011 - 12:38 PM
Is the same component a potentiometer than a trimpot?
I used a potentiometer and this is the resulting schema:
I calibrated the potentiometer for reading 2.982 V at 25 degrees, is that correct?
It seems to work properly! When the Ethernet connector is plugged in, I get values with differences up to 10 degrees. Without the connector the difference is less than 2 degrees.
Can I avoid the jittering? If not, I will program an average algorithm.
Thanks so much Mario!
I have found that adding 100uF across the +5V and +3.3 volt power supplies helps remove much of the jitter on the ADC conversions. I also use averaging software like this:
<snip> // take three readings, spaced a bit in time // insist that all three results are 'close' // then take the average ds2 = ADC1.Read(); Thread.Sleep(delay); ds3 = ADC1.Read(); limit = 20; // max number of loops do { Thread.Sleep(delay); ds1 = ds2; ds2 = ds3; ds3 = ADC1.Read(); } while (!near(ds1, ds2, ds3) && (--limit > 0)); int value = average(ds1, ds2, ds3); <snip> public static Boolean near(int x, int y, int z) // compare three samples { if (abs(x - y) > 1) return false; if (abs(x - z) > 1) return false; if (abs(y - z) > 1) return false; return true; } public static int abs(int x) { if (x >= 0) return x; return -x; } public static int average(int x, int y, int z) { return (int)(System.Math.Round(x + y + z) / 3.0); }
If you have only one input to the ADC, your value may settle down faster than mine does. Since there is only a single ADC conversion register, switching between analog inputs means waiting longer for the process to arrive at a "good" digital value.
#31
Posted 15 October 2011 - 01:00 PM
#32
Posted 15 October 2011 - 01:44 PM
-- H.L. Mencken, "What I Believe"
#33
Posted 15 October 2011 - 01:52 PM
The main difference between Rev A and Rev B is just the Aref short, which is missing on Rev A (the mine).I might be mistaken, but I think on rev a boards there is no internal connection between aref and 3.3v? And his wiring is without a connection to aref, so it should be rev b.
Well, you are probably right, since he didn't draw the Aref wiring on his Fritzing picture.
If so, it means that neither the Aref filtering (double cap + inductor) solved the jittering problem.
However, I'm setting up a small circuit...maybe I'll try something.
Cheers
#34
Posted 15 October 2011 - 03:44 PM
#35
Posted 15 October 2011 - 04:09 PM
There is an interesting thing to know about the ripple on the ADC.
I own a "Revision A" board, and I've noticed that on "Revision B" there is a good filter on the Aref signal.
You both guys, what revision is marked on your board?
(The mark is printed close to the analog inputs).
Cheers
Hi Mario,
My boards are Rev B.
Thanks,
Robert
#36
Posted 03 November 2011 - 09:28 PM
#37
Posted 04 November 2011 - 05:03 AM
Why are you using this formula?I'm using port A1, why am I getting 198 as a value when it really is about 24 celcius? I'm using LM335Z
double voltage = tempA1.Read() * 3.3 / 1024;
double tempC = (voltage - 0.5) * 100;
Anyone could help please?
Cheers!
Coco
Assuming that 198 is the value on "tempC", it seems that the probe is working correctly.
First off, avoid using "double", which is much more heavy to manage, and you don't need an high precision. The float (Single) is surely better in this context, and *probably* the CPU is able to manage them natively.
float voltage = tempA1.Read() * 3.3f / 1024; //note the "f" suffixAfterward, the probe should give a voltage of 2980mV (i.e. 2.98V) at 25'C, thus:
float tempK = voltage / 10; //temperature in Kelvin float tempC = tempK - 273; //temperature in CelsiusCheers
#38
Posted 21 February 2014 - 03:13 PM
A few quick things: 1. Netduino's analog inputs are 3.3V (instead of 5.0V). Power the temperature sensor from the 3.3V power header instead of the 5.0V power header. 2. The ARM chip on the Netduino (Rev A) does not have an internal analog reference (unlike the AVR used on the Arduino)--so you'll need to wire the 3.3V power header to the AREF pin header. Other than that, I believe you should be good to go! Chris
Hi Chriss,
could you like to paint the wiring 3V3 with AERF... for me to better understand. Secondly my netduino has no AREF..there is IOREF port..is it the same ?
thanks for answer
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users