I've changed the wiring (SDA and GND in twisted pair 1 (orange/orange-white), SCL and GND in twisted pair 4 (brown-brown-white) and installed a pull-up resistor of 1k between SDA and +5V and between SCL and +5V on the side of the GrovePi (just before the RJ45-socket which goes to the cable). The +5V is going through the other wire. I measured the voltages in the sensorbox (in stand by modus, e.g. without sending any commands to the RPi).
GND -> +5V = 4.63V
GND -> SCL = 0V
GND -> SDA = 4.61V
This is consistent with the result I get from
gpio readall
Code: Select all
pi@raspberrypi ~ $ gpio readall
+----------+-Rev2-+------+--------+------+-------+
| wiringPi | GPIO | Phys | Name | Mode | Value |
+----------+------+------+--------+------+-------+
| 0 | 17 | 11 | GPIO 0 | IN | Low |
| 1 | 18 | 12 | GPIO 1 | IN | High |
| 2 | 27 | 13 | GPIO 2 | IN | Low |
| 3 | 22 | 15 | GPIO 3 | IN | Low |
| 4 | 23 | 16 | GPIO 4 | IN | High |
| 5 | 24 | 18 | GPIO 5 | IN | High |
| 6 | 25 | 22 | GPIO 6 | IN | High |
| 7 | 4 | 7 | GPIO 7 | IN | Low |
| 8 | 2 | 3 | SDA | ALT0 | High |
| 9 | 3 | 5 | SCL | ALT0 | Low |
| 10 | 8 | 24 | CE0 | ALT0 | High |
| 11 | 7 | 26 | CE1 | ALT0 | High |
| 12 | 10 | 19 | MOSI | ALT0 | Low |
| 13 | 9 | 21 | MISO | ALT0 | Low |
| 14 | 11 | 23 | SCLK | ALT0 | Low |
| 15 | 14 | 8 | TxD | ALT0 | High |
| 16 | 15 | 10 | RxD | ALT0 | Low |
| 17 | 28 | 3 | GPIO 8 | IN | Low |
| 18 | 29 | 4 | GPIO 9 | IN | Low |
| 19 | 30 | 5 | GPIO10 | IN | Low |
| 20 | 31 | 6 | GPIO11 | IN | Low |
+----------+------+------+--------+------+-------+
because SDA is High and SCL is Low
This means there's some voltage loss, but not very much. 4.6V should normaly be engough the get the sensors running fine.
The sensors still aren't detected by
sudo i2cdetect -y 1
even worse, now nothing is detected, neither the GrovePi (0x04), the barometic sensor (0x77), the digital light sensor (0x29) or the I2C 1-Wire Host Adaptor (0x18) are shown. The only thing I see is a UU on 0x3b and a UU on 0x51. This is the result:
Code: Select all
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: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi ~ $
.
If I unplug the UTP cable for I2C (but leave the UTP cable for the other sensors; wich means SDA and SCL of both sensors aren't connected anymore), I get this result:
Code: Select all
pi@raspberrypi ~ $ sudo i2cdetect -y 1
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- 04 -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- UU -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- UU -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
pi@raspberrypi ~ $
Both the GrovePi (0x4) and the I2C 1-Wire Host Adapter(0x18) then become detectable.
When I connect the sensors directly in the I2C-ports of the GrovePi they are connected, so there's nothing wrong with the sensors.
Maybe 12.5m cable is indeed to long. If I leave out the digital light sensor and only use the barometic sensor, I can work arround the problem (without solving it) by placing the barometic sensor next to the GrovePi / Raspberry Pi in the cellar (I know what the difference in altitude is, so I can calculate the barometic pressure in the sensorbox). Of course this can't work for the light sensor because the light in the cellar is not related to the light outside.