Home/Support/Support Forum/XBee + TMP36 temperature sensor - returning inaccurate values

XBee + TMP36 temperature sensor - returning inaccurate values

0 votes
I have rigged up a basic circuit as follows:
Fritzing image

The XBee is a Pro, series 2. It is configured as a Router using the AT firmware. Pin 20 (D0) is configured as an analog input. There is a co-ordinator XBee running the Co-ordinator API firmware.

When I measure the TMP36 using a multimeter, I can see a voltage of 0.752. However, the XBee is returning values of around 30 at the same time. I have a basic Python script (using the XBee Python API) running that grabs the data and outputs it as follows:

packet = xbee.wait_read_frame()
print 'Temp: ' + str(packet[0])

This is displaying the value of 30 on screen. Am I missing something obvious?
asked Nov 25, 2013 in ZigBee PRO Featureset (and legacy ZNet 2.5) by Fistameeny New to the Community (0 points)

Please log in or register to answer this question.

4 Answers

+1 vote
You need to wire-up VREF (Pin 14) before you'll get any useful values from the A/D. I usually tie it to VCC.

Of course, you'll also need to parse the packet for a value for "adc-0" , then convert it to an actual voltage using V=(VREF)(adc-0)/1023, and finally a temperature using T= (100)(V) - 50.
answered Dec 9, 2013 by abythell New to the Community (3 points)
Thanks for your reply. I understand the series 2 XBees have an internal VREF, so that shouldn't be necessary.

I think i've tracked the issue down to the power supply. When running the circuit from batteries, the reading is much more accurate. I think the USB  explorer must be introducing some noise along the way. I'm now looking at wiring up a circuit with a voltage regulator to see if that's more reliable.
0 votes
I am satisfied with you and you are in right .
answered Dec 2, 2013 by Lynelle412 New to the Community (1 point)
0 votes
Interesting, I'm currently using a 3V Lithium Battery Powered XBee S2C TH with the MCP9700A Temperature Sensor. I have also found that the XBee ADC's are giving me strange inaccurate results.
I've contacted the Digi Tech Support and they inform me the ADC's have a +-20mV Error which translates to +-2 DegC which is totally unacceptable.
I'm hoping the Digi Engineers will add a ADC calibration routine to eradicate the +-20mV error into a Firmware upgrade some time soon.

I've created my own ADC calibration routine using linear equation y=mx+c which works well but I'd prefer Digi to solve it in a more elegant way.
answered Nov 9, 2015 by AndyDale New to the Community (10 points)
The +-2mV is not related to the firmware but to the hardware and its tolerance.  As a result, there is not much Digi can do with firmware.
+-20mV is the ADC Error which could be calibrated out using the FIRMWARE!
Hi man I have a question for you, I am a new xbee user, I got 2 xbee s2c, and I want to know if I can transmit from one of the xbee modules the data get from a temp sensor to the other xbee without any microcontroller (Arduino, raspberry pi, etc). I mean like set a periodically transmission of analog values
Sure you can.  You just need to make sure you get the right sensor.  Some output an Analog voltage that is  0 - 1.2V, others 5V and still others UART data.
Yes I'm using the MCP9808 I2C temperature sensor instead of relying on the ADC accuracy. I've heard that the Xbee ADC issues have now been solved by DiGi but I haven't had time to revisit this project as I endid up using the ESP8266.
0 votes
I had the same problem with LM35. I was using a 5V/120 mA power supply and then the analog input values were totally crazy. So I needed to replace the 120mA supply for a bigger one, in my case I had another one of 3A.

As to the calculation I made a circuit adjustment as you see bellow and the formula (AD0*5*100)/1024.


| LM35 |
|
Out
|
|
15kΩ ----> AD0
|
|
30kΩ
|
|
Gnd

ps. don't forget to connect Vref to Vcc (3.3v)
answered Jun 5, 2018 by jeffersonfp New to the Community (3 points)
...