Support Forum

Share your projects and post your questions

Register   or   Sign In
The Forum

Newbie question

5844 Views - Created 12/05/2018

12/05/2018

Posted by:
dmacleod

dmacleod Avatar

Hi All,

I have just taken the plunge into python and RPI IO's.

For my first project I am using the ADC Differential Pi, and trying to get it to work.

Using the below basic example i have run into an error and not sure where to start looking to resolve it

Code:

from ADCDifferentialPi import ADCDifferentialPi
adc = ADCDifferentialPi(0x68, 0x69, 12)
adc.read_voltage(1)

Error:

from ADCDifferentialPi import ADCDifferentialPi
adc = ADCDifferentialPi(0x68, 0x69, 12)
adc.read_voltage(1)




Any help would be greatly appreciated

thanks

Darren

12/05/2018

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hi Darren

Have you enabled the I2C port on the Raspberry Pi and installed our Python library from GitHub?

You can find the I2C tutorial at https://www.abelectronics.co.uk/kb/article/1/i2c--smbus-and-raspbian-linux

The Python library can be downloaded from https://github.com/abelectronicsuk/ABElectronics_Python_Libraries

Once you have I2C and the library installed you can check if the ADC Differential Pi is available on the I2C bus by running the following command:


sudo i2cdetect -y 1


You should get a grid of dashes with the numbers 68 and 69 somewhere in the list. If those numbers show up then the ADC Differential Pi is working.

Next, try running the readvoltage.py demo from our python library. It should read the voltages from all 8 channels. You can use this code as a basis for your own project.

13/05/2018

Posted by:
dmacleod

dmacleod Avatar

Thanks.

I have followed everything above step by step.

Here is the output from running the i2cdetect command:-

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --



does the python library support the RPI 3B+, as i am currently using this model for testing



thanks

Darren

14/05/2018

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

The python library does support the 3B+.

As the ADC Differential Pi is not showing up on the I2C bus that suggests a hardware or I2C configuration problem. Can you check the solder joints on the connectors to make sure there are no bridges or dry joints? Also if you have a multimeter try measuring the voltages across the 5V and GND pins on the board to see if there is 5V present and make sure the board is fitted firmly on the GPIO header.

It may also be worth going through every step of the I2C tutorial again just to make sure you didn't miss any steps.

15/05/2018

Posted by:
dmacleod

dmacleod Avatar

Thanks Andrew,

I Went through the whole process again. For some reason the enable I2c bus did not save.

Now i get the following from the i2cdetect, and my code is working

thanks again

0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- 68 69 -- -- -- -- -- --
70: -- -- -- -- -- -- -- --

08/07/2020

Posted by:
jevers99

jevers99 Avatar

Hi, We've just tried checking ours using i2cdetect and we're only getting 69. Any ideas as to how we can fix this issue?



Many thanks,



Jon

08/07/2020

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

Hello Jon

Can you try checking the solder connections on the address select header to make sure there are no bridges or dry joints?

13/07/2020

Posted by:
jevers99

jevers99 Avatar

Ok, so we tried again and got this. Any ideas?



pi@raspberrypi:~ $ sudo i2cdetect -y 1

0 1 2 3 4 5 6 7 8 9 a b c d e f

00: -- -- -- -- -- -- -- -- -- -- -- -- --

10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

60: -- -- -- -- -- -- -- -- 68 -- -- 6b -- -- -- --

70: -- -- -- -- -- -- -- --

13/07/2020

Posted by:
andrew

andrew Avatar

Location:
United Kingdom

andrew Twitter  andrew Website  

It looks like there may still be a problem with the address select header.

On the product page for the ADC Pi https://www.abelectronics.co.uk/p/69/adc-pi-raspberry-pi-analogue-to-digital-converter#assembly, there is a list of address configurations. Can you check that the jumpers on the header are in the correct positions for 0x68 and 0x69?

14/07/2020

Posted by:
jevers99

jevers99 Avatar

Yay, it worked thank you

Sign in to post your reply

Note: documents in Portable Document Format (PDF) require Adobe Acrobat Reader 5.0 or higher to view, download Adobe Acrobat Reader or other PDF reading software for your computer or mobile device.