Hi everyone,
I am having trouble getting my SHTC3 temperature/humidity sensor to work on a Heltec CubeCell HTCC-AB01 V2.2 when using the LoRaWAN library.
The Setup:
- Board: HTCC-AB01 V2.2 (SDA on GPIO 7, SCL on GPIO 6).
- Sensor: SHTC3 (connected via I2C).
-
Power: Powered via the
Vextpin.
The Problem: I have a simple test sketch (see below) that works perfectly. It initializes the sensor and prints correct values to the Serial Monitor. However, as soon as I integrate this into a LoRaWAN sketch (using the standard Heltec LoRaWAN library), the sensor fails to initialize or return values.
I get error codes like SHTC3_Status_ID_Fail (1) or SHTC3_Status_CRC_Fail (3) inside the prepareTxFrame function. It seems like the LoRaWAN stack or the sleep cycles are interfering with the I2C bus or the Vext power stability.
I have tried:
- Adding long delays after
VextLOW. - Manual I2C recovery/bit-banging pulses before
Wire.begin. - Lowering the I2C clock speed.
- Keeping
Vextactive throughout the cycle.
Nothing seems to work once the LoRaWAN stack is active, even though the hardware is clearly fine.
#include "Arduino.h"
#include "SparkFun_SHTC3.h"
SHTC3 mySHTC3;
float temperature, humidity;
void setup() {
Serial.begin(115200);
// Vext controls power to the sensor on CubeCell
pinMode(Vext, OUTPUT);
digitalWrite(Vext, LOW); // LOW activates power on AB01
delay(500); // Give sensor time to start
// Using GPIO 7 and 6 for V2.2
Wire.begin(7, 6);
Serial.println("SHTC3 Test on CubeCell AB01");
SHTC3_Status_TypeDef result = mySHTC3.begin();
if (result != SHTC3_Status_Nominal) {
Serial.println("Could not find SHTC3 sensor!");
} else {
Serial.println("SHTC3 found!");
}
}
void loop() {
SHTC3_Status_TypeDef result = mySHTC3.update();
if (result == SHTC3_Status_Nominal) {
temperature = mySHTC3.toDegC();
humidity = mySHTC3.toPercent();
Serial.print("Temp: ");
Serial.print(temperature);
Serial.print(" °C | Hum: ");
Serial.print(humidity);
Serial.println(" %");
} else {
Serial.print("Read error. Code: ");
Serial.println(result);
}
delay(2000);
}
Hopefull to be pointed in the right direction