I have a Grove I2C ADC that connected to Raspberry Pi. i2cdetect -y 1 shows me address 50. I successfully accept my write to config register and readback appears to be correct. But it always read zeros. Where I can see schematics for this simple module? I assume it has capacitor at it’s input thus I can’t read constant levels, such as VCC, or slowly changing values. Am I right? Is it safe to remove capacitor? I saw cap in “typical application circuit” in datasheet for ADC 121C021.
I used to connect VCC to it’s input for testing purposes, which allowed to apply up to 5.5 volts.
read= 0xE0
0: adc= 0x0000 -> 0
1: adc= 0x0000 -> 0
2: adc= 0x0000 -> 0
3: adc= 0x0000 -> 0
4: adc= 0x0000 -> 0
Here is my simple program below:
#!/usr/bin/env python3
ADDR_ADC121 = 0x50
REG_ADDR_RESULT = 0x00
REG_ADDR_ALERT = 0x01
REG_ADDR_CONFIG = 0x02
REG_ADDR_LIMITL = 0x03
REG_ADDR_LIMITH = 0x04
REG_ADDR_HYST = 0x05
REG_ADDR_CONVL = 0x06
REG_ADDR_CONVH = 0x07
import smbus, os, sys
import time
adc = smbus.SMBus(1)
#adc.write_byte_data(ADDR_ADC121, REG_ADDR_CONFIG, 0x20)
adc.write_byte_data(ADDR_ADC121, REG_ADDR_CONFIG, 0xE0)
r = adc.read_byte_data(ADDR_ADC121, REG_ADDR_CONFIG)
print(“read= 0x%02X” % r)
def read_adc():
rw = adc.read_word_data(ADDR_ADC121, REG_ADDR_RESULT)
w = (((rw & 0xFF)<<8) | (rw & 0xFF00)>>8)
print(“adc= 0x%04X -> %d” % (w, w))
return w
count = 0
while True:
print("%5d: " % count, end = “”)
read_adc()
count += 1
time.sleep(0.5)