Now that you've assembled your PiCowbell Proto and Pico, you're ready to connect one of many breakouts to the STEMMA QT connector and get going with no further soldering needed!

This page shows you how to use Arduino to scan I2C to show the address of any connected devices, which will indicate whether your breakout is connected and your PiCowbell is assembled correctly.


This diagram uses the MCP9808. You can replace it with any STEMMA QT breakout and get similar results; the I2C address returned below may be different with a different breakout.

Simply connect your STEMMA QT cable from the MCP9808 STEMMA QT connector to the PiCowbell Proto STEMMA QT connector.

I2C Scan Code

// SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries
// SPDX-FileCopyrightText: 2022 Kattni Rembor for Adafruit Industries
// SPDX-License-Identifier: MIT
// --------------------------------------
// PiCowbell Proto and Pico I2C scan code.
// Modified from
// --------------------------------------

#include <Wire.h>

// Wire uses GPIO4 (SDA) and GPIO5 (SCL) automatically.
#define WIRE Wire

void setup() {

  while (!Serial)
  Serial.println("\nPiCowbell Proto Pico I2C Scanner");

void loop() {
  byte error, address;
  int nDevices;


  nDevices = 0;
  for(address = 1; address < 127; address++ )
    // The i2c_scanner uses the return value of
    // the Write.endTransmission to see if
    // a device did acknowledge the address.
    error = WIRE.endTransmission();

    if (error == 0)
      Serial.print("I2C device found at address 0x");
      if (address<16)
      Serial.println("  !");

    else if (error==4)
      Serial.print("Unknown error at address 0x");
      if (address<16)
  if (nDevices == 0)
    Serial.println("No I2C devices found\n");

  delay(5000);           // wait 5 seconds for next scan

Upload the sketch to your board and open up the Serial Monitor (Tools -> Serial Monitor) at 115200 baud. You should see something like the following.

The MCP9808 default I2C address is 0x18. You've now verified your PiCowbell Proto and Pico are assembled properly, and that Arduino is detecting the I2C device you connected! Now you're ready to jump into whatever project you have planned!

Note that Wire represents both of the pins used by the STEMMA QT connector, which are GPIO4 (SDA) and GPIO5 (SCL). For more details on how Wire works, check out the Arduino Pico Wire documentation.

This guide was first published on Nov 16, 2022. It was last updated on Oct 28, 2022.

This page (Arduino I2C Scan) was last updated on Nov 07, 2022.

Text editor powered by tinymce.