Hi everyone,
I'm trying to read data from two MAX30102 sensors on an Arduino MKR Zero, but I’m running into several issues. I’d like a solution without using a multiplexer (if there’s no way around it, I can consider one). Here’s what I’ve tried so far: Hardware Setup
| Sensor | Bus | SDA | SCL | VIN | GND |
|---|---|---|---|---|---|
| MAX30102 #1 | Wire (main I²C) | D11 | D12 | 5(3.3)V | GND |
| MAX30102 #2 | Wire1 (SERCOM3) | D0 (PA22) | D1 (PA23) | 5(3.3) V | GND |
I defined a second I²C bus using SERCOM3 on the SAMD21, following the MKR Zero documentation: #include <Wire.h>
#include "wiring_private.h"
#include "MAX30105.h"
#define SDA1_PIN 0
#define SCL1_PIN 1
TwoWire Wire1(&sercom3, SDA1_PIN, SCL1_PIN);
void SERCOM3_Handler() { Wire1.onService(); }
void setup() {
Serial.begin(115200);
while (!Serial);
// Main I2C bus
Wire.begin();
Wire.setClock(400000);
// Configure SERCOM pins
pinPeripheral(SDA1_PIN, PIO_SERCOM_ALT);
pinPeripheral(SCL1_PIN, PIO_SERCOM_ALT);
// Secondary I2C bus
Wire1.begin();
Wire1.setClock(400000);
// Initialize sensors
if (sensor1.begin(Wire, I2C_SPEED_STANDARD)) {
Serial.println("Sensor 1 found");
} else {
Serial.println("Sensor 1 not found");
}
if (sensor2.begin(Wire1, I2C_SPEED_STANDARD)) {
Serial.println("Sensor 2 found");
} else {
Serial.println("Sensor 2 not found");
}
}
Observations
-
The first sensor on Wire works perfectly: readings are correct and consistent.
-
The second sensor on Wire1 is never detected.
-
I tried both
PIO_SERCOMandPIO_SERCOM_ALT. -
I verified wiring, common GND, and power.
-
Sensor #1: SDA → D11, SCL → D12, VIN → 5(3.3)V, GND → GND
Sensor #2: SDA → D0, SCL → D1, VIN → 5(3.3)V, GND → GND I also tried an I²C scan on the second sensor. -
With VCC at 5 V (same as the first sensor), it does not start scanning.
-
With VCC at 3.3 V (from the MKR Zero), scanning starts but still does not detect the address. Problems Encountered
- Both MAX30102s have the same I²C address (0x57), so they cannot coexist on the same bus simultaneously.
- Extra pins on the MKR Zero (D0/D1) do not have internal pull-ups, so the secondary bus is unstable.
- SoftWire cannot handle the speed required by the sensors.
- Even with SERCOM, the second bus does not respond. Question
Is there a reliable way to get two MAX30102 sensors working on the MKR Zero without using a multiplexer?
Has anyone successfully used SERCOM or other techniques to bypass the address conflict, or are we forced to use a multiplexer for simultaneous readings?