I am using the output from an inclinometer (0.5 to 4.5 volts) to the ADC121C021 board. With the inclinomter at a fixed angle I can read the voltage as a fixed value. In this test the voltage from the inclinometer was 2.56v. Using the python library and measuring every second the voltage ranged from 2.4 to 2.8 and kept changing. Yet when using the 4 channel 16bit board it does not change and reads perfectly.
Here is the code for the 12 bit board
bus.write_byte_data(0x50, 0x06, 0x20)
time.sleep(1.0)
# ADC121C021 address, 0x50(80)
# Read data back from 0x00(00), 2 bytes
# raw_adc MSB, raw_adc LSB
data = bus.read_i2c_block_data(0x50, 0x00, 2)
# Convert the data to 12-bits
raw_adc = (data[0] & 0x0F) * 256 + data[1]
voltage = raw_adc*0.00122070312
angle = round((voltage-2.5) / 10 * 300,1)
print("%d" %voltage)
Does anyone have any ideas as to what I’m doing wrong?
Roger K