Not working with Qwiic devices

I bought this board primarily since it had Qwiic connector port as well as wifi but it is not working with the Sparkfun sensors. It loads the sketch without problems or errors but does nothing. Using the same cable and sensor with the Sparkfun Redboard it works fine. Will we have to wait for new libraries?

which sensor are you using?

I tried both the Qwiic Twist and Qwiic RTC. Both work with the RedBoard

I'm experiencing the same problem. I tried an Adafruit Qwicc AHT20 Temperature/Humidity sensor. The sensor is not detected.

The Qwicc AHT20 sensor is working fine with both Adafruit Metro M4 Express and a Node MCU 1.0 (ESP-12E) boards.

Don

I started off simple and tried one of the Sparkfun Quiic buttons, and
And I tried the Example2_LightWHenPressed example sketch.

The unmodified sketch did not work. But I remembered that the Qwiic connector is on the Wire1 buss, not the default Wire buss.

So I updated the sketch:

/******************************************************************************
  Turns on the Button's built in LED when pressed, and prints status over Serial!

  Fischer Moseley @ SparkFun Electronics
  Original Creation Date: July 24, 2019

  This code is Lemonadeware; if you see me (or any other SparkFun employee) at the
  local, and you've found our code helpful, please buy us a round!

  Hardware Connections:
  Attach the Qwiic Shield to your Arduino/Photon/ESP32 or other
  Plug the button into the shield
  Print it to the serial monitor at 115200 baud.

  Distributed as-is; no warranty is given.
******************************************************************************/

#include <SparkFun_Qwiic_Button.h>
QwiicButton button;
uint8_t brightness = 100;   //The brightness to set the LED to when the button is pushed
                            //Can be any value between 0 (off) and 255 (max)

void setup() {
  Serial.begin(115200);
  Serial.println("Qwiic button examples");
  Wire1.begin(); // ******* QWIIC is on Wire1 ***

  //check if button will acknowledge over I2C
  // On Wire1
  if (button.begin(SFE_QWIIC_BUTTON_DEFAULT_ADDRESS, Wire1) == false) {
    Serial.println("Device did not acknowledge! Freezing.");
    while (1);
  }
  Serial.println("Button acknowledged.");

  //Start with the LED off
  button.LEDoff();
}

void loop() {
  //check if button is pressed, and tell us if it is!
  if (button.isPressed() == true) {
    Serial.println("The button is pressed!");
    button.LEDon(brightness);
    while(button.isPressed() == true)
      delay(10);  //wait for user to stop pressing
    Serial.println("The button is not pressed.");
    button.LEDoff();
  }
  delay(20); //Don't hammer too hard on the I2C bus
}

Changed the Wire1.begin() and the button.begin() lines to use Wire1

Qwiic button examples
Button acknowledged.
The button is pressed!
The button is not pressed.
The button is pressed!

My guess is this is the issue with several others in this thread as well

EDIT: Also tried a Qwiic BMP388 Pressure Sensor (now retired)... again I had to edit the sketch to work with Wire1 and in this case I had to edit the begin method to pass in the I2C Address.

1 Like

You got it! Changing to Wire1 in both the Qwiic Twist and RTC sketches got them working. Thanks! Ifeel justified in buying this now. I love the fact you can chain devices together and now I can use my breadboards for slicing my tiny loaves!

KurtE, thanks! That was it. My Qwicc AHT20 sensor is now working!

In addition to:

Wire1.begin( );

I had to change:

aht.begin( );
     to
aht.begin( &Wire1 );

Don

Thinking that other Sparkfun Qwiic devices will now work using the Wire1 trick, I purchased the Temperature and PIR sensors. Unfortunately this is not the case. A posting to the Sparkfun forum told me that you also need to point it to the correct pin #s but gave no details about how to do this. Any ideas?

Which device? Which software library… code you are running

It is the SparkFun_STTS22H.h library for the SparkFun Temperature Sensor - STTS22H (Qwiic). It works fine on the RedBoard. I tried the examile1-basic sketch

Sorry I don't have this device... I don't think... I did not have that library installed

But looks like it should work... IF...

void setup()
{

	Wire1.begin();

	Serial.begin(115200);

	if( !mySTTS.begin(Wire1) )
	{
		Serial.println("Did not begin.");
		while(1);
	}

	Serial.println("Ready");

With the two lines changed that have the word Wire1 in it.

1 Like

No, I tried that before.
There are 2 lines in the library file:
// wirePort optional. The Wire port. If not provided, the default port is used
// address optional. I2C Address. If not provided, the default address is used.

Does this mean that I need to add these to the sketch since it was written for Wire not Wire1?
If so, What would they look like?

I figured it out, just in setup, in the begin() function of the sensor, there is needed information about Wire1.

#include <Wire.h>
#include <SparkFun_TMP117.h>

TMP117 sensor;

void setup() {
Wire1.begin();
Serial.begin(115200);
sensor.begin(0x48, Wire1);
}
void loop() {
Serial.println(sensor.readTempC());
delay(1000);
}

Yes, that worked. In my case with the sensor I own the code is:

#include <Wire.h>
#include "SparkFun_STTS22H.h"

SparkFun_STTS22H mySTTS; 

float temp; 

void setup()
{

	Wire1.begin();

	Serial.begin(115200);

 mySTTS.begin( Wire1);

It does not need the address 0x48 for some reason.  Thank you very much

Hello again,
I have just got a LISMDL with a view to working through calibration of a Magnetometer.
Using the LIS3MDL demo example I have finally got it working with Uno R4 Wifi using Qwiic ( on LISMDL) with wire pins SCL, SDA, 5v, and Gnd to R4 header.
I have followed this thread and I cannot seem to get it to work Qwiic to Qwiic.
Serial monitor output:-

Adafruit LIS3MDL test!
Failed to find LIS3MDL chip

I tried Wire Wire1: , Wire1.begin(): and changing

if (! lis3mdl.begin_I2C()) { // hardware I2C mode, can pass in address & alt Wire

to

if (! lis3mdl.begin_I2C(Wire1)) { // hardware I2C mode, can pass in address & alt Wire

and various other options but it will not compile.
Error:-
Arduino: 1.8.19 (Windows 10), TD: 1.57, Board: "Arduino Uno R4 WiFi"

C:\Users\vaughn\AppData\Local\Temp\arduino_modified_sketch_208908\lis3mdl_demo.ino: In function 'void setup()':

lis3mdl_demo:20:32: error: no matching function for call to 'Adafruit_LIS3MDL::begin_I2C(TwoWire&)'

if (! lis3mdl.begin_I2C(Wire1)) { // hardware I2C mode, can pass in address & alt Wire

                            ^

In file included from C:\Users\vaughn\AppData\Local\Temp\arduino_modified_sketch_208908\lis3mdl_demo.ino:4:0:

C:\Users\vaughn\Documents\Arduino\libraries\Adafruit_LIS3MDL/Adafruit_LIS3MDL.h:74:8: note: candidate: bool Adafruit_LIS3MDL::begin_I2C(uint8_t, TwoWire*)

bool begin_I2C(uint8_t i2c_addr = LIS3MDL_I2CADDR_DEFAULT,

    ^~~~~~~~~

C:\Users\vaughn\Documents\Arduino\libraries\Adafruit_LIS3MDL/Adafruit_LIS3MDL.h:74:8: note: no known conversion for argument 1 from 'TwoWire' to 'uint8_t {aka unsigned char}'

exit status 1

no matching function for call to 'Adafruit_LIS3MDL::begin_I2C(TwoWire&)'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

You might try:
if (! lis3mdl.begin_I2C(LIS3MDL_I2CADDR_DEFAULT, &Wire1)) { // hardware I2C mode, can pass in address & alt Wire

1 Like

Worked a treat! Thanks
Looking back I had tried the (LIS3MDL_I2CADDR_DEFAULT, Wire1), and it didn't compile, sort of guessed it by looking at the .cpp and .h files; (i2c_address, wire) but did not know the '&' was needed. Still don't know why.
My programming knowledge is very basic.

Glad it worked.

The language syntax can be very confusing. I have used it for years, but there are some of the new things, that I have to look up... Like lambda stuff or templates...

But in this case the error message gave the hint. From your first post:

An object can be passed in three ways (object, pointer to object, reference to object)

By pointer: something like, by pointer as this one is: TwoWire*
The * is the key... So it wants you to pass it a pointer, which you get with an &
so &Wire1

Some do by reference: The definition would have been: TwoWire&
The & is key, To pass one you simply pass: Wire1

An object: would have been just: TwoWire
And I doubt would work...

Good luck.

1 Like

Thank you.

thanks for all those info guys.
i have the same kind of issues on a BNO085 from adafruit.
i use the quaternion template and edited as you did for your qwiic sensors but no luck for me :

the edited code :

void setup(void) {

  Wire1.begin();
  Serial.begin(115200);
  while (!Serial) delay(10);     // will pause Zero, Leonardo, etc until serial console opens

  Serial.println("Adafruit BNO08x test!");


  if (!bno08x.begin_I2C(74,&Wire1)) {
  //if (!bno08x.begin_UART(&Serial1)) {  // Requires a device with > 300 byte UART buffer!
  //if (!bno08x.begin_SPI(BNO08X_CS, BNO08X_INT)) {
    Serial.println("Failed to find BNO08x chip");
    while (1) { delay(10); }
  }

  Serial.println("BNO08x Found!");

  setReports(reportType, reportIntervalUs);

  Serial.println("Reading events");
  delay(100);
}

the result :
16:45:10.244 -> Adafruit BNO08x test!

16:45:10.276 -> I2C address not found

16:45:10.276 -> Failed to find BNO08x chip
with an i2c scanner i got a response on this address on Wire 1:

16:49:17.386 -> I2C Scanner

16:49:17.386 -> Scanning...

16:49:17.482 -> I2C device found at address 0x4A !

16:49:17.546 -> done

16:49:17.546 ->

and if i bypass de infiinite hold delay , i get this :

16:50:28.736 ->   addr: 20007ea8    data: 0000a500
16:50:28.736 ->   addr: 20007eac    data: ffffffff
16:50:28.736 ->   addr: 20007eb0    data: 20003064
16:50:28.736 ->   addr: 20007eb4    data: 00005159
16:50:28.736 ->   addr: 20007eb8    data: 20000004
16:50:28.736 ->   addr: 20007ebc    data: 00004119
16:50:28.736 ->   addr: 20007ec0    data: 20000004
16:50:28.736 ->   addr: 20007ec4    data: 00000000
16:50:28.769 ->   addr: 20007ec8    data: 00004040
16:50:28.769 ->   addr: 20007ecc    data: 000044ad
16:50:28.769 ->   addr: 20007ed0    data: 20001a78
16:50:28.769 ->   addr: 20007ed4    data: 0000b7f1
16:50:28.769 ->   addr: 20007ed8    data: 00010f9b
16:50:28.769 ->   addr: 20007edc    data: 40046f00
16:50:28.769 ->   addr: 20007ee0    data: 00000000
16:50:28.769 ->   addr: 20007ee4    data: 0000b833
16:50:28.769 ->   addr: 20007ee8    data: 00010f9b
16:50:28.769 ->   addr: 20007eec    data: 00006b4f
16:50:28.801 ->   addr: 20007ef0    data: 00010f9b
16:50:28.801 ->   addr: 20007ef4    data: 00009783
16:50:28.801 ->   addr: 20007ef8    data: 00009779
16:50:28.801 ->   addr: 20007efc    data: 00002599
16:50:28.801 -> ====================================
16:50:28.801 -> =================== Registers information ====================
16:50:28.801 ->   R0 : 00000000  R1 : 00000000  R2 : 20001c48  R3 : 000006e9
16:50:28.832 ->   R12: e000e102  LR : 000054a7  PC : 000006e8  PSR: 21000000
16:50:28.832 -> ==============================================================
16:50:28.832 -> Debug fault is caused by BKPT instruction executed
16:50:28.832 -> Show more call stack info by run: addr2line -e "C:\Users\julien\AppData\Local\Temp\arduino\sketches\AA930C285D9FAD1E43748EDBF0656C4E/quaternion_yaw_pitch_roll.ino".elf -a -f 000006e8 000054a6 00005158 00004118 000044ac 0000b7f0 0000b832 00006b4e 00009782 00009778