I use VS Code and PlattformIO as my primary setup – but also tested the following code with the Arduino IDE (basically modified the provided example). Hardware is the Nano 33 BLE Sense from the Tiny ML Kit. I tried with and without the provided shield. The HTS221 library is the latest from Github vor VS Code and the latest the Arduino IDE provided.
It seems I can't use the temperature sensor - it fails during the setup stage: The console output always ends up in the "Failed to initialize humidity temperature sensor!" part. Is it possible that just the HTS221 part is broken? The barometer example with LPS22HB works fine.
Hopefully, someone can point me into the right direction.
Best regards!
Partial code. The loop() stage would just print out temperature values, but I don't get that far
#include <Arduino.h>
#include "Arduino_HTS221.h"
void setup() {
Serial.begin(9600);
while (!Serial);
while (!HTS.begin()) {
Serial.println("Failed to initialize humidity temperature sensor!");
delay(1000);
}
}
Windows 10 notebook – the Nano 33 BLE Sense is connected to a USB and recognized as device oN COM5. When I upload the code in VS Code or the sketch provided by @rooppoorali I get the error that the HTS221 could not be initialized. Example from the web IDE I just tested as well:
No I don't have another module to try. I used the sketch that comes bundles with the library for the HTS221 and Sense. It even says so in the description:
HTS221 - Read Sensors
This example reads data from the on-board HTS221 sensor of the
Nano 33 BLE Sense and prints the temperature and humidity sensor
values to the Serial Monitor once a second.
The circuit:
- Arduino Nano 33 BLE Sense
Thank you for the reply. I resolved the issue meanwhile with official Arduino support. Indeed, the device does not have a temperature sensor at all, which is mentioned as a footnote on the official Arduino page for the Tiny ML Kit. Could be a bit “more prominent” there, and a separate product page for the Arduino Nano 33 BLE Sense Lite would make it easier as well.
The real issue is that many official resellers fail to mention that at all on their websites. They have in their descriptions:
Arduino Nano 33 BLE Sense Lite including sensors for temperature, humidity, …
which is not correct.
Anyway, I learned some valuable insights and will keep looking for something similar with a temperature sensor