Jump to content
Sign in to follow this  
bakami

How to use I2C-1 port, script unable to find device

Recommended Posts

Hey, i'm trying to follow this Guide for a 3rd party module i try to use, which was made for a raspberry pi, but when i try to execute the second script, this error message appears:

$ sudo python ADS1115_ReadVoltage.py
Traceback (most recent call last):
  File "ADS1115_ReadVoltage.py", line 19, in <module>
    adc0 = ads1115.readVoltage(0)
  File "../DFRobot_ADS1115.py", line 142, in readVoltage
    self.setSingle()
  File "../DFRobot_ADS1115.py", line 110, in setSingle
    bus.write_i2c_block_data(addr_G, ADS1115_REG_POINTER_CONFIG, CONFIG_REG)
IOError: [Errno 6] No such device or address

I used this program to activate my I2C-1 port: https://tinkerboarding.co.uk/forum/thread-400.html ,i couldn't find another way.

"$ sudo i2cdetect -y 1" returns that it found a device on 0x49, as expected, so it should be activated.

The main script seems to use this code to get the bus:

import smbus
import time

# Get I2C bus
bus = smbus.SMBus(1)

# I2C address of the device
ADS1115_IIC_ADDRESS0                            = 0x48
ADS1115_IIC_ADDRESS1                            = 0x49

I attached the whole module folder, the scripts are under /DFRobot_ADS1115/RaspberryPi/Python/DFRobot-ADS1115.py and /DFRobot_ADS1115/RaspberryPi/Python/ADS1115_ReadVoltage/ADS1115_ReadVoltage.py

Thanks for any tips for how to make this work.

DFRobot_ADS1115.zip

Share this post


Link to post
Share on other sites

Ah nvm, i found the error, somehow the script only works if the onboard switch is set to adress 0x48 instead of 0x49

Share this post


Link to post
Share on other sites

Hi @bakami:

     Maybe you can check the contents of slave address 0x49 device by the following command to dump information. Thank a lot!

sudo i2cdump -y 1 0x49

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...