[Noisebridge-discuss] troubles with temperature probe - LM35DZ and arduino

John Withers jwithers at reddagger.org
Tue Jul 31 04:39:43 UTC 2012


You want to change the line that says:
 float temperatureC = (voltage - 0.5) * 100 ;

Do math things on that there and it will change the output. There is
another one lower that is tempratureF, you can do mathiness on that line
as well.

Personally I would have put this up on paste site somewhere and provided
a link to the code and description of the problem, but that's just me.

Also I will be around NB tomorrow evening, as I am sure will be better
sensor hands than I, and can help you if necessary. I have a red dagger
tattooed on the side of my neck, hard to miss.

j

On Mon, 2012-07-30 at 20:39 -0700, Frantisek Apfelbeck wrote:
> Hi to all,
> I have moved to testing the temperature sensor/probe LM35DZ for the
> experimental incubator which is now being finally in service. I have
> used the arduino sketch which I have found at adafruit webpage and
> which I posted below for the probe to get the temperature readings (in
> Celsius) displayed at the serial monitor. The temperature is around 50
> degrees below the one measured by digital thermometer. So if I use a
> digital thermometer and it says it is 25.5 C, the LM35DZ tells me at
> serial monitor it is around -25 C (room t), when submerged in to the
> warm water digital thermometer shows 42C, probe -9.96C (not completely
> submerged, it is not water tight yet). Do you have idea how to change
> the script so it shows corresponding temperature? I use 5 V.
> 
> 
> 
> I also wonder if the sensebridge would be the place to ask in the
> future, because it is likely I'm going to have more questions about
> similar sensor and arduino related topics.
> 
> 
> Thanks a lot for any help,
> 
> 
> Sincerely,
> 
>  
> Frantisek Algoldor Apfelbeck
> 
> 
> 
> 
> 
>      1. //TMP36 Pin Variables
>      2. int sensorPin = 0; //the analog pin the TMP36's Vout (sense)
>         pin is connected to
>      3.                         //the resolution is 10 mV / degree
>         centigrade with a
>      4.                         //500 mV offset to allow for negative
>         temperatures
>      5.  
>      6. /*
>      7.  * setup() - this function runs once when you turn your
>         Arduino on
>      8.  * We
>          initialize the serial connection with the computer
>      9.  */
>     10. void setup()
>     11. {
>     12.   Serial.begin(9600);  //Start the serial connection with the
>         computer
>     13.                        //to view the result open the serial
>         monitor 
>     14. }
>     15.  
>     16. void loop()                     // run over and over again
>     17. {
>     18.  //getting the voltage reading from the temperature sensor
>     19.  int reading = analogRead(sensorPin);  
>     20.  
>     21. // converting that reading to voltage, for 3.3v arduino use
>         3.3
>     22.  float voltage = reading * 5.0;
>     23.  voltage /= 1024.0; 
>     25. // print out the voltage
>     26.  Serial.print(voltage); Serial.println(" volts");
>     27.  
>     28. // now print out the temperature
>     29.  float temperatureC = (voltage - 0.5) * 100 ;  //converting
>         from 10 mv per degree wit 500 mV offset
>     30.                                                //to degrees
>         ((volatge - 500mV) times 100)
>     31.  Serial.print(temperatureC); Serial.println(" degrees C");
>     32.  
>     33. // now convert to Fahrenheight
>     34.  float temperatureF = (temperatureC * 9.0 / 5.0) + 32.0;
>     35.  Serial.print(temperatureF); Serial.println(" degrees F");
>     36.  
>     37.  delay(1000);                                     //waiting a
>         second
>     38. }
> 
> 
> 
> 
> biotechnologist&kvasir and hacker
> 
> 
> http://www.frantisekapfelbeck.org
> 
> 
> 
> "There is no way to peace, peace is the way." Ghandi
> 
> _______________________________________________
> Noisebridge-discuss mailing list
> Noisebridge-discuss at lists.noisebridge.net
> https://www.noisebridge.net/mailman/listinfo/noisebridge-discuss





More information about the Noisebridge-discuss mailing list