I Mean:
5V goes trougth a 2.2K resistence (R1) to the middle PIN of LM335Z. From the same path the signal goes back to arduino to analog0.
Seeing LM335Z from bottom view, the right pin is connected to ground.
ADJ pin of LM335Z is not connected.
#include <LM335A.h>
float raw;
LM335A InsideTemp(0); //pass the analog input pin number
void setup() {
Serial.begin(9600);
Serial.println("starting");
}
void loop() {
delay(1000);
//user must call ReadTemp before any valid temp data is available
raw = analogRead(0);
InsideTemp.ReadTemp();
Serial.print("Raw: ");
Serial.print(raw);
Serial.print("\tFahrenheit: ");
//functions to get the temperature in various unitsfs
Serial.print(InsideTemp.Fahrenheit());
Serial.print("\tCelsius: ");
Serial.print(InsideTemp.Celsius());
Serial.print("\tKelvin: ");
Serial.print(InsideTemp.Kelvin());
Serial.print("\n");
}
yes, if i warm up the sensor, the values are increasing...
i think... not sure... its correctly connected... ive tested 2 different lm335z, same values.
at this point i think there is a kind of operation to adjust/calibrate the values.... but I dont know if and how.
any help apreciated
-edit-
Note: I'm not sure it's important, BTW the arduino is powered by USB connection on PC.
This is not too surprising. The initial uncalibrated accuracy is +/-3 degrees or so from the nominal 25C, plus you have the +/-3 LSB (or so) built in to the A/D converter (which can give an error of +/-1.5-2 degrees). That your readings are 6 degrees away from room temperature (and how confident are you in that measurement?) is reasonable.
To calibrate the sensor, connect a potentiometer across the sensor, with the adjustable ("wiper") terminal connected to the adjustment terminal. Adjust the pot to read the correct voltage at a known temperature, and that should be it.
--
The Quick Shield: breakout all 28 pins to quick-connect terminals
I'm really sorry, but could you give me more detailed instructions on how calibrate it? To start I have a digital precise temperature sensor that could give me exact ambient temperature (if needed). Or is enough to calibrate it software editing the code? (exactly no idea how too).
Thank's a lot (meanwhile I'm googling too ;))
If you have a precision digital temperature sensor you can use as a reference, that is good. Take its reading -- let's say it is 21C. That is 294K. You then want to adjust the potentiometer that you have connected to the LM335Z until the output of the LM335Z reads 2.94V.
The top of page 6 of the LM335Z datasheet shows how to hook up this potentiometer:
Thank you!
I'll take a look to the document.
A question. There is mentioned I need a potentiometer to set the correct "offset" and calibrate the temperature.
When finished do I need to leave the potentiometer attached?
In addiction, could I calibrate it via software, calculating the offset and simply apply it?
Well, you need to leave the potentiometer attached if you want the product to maintain the voltage you calibrated it to. However, you could do the following:
a) Measure the uncalibrated voltage (no potentiometer)
b) Measure the calibrated voltage (with potentiometer properly adjusted)
c) Remember the difference between them and put this in your software.
Then, you can remove the potentiometer and compensate for the difference between calibrated/uncalibrated readings in software.
I forgot to mention that the "5" in your calculations (e.g., x/1023*5) is really the 5V supply to your board, which is not necessarily exactly 5V, especially when powering the board from USB as you say. You should expect some variation due to this issue, and definitely variation from computer to computer.
--
The Quick Shield: breakout all 28 pins to quick-connect terminals
The LM335s require a rock solid analogue reference voltage to give accurate readings. The aref comes from the 5v line and if its powered from a typical USB it is probably some way from 5v (typically 4.7 - 4.8 v). It will probably give better readings if you power it from the DC jack.
Thank you RuggedCircuits for the support, really appreciated!!
I'm happy to start understood how all this works even if I've a lot to learn
Pluggy, thank you too for the suggestion.
Yes, arduino is powered from USB. If this is unstable, that could be thecause of my offset. Very well
Another question concern the arduino:
I've tried to power it with external 12V DC adapter (arduino + ethershield). It becomes very hot after some minutes also I've choosed to stay on PC usb. I've read it's "normal" with the ethershield and 12V power.
What is the suggested power adapter for my pruposes?
When is better to increase the V of the power adapter?
Thank's!
I think for this thread I've no other question.... forthis thread :)))
What is it that becomes hot, the Arduino or Ethershield?
The "best" power adapter is 7V. It should be rated for at least the amount of current drawn by an Arduino (~30-40mA) plus the Ethershield (??? mA). The lower the voltage the better as it minimizes heat loss in the voltage regulator on the Arduino. Below 7V, however, there is a risk that you won't get a proper 5V supply voltage.
For this reason a 9V adapter is better than a 12V adapter if you don't have 7V.
--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons
Yep, the arduino's voltage regulator does get hot with 12V and an ethernet shield. I have an old phone charger that kicks out about 8.5 volts on load, its quite happy with that.
Thank's a lot to all for suggestions.
I'll check the issues with power adapter in these days.
Meanwhile I've another question concern the themperature sensor.
All works well, but on arduino I have 1 sensor and 1 led. If I turn the led on, I think the sensor is receiving minor power and so the valure obtained is different. If I turn the led off, the value goes back to right value again. Will this solved with a good power adapter?