Pages: [1]   Go Down
Author Topic: LM 34 temperature sensor shutting off Serial Port  (Read 716 times)
0 Members and 1 Guest are viewing this topic.
Auckland, NZ/ Yonkers New York
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

LM 34 temperature sensor shutting off Serial Port...

Hi there, thought I might seek some help at this stage.

I've wired up a LM 34 temperature sensor to an Arduino Diecimila (with ATMEGA 328) with: Ground to Gnd, Vs pin to +5V, and the sensor output (middle leg) to Analogue 0 IN.
As soon as I insert the wire from the +Vs pin of the LM34 into the +5V of the Arduino, I lose the Serial Port (tty) and hence the serial monitor updates that print the temperature back to my MacBook Pro.

Has anyone experienced a similar issue and/or has any suggestions of what to try/what might be wrong?
Many thanks!

Rich:

Arduino 0014 IDE
Macbook Pro OS X 10.5.4 Intel
Arduino Diecimila with ATMEGA 328
LM 34 temperature sensor

Code*****
/*

An open-source LM35DZ Temperature Sensor for Arduino. (cc) by Daniel Spillere Andrade

*/

int pin = 0; // analog pin
int tempc = 0,tempf=0; // temperature variables
int samples[8]; // variables to make a better precision
int maxi = -100,mini = 100; // to start max/min temperature
int i;

void setup()
{
  Serial.begin(9600); // start serial communication
}

void loop()
{
  
  
for(i = 0;i<=7;i++){ // gets 8 samples of temperature
  
  samples = ( 5.0 * analogRead(pin) * 100.0) / 1024.0;
  tempc = tempc + samples;
  delay(1000);

}

tempc = tempc/8.0; // better precision
tempf = (tempc * 9)/ 5 + 32; // converts to fahrenheit

if(tempc > maxi) {maxi = tempc;} // set max temperature
if(tempc < mini) {mini = tempc;} // set min temperature

Serial.print(tempc,DEC);
Serial.print(" Celsius, ");

Serial.print(tempf,DEC);
Serial.print(" fahrenheit -> ");

Serial.print(maxi,DEC);
Serial.print(" Max, ");
Serial.print(mini,DEC);
Serial.println(" Min");

tempc = 0;

delay(1000); // delay before loop
}

END OF CODE*****

Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 331
Posts: 16548
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
As soon as I insert the wire from the +Vs pin of the LM34 into the +5V of the Arduino, I lose the Serial Port (tty) and hence the serial monitor updates that print the temperature back to my MacBook Pro.


I would first check for a wiring error or bad LM34 first. When you wire the +Vs pin to the Arduino's +5vdc what voltage do you then measure at the Arduino's +5vdc connection?

Lefty

Logged

Auckland, NZ/ Yonkers New York
Offline Offline
Newbie
*
Karma: 0
Posts: 24
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Lefty,

Thanks for your prompt and accurate advice :-)

I swapped out the LM 34 with a fresh one and then 'hard wired' it with connectors instead of using the breadboard. It now remains connected and I just tried it a frozen pea - this immediately brings down the temp displayed in the serial monitor.

Thanks again for the simple but effective advice,

Rich. smiley
Logged

Pages: [1]   Go Up
Jump to: