Inaccurate result when combining LM35 + XBee

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Inaccurate result when combining LM35 + XBee

Postby cutie_lovely_92 » Fri Jan 04, 2013 3:21 am

I am currently doing a project reading Body temperature and pulse sensor that will sent the result wirelessly through XBee.
I started by trying each components separately and everything works fine.

Problem:
Inaccurate result when I combine the XBee and LM35 sensor.
The sensor keep giving the same result. Here's the sketch output.
Code: Select all
LM35 Thermometer
Analog in reading: 1023 - Calculated Temp: 109.8
Analog in reading: 1023 - Calculated Temp: 109.8
Analog in reading: 1023 - Calculated Temp: 109.8
Analog in reading: 1023 - Calculated Temp: 109.8



I am very sure that before combining it with XBee everything works just fine.
Can anyone explain to me what's the problem here?
Do it need any voltage adjustment or something?
cutie_lovely_92
 
Posts: 21
Joined: Fri Jan 04, 2013 2:59 am

Re: Inaccurate result when combining LM35 + XBee

Postby adafruit_support_bill » Fri Jan 04, 2013 6:43 am

Post a photo showing all your connections. And post the code you are using too.
User avatar
adafruit_support_bill
 
Posts: 16042
Joined: Sat Feb 07, 2009 9:11 am

Re: Inaccurate result when combining LM35 + XBee

Postby cutie_lovely_92 » Fri Jan 04, 2013 12:48 pm

adafruit_support wrote:Post a photo showing all your connections. And post the code you are using too.


Code: Select all
#include <SoftwareSerial.h>

SoftwareSerial xbee(2, 3); //RX, TX

int potPin = 0;
float temperature = 0;
void setup()
{
  Serial.begin(9600);
  Serial.println("LM35 Thermometer ");
  analogReference(INTERNAL);
  xbee.begin(9600);
}
void printTenths(int value) {
  // prints a value of 123 as 12.3
  Serial.print(value / 10);
  xbee.print(value/10);
  Serial.print(".");
  xbee.print(".");
  Serial.println(value % 10);
  xbee.print(value % 10);
}
void loop() {
  int span = 20;
  int aRead = 0;
  for (int i = 0; i < span; i++) {
    aRead = aRead+analogRead(potPin);
  }
    aRead = aRead / 20;
    temperature = ((100*1.1*aRead)/1024)*10;
    // convert voltage to temperature
    Serial.print("Analog in reading: ");
    Serial.print(long(aRead));
    // print temperature value on serial monitor
    Serial.print(" - Calculated Temp: ");
    xbee.print(" - Calculated Temp: ");
    printTenths(long(temperature));
   
    delay(500);
}
Attachments
photo.JPG
The Xbee connected to PC through Xbee USB shield.
photo.JPG (432.42 KiB) Viewed 313 times
image.jpeg
The Xbee shield v1.1 connected to Arduino UNO R3. The LM35 is on the breadboard, mark with red box.
image.jpeg (449.51 KiB) Viewed 313 times
cutie_lovely_92
 
Posts: 21
Joined: Fri Jan 04, 2013 2:59 am

Re: Inaccurate result when combining LM35 + XBee

Postby adafruit_support_bill » Fri Jan 04, 2013 1:13 pm

Appears to be wired right. But your raw reading is at max scale. You should contact the seller of the LM35.
User avatar
adafruit_support_bill
 
Posts: 16042
Joined: Sat Feb 07, 2009 9:11 am


Return to Arduino

Who is online

Users browsing this forum: No registered users and 14 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [103]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[109]
 
Wireless[14]
Cables[61]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]
cron