switchdoclabs / RaspberryPi-WeatherPiArduinoV2

Software for Python for the Raspberry Pi for use with WeatherPiArduino Version 2
0 stars 3 forks source link

Error accessing 0x48: Check your I2C address #2

Closed ltdenard closed 8 years ago

ltdenard commented 8 years ago

After wiring the WeatherPiArduino to my Raspberry Pi 2 model b as laid out in the following link, I get an error about I2C address 48 not being available. https://i0.wp.com/www.switchdoc.com/wp-content/uploads/2014/10/WPA-RaspberryPiB-_bbLogo.png

pi@jupiter:~/RaspberryPi-WeatherPiArduinoV2/SDL_Pi_WeatherRack$ python SDL_Pi_WeatherRackTest.py 
Error accessing 0x48: Check your I2C address
Error accessing 0x48: Check your I2C address
Type Error
---------------------------------------- 
----------------- 
 SDL_Pi_WeatherRack Library
 WeatherRack Weather Sensors
----------------- 
Rain Total= 0.00 in
Wind Speed= 0.00 MPH
MPH wind_gust=  0.00 MPH
Error accessing 0x48: Check your I2C address
Error accessing 0x48: Check your I2C address
Traceback (most recent call last):
  File "SDL_Pi_WeatherRackTest.py", line 64, in <module>
    print "Wind Direction=\t\t\t %0.2f Degrees" % weatherStation.current_wind_direction()
  File "/root/RaspberryPi-WeatherPiArduinoV2/SDL_Pi_WeatherRack/SDL_Pi_WeatherRack.py", line 232, in current_wind_direction
    value = self.ads1015.readADCSingleEnded(1, self.gain, self.sps) # AIN1 wired to wind vane on WeatherPiArduino
  File "../Adafruit_ADS1x15/Adafruit_ADS1x15.py", line 278, in readADCSingleEnded
    return ( ((result[0] << 8) | (result[1] & 0xFF)) >> 4 )*pga/2048.0
TypeError: 'int' object has no attribute '__getitem__'

When I run the following command, it does show it's not there.

$ 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: -- -- -- -- -- -- -- 57 -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- 68 -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- 77     

Do I need to change the address in SDL_Pi_WeatherRack.py to point to one of these or is something else the issue?

ltdenard commented 8 years ago

After further googling and documentation reading, I found out the I2C address was trying to connect to a Adafruit ADS1115 device. Now that I have this the device, the script no longer fails; however, it does not properly output data related to the WeatherRack.

ltdenard commented 8 years ago

After further debugging and attaching the Adafruit ADS1115 module, I figured out that the diagram above does not match the pin numbers outlined here and here: https://github.com/switchdoclabs/RaspberryPi-WeatherPiArduinoV2/blob/master/SDL_Pi_WeatherRack/SDL_Pi_WeatherRackTest.py#L28 https://github.com/switchdoclabs/RaspberryPi-WeatherPiArduinoV2/blob/master/SDL_Pi_WeatherRack/SDL_Pi_WeatherRackTest.py#L29

This should read as follows:

anenometerPin = 18
rainPin = 15
mjnajafi commented 5 years ago

When I run the following command, it does show it's not there.

$ 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: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 70: -- -- -- -- -- -- -- --

What should i do to detect i2c address?