Hello!
Has anyone made a wireless Xbee temperature sensor with the TMP36 and the Xbee using just the ADC on the Xbee itself?
Thanks in advance,
Chris
Moderators: adafruit_support_bill, adafruit
from xbee import xbee
import serial
SERIALPORT = "COM4" # the com/serial port the XBee is connected to
BAUDRATE = 9600 # the baud rate we talk to the xbee
# open up the FTDI serial port to get data transmitted to xbee
ser = serial.Serial(SERIALPORT, BAUDRATE)
ser.open()
while True:
# grab one packet from the xbee, or timeout
packet = xbee.find_packet(ser)
if packet:
xb = xbee(packet)
# Tempurature reading code
# xb.analog_samples[sample #][A/D pin#] is used to grab the first sample and pin in the xb packet
mVolts = xb.analog_samples[0][0] # Report the millivolts from the TMP36
tempC = mVolts * 0.1 # Convert millivolts to Celcius
tempF = tempC * 9 / 5 + 32 # Convert to Fehrenheit
print tempC, "C \t", tempF, "F" # Print formated tempurature readings


mVolts = xb.analog_samples[0][0] # Report the millivolts from the TMP36
Return to XBee products from Adafruit
Users browsing this forum: No registered users and 3 guests