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

# Convert the data to 12-bits
raw_adc = (data[0] & 0x0F) * 256 + data[1]

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

hi,
i will recommend trying out this lib

can you share the inclinometer part number ?

Thanks

inclinometer is Accustar-EA 02114002-000

I tried the library that bhaskar suggested and got the following output for a steady measured voltage of 2.47

Sorry, copied the wrong output … for a constant 2.47volt I get
Voltage : 2.58056639568

Voltage : 2.54394530208

Voltage : 2.66967772344

Voltage : 2.52807616152

Voltage : 2.66357420784

Voltage : 2.51831053656

Voltage : 2.53173827088

i will recommend doing ADC avg or increasing the number of samples.

I did look at averaging but the readings are way too inconsistent to get a good average. eg the inclinometer reads 2.50 volts when level so 2.47 is a slight negative angle. if I was to average the samples from this test it would give me a positive angle the the leveling system would adjust the wrong way.

Why does it keep changing when the 4 channel ADC does not change?

The main reason will be vref. This ADC121 usages VCC as its ref voltage. and if the supply is not extremely clean you will see these inconsistent readings.
If i were working on this project i will use something like ADS1115.
Its has 15 bit resolutions and also has inbuilt vref.

Hi Reidwhitney,

I’m currently working on a similar project with the LOPYI2c and ADC121C021, and can’t find good example with these devices. Can you share your code that you used for it ?

Regards.

Richard.