#Adafruit QT Py ESP32-S3 WiFi Dev Board Support

1 messages · Page 1 of 1 (latest)

rugged sparrow
#

I'm having issues getting my QT Py to detect a connected I2C sensor.

I put the same code onto an Uno, and it detected the sensor no problem.

The sensor in question is the Adafruit DPS310 Barometric Pressure/Temperature sensor.

Any help would be great

ebon merlin
#

Which I2C port? The stemma QT connector is a different port than the SDA and SCL pins on the boiard.

rugged sparrow
#

I based my script off of one of the DPS310 examples, so maybe I need to change which i2c it looks at? Not entirely sure how. I am using the on-board i2c port.

compact light
#

i2c = board.STEMMA_I2C()

rugged sparrow
#

How can I specify what i2c it uses via the Adafruit_DPS310 lib? I'm using the arduino IDE. I can't find an option to pass in the I2C to use?

compact light
rugged sparrow
#

Great, I'll give that a go now. Thanks!

#

🤔 I uploaded the code, but am not getting anything on the serial monitor. I tried the QT Py blink example yesterday and it was printing serial just fine.

I've had to put the board into manual bootloader, every time I want to update the code, because the built-in upload via the Arduino IDE causes it to fail the upload.

We spent hours in the projects channel debugging this. It's a bug with the esp library. Either way, manually uploading seems to successfully get the code onto the board. Though now it is having issues either executing the code, or writing to serial. All rather frustrating TBH.

compact light
#

i'd say get the minimal example that shows the problem. can continue debugging here. I have not looked in the projects channel

rugged sparrow
#

I think part of what is confusing me here is how there are certain global variables that are imported in when I #include a .h file. For instance, the use of #include <Wire.h> allows #define WIRE Wire1 and looks like Wire1.setPins(SDA1, SCL1) also works? SDA1 and SCL1 being constant defined?

I am trying to take this example script and adapt it to use the Wire1 i2c instead of the default. https://learn.adafruit.com/adafruit-dps310-precision-barometric-pressure-sensor/arduino#example-code-3054891

I found the original code for the lib I am trying to use - https://github.com/adafruit/Adafruit_DPS310/blob/master/Adafruit_DPS310.cpp#L67 and it shows that the second argument is TwoWire *wire and the header file shows it as TwoWire *wire = &Wire

What does this mean exactly?

compact light
# rugged sparrow I think part of what is confusing me here is how there are certain global variab...

I tried this locally, and this works:

...
Serial.begin(115200);
  while (!Serial) delay(10);

  Wire1.setPins(SDA1, SCL1);  ///////////  NEW*************

  Serial.println("DPS310");
  if (! dps.begin_I2C(DPS310_I2CADDR_DEFAULT, &Wire1)) {             // Can pass in I2C  address here  NEW*************
  //if (! dps.begin_SPI(DPS310_CS)) {  // If you want to use SPI
    Serial.println("Failed to find DPS");
    while (1) yield();
  }
  Serial.println("DPS OK!");
...
#

There are two I2C objects available, Wire and Wire1. I am using Wire1. Interesting, substituting Wire for Wire1 above does not work, maybe because of some pre-initialization of WIre.

#

but I'm not sure about this

rugged sparrow
#

Thanks, I will try this

#

What does the * and & mean next to Wire? I am not sure what that means in C++ (I think in C# it's called a pointer, but not sure if that's the same in C++)

compact light
#

yes that's syntax related to pointers. In C++ it's somewhat more complicated, but basically it represents the whole Wire1 object or just the address of the Wire1 object. It is worth reading a C++ intro if you want more info

rugged sparrow
#

Ok that worked!!
Key parts

#include <Adafruit_DPS310.h>
#include <Wire.h> // <--

#define WIRE Wire1 // <--

Adafruit_DPS310 dps;

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

  Wire1.setPins(SDA1, SCL1); // <--

  Serial.println("DPS310");
  if (! dps.begin_I2C(0x77, &Wire1)) { // <--
    Serial.println("Failed to find DPS");
    while (1) yield();
  }
}

Not sure if the first two changes actually matter or not. I actually tried passing in Wire1 originally but got that syntax error. I guess all I had to do was throw & on the front to get it to work?

compact light
#

You don't need these:

#include <Wire.h> // <--

#define WIRE Wire1 // <--
#

the include is already done by the other include, and WIRE (all caps) is not used, so you don't need it

#

I guess all I had to do was throw & on the front to get it to work?

#

yes, not syntax error, but type-matching error

rugged sparrow
#

Gotcha. Thanks for your help!