When power was not the problem you could do the following before going to the software.
- Add pull-up resistors on SDA and SCL
- Use another BH1750 GY30. If this works the old sensor is broken or unreliable
Error with i2c, BH1750 Error after about 4 years
When power was not the problem you could do the following before going to the software.
So to stabilize the tension.
I tried this once with 47 uF. Doesn’t work either.
I think the sensor should be intact. I had it for some time to test on a Sonoff 4CH (with tasmota) and it ran.
Pull-up I have also tested with 3k3. Also without success.
Something else is funny. If it detects the sensor (0x23), it still finds an address (0x03). There is only one i2c device on the bus.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
Yes, that’s it. If the sensor is not attached, i2cdetect will not show any output.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
Is it possible that the Raspberry has a defect at I2C?
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
Yes that could be, to rule you need to use another rpi. If you got another exactly the same type of rpi you just could use the flash card or usb drive of your current rpi (or use a backup, thats a bit saver)
If you want to test the sensor an arduino is also doing i2c and easy to do a test with.
Because i2cdetect is also using the rpi i2c functions, the readings could be wrong
To be sure is would suggest you do the ‘Sonoff 4CH (with tasmota)’ test again.
Debugging hardware and ‘firmware’ asks for endurance
I have now changed the RPi. After some trouble with the internal IP addresses it ran after some time. The test with i2cdetect unfortunately gave the same result as I had before with the first RPi. So the problem is probably not the RPi.
Only with my i2c problem I am no further 😬.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
After further trouble to swap back the IP addresses of the second and first RPi I swapped the sensor from outside with the one on the Sonoff again. (The sensor on the Sonoff currently takes over the tasks of the other sensor)
With the result as before. On Sonoff, he’s giving me realistic readings. He’s working.
And now the strangest thing, the sensor that was plugged into the Sonoff, this sensor on the long cable, outside, suddenly shows me realistic values over a few minutes at least. I2Cdetect shows me the 0x23 with every call, and the 0x03 I don’t see anymore.
But I don’t believe the sudden healing. I’m afraid it starts again after a while with the problems. I did not find an error after all. Exactly in this constellation I had it already a few times. Apart from the fact that the capacitors are still connected to the long cable.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
The sensor on the Sonoff currently sticks to a window with adhesive tape.
I had tried (as an alternative to my long working, long cable RPi sensor) to solve my brightness system with the Sonoff. But if I connect the sensor to the Sonoff with a longer cable, the sensor won’t work on it either. With “longer” I mean in this case more than 10cm cable.
1m cable still works, but with dropouts.
4m cable does not work at all.
Unfortunately I need to have some cable length between Sonoff and sensor.
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
I looked into the plugin and the underlaying BH1750 lib.
The most recent BH1750 lib version is 0.0.5 but the plugin is sticked to 0.0.3.
You could update to version 0.0.5.
Did you try the option to run the command ‘npm test’ in the pimatic-bh1750 directory?
It uses the underlaying lib directly.
npm test
# light value is: 20 lx
@thrusty said in Error with i2c, BH1750 Error after about 4 years:
The sensor on the Sonoff currently sticks to a window with adhesive tape.
I had tried (as an alternative to my long working, long cable RPi sensor) to solve my brightness system with the Sonoff. But if I connect the sensor to the Sonoff with a longer cable, the sensor won’t work on it either. With “longer” I mean in this case more than 10cm cable.
1m cable still works, but with dropouts.
4m cable does not work at all.
Unfortunately I need to have some cable length between Sonoff and sensor.
Do i read it right that the cable length is an issue?
You are using a cat5 cable with 4 twisted pairs. Are you using the 1 twisted pair for power and 1 twisted pair for SDA/SCL?
I keep saying use the pull-up resistors, otherwise you get floating inputs and thats bad if there’s noise.
Here is my issue on npm test
pi@rpi_strech:~/pimatic-app/node_modules/pimatic-bh1750 $ npm test
> pimatic-bh1750@0.2.0 test /home/pi/pimatic-app/node_modules/pimatic-bh1750
> echo "Error: no test specified"
Error: no test specified
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
Is there a subdirectory example with the file index.js?
If not just add it manual (i used text editor nano in this example)
The command line command are:
mkdir example
cd example
nano index.js
Text to cut&paste
var console = require('console');
var BH1750 = require('../bh1750');
var light = new BH1750();
light.readLight(function(err, value){
if (err) {
console.log("light error: " + err);
throw err;
} else {
console.log("light value is: ", value, "lx");
}
});
save the file, exit nano, cd … and npm test should work
After I have changed the content I get this issue:
bh1750@0.0.3 test /home/pi/pimatic-app/node_modules/pimatic-bh1750/node_modules/bh1750
echo "Error: no test specified"
Error: no test specified
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
I think I started it from this directory.
pi@rpi_strech:~/pimatic-app/node_modules/pimatic-bh1750/node_modules/bh1750 $ npm test
> bh1750@0.0.3 test /home/pi/pimatic-app/node_modules/pimatic-bh1750/node_modules/bh1750
> echo "Error: no test specified"
Error: no test specified
pi@rpi_strech:~/pimatic-app/node_modules/pimatic-bh1750/node_modules/bh1750 $
I currently have this content in the Index.js
var console = require('console');
var BH1750 = require('../bh1750');
var light = new BH1750();
light.readLight(function(err, value){
if (err) {
console.log("light error: " + err);
throw err;
} else {
console.log("light value is: ", value, "lx");
}
});
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)
The the sub directory example exist for me. And also the file.
pi@rpi_strech:~/pimatic-app/node_modules/pimatic-bh1750/node_modules/bh1750/example $ ls
index.js index.js.old
"Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect." 09-28-2003, LINUS TORVALDS (http://www.nytimes.com)