-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Not sure if there is something else i need to do to make this work, but using array-gpio seems to break I2C.
Configuration: Pi Zero W running latest raspberry pi OS, two I2C devices connected (OLED display and an EZO pH circuit) to the standard SDA and SCL pins (3,5).
$ uname -a
Linux neonpi 6.6.74+rpt-rpi-v6 #1 Raspbian 1:6.6.74-1+rpt1 (2025-01-27) armv6l GNU/Linux
- reboot the Pi
- run i2cdetect -y 1
-> normal output, both devices detected - run this node app:
const gpio = require("array-gpio")
// initialize gpio pins for relays - outputs, pullups, off
const r1 = gpio.setOutput(11);
const r2 = gpio.setOutput(13);
r1.off();
r2.off();
// returns a specific relay's state
// input is a number (1 or 2)
function getRelay(relay) {
if (relay == 1)
return(r1.isOn);
else if (relay == 2)
return(r2.isOn);
else
return(-1)
}
// set a specific relay's state
// relay is 1 or 2
// level is 0 or 1 (off or on)
function setRelay(relay, level) {
if (relay == 1)
(level) ? r1.on() : r1.off();
else if (relay == 2)
(level) ? r2.on(): r2.off();
}
console.log("relay 1: ", getRelay(1));
console.log("relay 2: ", getRelay(2));
setRelay(2, 1);
console.log("relay 2: ", getRelay(2));
setRelay(2, 0);
console.log("relay 2: ", getRelay(2));
--> This works as expected, but...
- now re-run i2cdetect -y 1
--> it fails to work correctly, output of the i2c map is extremely slow, and mangled. no I2C devices are detected. applications that try to write to the I2C bus fail with write errors
--> it is necessary to power off and power back on the Pi to correct the problem
Metadata
Metadata
Assignees
Labels
No labels