I am using 3 PCF8591 ADC connected via i2c to a raspberry pi.

At first all 3 of the ADC worked. All of a sudden I started having issued with them. Occasionally one of the i2c devices stops showing up (i2cdetect -y 1). And now when reading some devices they show up and connect however they always read 0. I attributed this to a damaged ADC so I replaced it but got the same issue. Sometimes is works, sometimes it doesn't. Often after first starting it will work for about 10 seconds then start reading 0.


This is the layout of the PCB I used. I realised I had forgotten the pull up resistors so I jumpered 2 4.3k resistors from the SDA and SCL pins to 3.3V pin. I haven't had heaps of experience with PCB layouts so I'm wondering if I did something very wrong that is causing the i2c to not work all the time outside of the two pull up resistors I missed. I do not want to get another batch of PCBs made if I have made some other big mistake.

bus = smbus.SMBus(1)

def readADCPin(pin):
    x = 0
    value = 0
    numReadings = 4
    tot = 0
    while x < numReadings:
        value += bus.read_byte(address)
    value /= numReadings
    return value

This is the code I am using. As you can see I'm using SMbus to talk to the different devices.

  • \$\begingroup\$ Eliminate some options. Did you try another RPi or other i2c host? Did you try another board? Software from scratch? \$\endgroup\$
    – Passerby
    Mar 30 '19 at 23:00
  • \$\begingroup\$ I reflashed the OS to make sure. I am also pretty sure I used a different RPi but there is always a chance I got mixed up and grabbed the one I was already using. Ill try again with another RPi in a second and let you know how I go. \$\endgroup\$
    – jdm
    Mar 30 '19 at 23:02
  • \$\begingroup\$ Update: I have also tried a new RPi. Same thing. Works for a little but then reads 0. \$\endgroup\$
    – jdm
    Mar 30 '19 at 23:11
  • \$\begingroup\$ If the problem would not been solved already, I would have suggested to double check the soldering of the I2C pins of the 40 pins connector . \$\endgroup\$
    – Huisman
    Apr 2 '19 at 9:48

So its been solved. The issue was with addressing each ADC. I grounded different address pins like normal however I left the unused ones floating. So all I needed to do was tie the unused address pins to VCC.

  • \$\begingroup\$ Congrats! Do accept your own answer as well. \$\endgroup\$
    – Huisman
    Apr 2 '19 at 9:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.