Cannot connect R4 WiFi to Adafruit Quad Encoder Board 5752 Using STEMMA connector

I am trying to connect my R4 WiFi to Adafruits Quad Encoder Board 5752. I can get it to work using the I2C pins on the 5752 and the R4. I cannot get it work using the STEMMA connectors on both boards.

I know to use Wire1 instead of Wire.

Using this code

#include <Wire.h>

void setup() {
  Serial.begin(115200);
  while (!Serial);          // Optional wait for Serial on some boards
  
  Wire1.begin();            // Initialize I2C0 (STEMMA port)
  Wire1.setClock(400000);   // Set I2C to 400 kHz Fast Mode
  Serial.println("I2C Scanner @ 400 kHz on Wire1 (I2C0 - STEMMA Port)");
}

void loop() {
  Serial.println("Scanning I2C devices on STEMMA port...");
  int foundCount = 0;
  
  for (byte address = 1; address < 127; address++) {
    Wire1.beginTransmission(address);
    if (Wire1.endTransmission() == 0) {     // 0 = success
      Serial.print("Device found at address 0x");
      if (address < 16) Serial.print("0");
      Serial.println(address, HEX);
      foundCount++;
    }
  }
  
  if (foundCount == 0) {
    Serial.println("No I2C devices found on STEMMA port.");
  } else {
    Serial.println("I2C scan completed.");
  }
  
  delay(3000);  // Wait 3 seconds between scans
}

finds the 5752
15:00:50.405 -> Scanning I2C devices on STEMMA port...
15:00:50.405 -> Device found at address 0x49
15:00:50.405 -> I2C scan completed.

Using this code to connect to Seesaw on the 5752:

/*
 * This is a demo for a QT Py RP2040 connected to a quad rotary encoder breakout
 * using the onboard Stemma QT Port
 * https://www.adafruit.com/product/4900
 * https://www.adafruit.com/product/5752
 * 
 */
#include "Adafruit_seesaw.h"
#include <seesaw_neopixel.h>
#include <Wire.h>
#include "Arduino_LED_Matrix.h"

ArduinoLEDMatrix matrix;

uint8_t frame[8][12] = {
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
  { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
};

#define SS_NEO_PIN       18
#define SEESAW_ADDR      0x49
#define ENCODER_COUNT    4

Adafruit_seesaw ss = Adafruit_seesaw(&Wire1);
seesaw_NeoPixel pixels = seesaw_NeoPixel(4, SS_NEO_PIN, NEO_GRB + NEO_KHZ800);

uint8_t ss_enc_switch[ENCODER_COUNT] = {12, 14, 17, 9};
int32_t enc_positions[ENCODER_COUNT] = {0, 0, 0, 0};
bool    enc_pressed[ENCODER_COUNT]   = {false, false, false, false};

volatile bool interruptOccurred = false;

void handleInterrupt() {
  interruptOccurred = true;
}

void setup() {
  Serial.begin(115200);
  while (!Serial) delay(10);

  pinMode(2, INPUT_PULLUP);
  attachInterrupt(digitalPinToInterrupt(2), handleInterrupt, FALLING);

  Wire1.setClock(400000);   // Set I2C to 400 kHz Fast Mode
  Wire1.begin();
  Serial.println("I2C Scanner @ 400 kHz on Wire1");

  Serial.println("Looking for seesaw!");
  
  if (! ss.begin(SEESAW_ADDR) || !pixels.begin(SEESAW_ADDR)) {
    Serial.println("Couldn't find seesaw on default address");
    while(1) delay(10);
  }
  Serial.println("seesaw started");

Yields:
15:08:53.848 -> I2C Scanner @ 400 kHz on Wire1
15:08:53.848 -> Looking for seesaw!
15:09:03.975 -> Couldn't find seesaw on default address

Any help would be appreciated.

Possibly because you didn't put the NeoPixel on Wire1 as well? Try:

seesaw_NeoPixel pixels = seesaw_NeoPixel(4, SS_NEO_PIN, NEO_GRB + NEO_KHZ800, &Wire1);
1 Like

Well, that's embarrassing.

It works now.

Thank you.

1 Like

Chuckle: we've all been there!