I have setup a honeywell flow sensor (AXT) , however I am struggling to interpret data coming from the sensor. I have the following code :
import smbus
bus = smbus.SMBus(1)
address = 0x49
bear1=bus.read_byte_data(address,0x01)
print(bear1)
Returns me output : 204
As can be seen from the datasheet, 0x01 is supposed to give me the serial number, which is 20L4 in a small label attached to the back of the sensor. For some reason the output misses the character L.
Another snippet for printing response from first 7 addresses:
import sys
import board
import busio
i2c=busio.I2C(board.SCL, board.SDA)
print('i2c devices',[hex(i) for i in i2c.scan()])
devices=i2c.scan()
device=devices[0]
registers=(0,6)
register_size=2
result=bytearray(register_size)
for register in range(*registers):
try:
i2c.writeto(device,bytes([register]))
i2c.readfrom_into(device,result)
except OSError:
continue
print('Address {0} contains value : {1}'.format(register,' '.join([hex(x) for x in result])))
Output :
i2c devices ['0x49']
Address 0 contains value : 0x6 0x69
Address 1 contains value : 0x4e 0x17
Address 2 contains value : 0x4e 0x17
Address 3 contains value : 0x4e 0x17
Address 4 contains value : 0x4e 0x17
Address 5 contains value : 0xcc 0x99
How do I interpret data from sensor? I have uploaded the datasheet HERE