Community Forum Share your projects and post your questions

Register or Sign In

Newbie question

3003 Views - Created 12/05/2018

12/05/2018

Posted by:
dmacleod

Users 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

Users Avatar

Location:
United Kingdom

Users Twitter  Users 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 grid of dashes with the numbers 68 and 69 somwhere in the list.  If those numbers show up then the ADC Diffential 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.

AB Electronics UK Tech Support

13/05/2018

Posted by:
dmacleod

Users 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

Users Avatar

Location:
United Kingdom

Users Twitter  Users 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 meauring 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.

AB Electronics UK Tech Support

15/05/2018

Posted by:
dmacleod

Users 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: -- -- -- -- -- -- -- --  

 

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.