Nano BLE 33 Sense and Humidity

This is my first BLE Sense. I’ve hit a couple of problems with it, but I’ll just focus on the Humidity in this post.

My activation of the humidity sensor is as basic as it gets.

#include "Arduino_HTS221.h"

float humidity = 0;        //Humidity of room

void setup() {  
Serial.begin(115200);  //Start Serial USB
//Start humidity and temp code
  if (!HTS.begin()) {
    while(1);
  }
  //End humidity and temp init code
}

void loop() {
  humidity = HTS.readHumidity();
  
  String str;
  str = "Humidity: " + String(humidity,3) + ";";
  Serial.print(str);
  delay(1000);
}

When I first got the BLE Sense yesterday, the reading was 0%.
This morning it was reading 5%, and now it’s reading -5%.

What am I doing wrong? Or is this thing a dud?

Welcome to the forum

Try the official example and you will see your Arduino is fine.

File -> Examples -> Arduino_HTS221 -> ReadSensors

You have to read the temperature before you can read the humidity. I do not remember why but I just added one line to your code and it changed the behavior from what you describe to the correct one.

Note: You do not need set the serial speed to a high value. The value is ignored for the Arduino Nano 33 BLE. The COM port is virtual because the device has native USB.

Thanks. That seems to have worked. What a strange feature. :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.