Help - using two TMP36's simultaneously?


hi everyone,

i have quick question regarding use of 2 tmp36 (http://www.ladyada.net/learn/sensors/tmp36.html). lots of out there know answer this, i'm pretty new , still learning how works...

i trying use 2 tmp36's , arduino temperature info each thermistor (each tmp36 in slighly different locations). went ahead , tried write code (see attached) see if gather temperature info connecting 2 tmp36's analog voltage output pins different analog pins in arduino (a0 , a1), using following code below. other pins connected same ground , same 5v pin in arduino (as shown in tmp36 tutorial - http://www.ladyada.net/learn/sensors/tmp36.html).


the code:

code: [select]

//tmp36 pin variables
int sensorpin = 0; //the analog pin tmp36's vout (sense) pin connected to
                        //the resolution 10 mv / degree centigrade a
                        //500 mv offset allow negative temperatures

int sensorpin1 = 1;


/*
* setup() - function runs once when turn arduino on
* initialize serial connection computer
*/
void setup()
{
  serial.begin(9600);  //start serial connection computer
                       //to view result open serial monitor
}

void loop()                     // run on , on again
{
//getting voltage reading temperature sensor
int reading = analogread(sensorpin); 
delay(10);
// converting reading voltage, 3.3v arduino use 3.3
float voltage = reading * 5.0;
voltage /= 1024.0;


// print out temperature
float temperaturec = (voltage - 0.5) * 100 ;  //converting 10 mv per degree wit 500 mv offset
                                               //to degrees ((volatge - 500mv) times 100)
serial.print(temperaturec);
serial.println(" degrees c sensor 0");


int reading1 = analogread(sensorpin1); 
delay(10);
  float voltage1 = reading1 * 5.0;
voltage1 /= 1024.0;


float temperaturec1 = (voltage1 - 0.5) * 100 ;  //converting 10 mv per degree wit 500 mv offset
                                               //to degrees ((volatge - 500mv) times 100)
serial.print(temperaturec1);
serial.println(" degrees c sensor1");

 
delay(1000);                                     //waiting second
}


when run code in arduino, odd values:

-50.00 degrees c sensor1
-34.86 degrees c sensor 0
-47.56 degrees c sensor1
-49.51 degrees c sensor 0
-50.00 degrees c sensor1
-45.61 degrees c sensor 0
-50.00 degrees c sensor1
-49.51 degrees c sensor 0
-50.00 degrees c sensor1
-49.51 degrees c sensor 0
-50.00 degrees c sensor1
-50.00 degrees c sensor 0
-50.00 degrees c sensor1

since spring right now, these temperature results seem kind of off...

does know if doing wrong? coding-wise? connections-wise?

any thoughts newbie appreciated...

thank you!!



it seems adc reading 0 sensor 1, , close 0 sensor 2 - guesses have them wired wrong..

how connected? remember pin 1 vcc, pin 2 vout , pin 3 gnd (with flat side facing you)


Arduino Forum > Using Arduino > LEDs and Multiplexing > Help - using two TMP36's simultaneously?


arduino

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial