hi, i have problem with Sensirion SGP41. the sensor not detected by i2c scanner. tried with arduino and esp32 and have no problem, only with imp004 breakoutboard not detected.
i also tried to change the i2c pull up resistor but to no avail. any idea why?
Hard to say without code or a circuit diagram, but I would double-check your addressing: have you shifted the 7-bit address up to 8 bits, eg.
local sevenBitAddress = 0x39;
local eightBitAddress = sevenBitAddress << 1;
I would also try and communicate with the sensor and check the error values returned by Squirrel:
Here’s the code I use for I2C bus scanning:
function debugI2C(i2c = null) {
if (imp.environment() == ENVIRONMENT_AGENT) throw "utilities.debugI2C() can only be run on a device";
if (i2c == null) throw "debugI2C() requires a non-null I2C object";
for (local i = 2 ; i < 256 ; i += 2) {
if (i2c.read(i, "", 1) != null) server.log(format("Device at 8-bit address: 0x%02X (7-bit address: 0x%02X)", i, (i >> 1)));
}
}
The valid I2C address range is 0-127 (0-0x0x7F), but that will check for devices with invalid addresses too.
the address is not found when scanned with imp i2c scanner.
so i tried to read it instead, (i try to scan it first because it’s easier, bc to read it need to send additional command)
and it responded. not sure why this particular ic not responded when scanned with imp i2c scanner but responded when i read it.
This topic was automatically closed after 60 days. New replies are no longer allowed.