python - Convert reading from Temperature Sensor connected to XBee -


i suppose calculate actual temperature of remote location using lm35 temperature sensor , xbee sensor. getting analog input sensor, unable calculate temperature. complete scenario given below.

scenario:

i have connected lm35 temperature sensor xbee (consider sensing node) pin0 analog (adc) , sampling rate 4 seconds. same have xbee coordinator accepting values xbee sensing node. coordinator connected uart-4 of beaglebone via it's tx , rx pins. have used python-xbee python library read serial port i.e. uart-4. getting analog values remote xbee. not able calculate temperature received analog values.

sample frames receiving

{'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 469, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 468, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 470, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 183, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 178, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 180, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 177, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 183, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 182, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 183, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 166, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 166, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}  {'source_addr_long': '\x00\x13\xa2\x00@\xd6\xa58', 'source_addr': '\xaa\xf9', 'id': 'rx_io_data_long_addr', 'samples': [{'adc-0': 166, 'adc-1': 466, 'adc-2': 1023}], 'options': '\x01'}

note:

adc-0 pin of remote xbee have connected tempreture sensor.

adc-1 pin of remote xbee have connected humidity sensor.

adc-2 pin of remote xbee have connected co2 sensor.

how calculate actual temperature? (current temperature ~16 ~18)

the sensor documentation should provide formula converting voltage temperature , humidity.

you can convert adc readings voltage multiplying reading reference voltage, , dividing 1023. don't indicate xbee module you're using, you'll have check datasheet reference voltage -- might on 1 of pins, or might fixed value.

from google search, see lm35 produces voltage of 10 mv per degree celcius. 182 / 1023 = 0.178 if reference voltage 1v, that's 17.8c.

the humidity calculation similar. key convert adc reading voltage, , plug formula provided on datasheet.


Comments