IoT Node

Installation

You'll need to install a library to make Arduino IDE support the sensor. This library includes drivers for the HTS221 sensor and sample code for you to jumpstart your project.

Software

For ESP32 based systems, we're currently supporting Arduino core. Please make sure you've installed the following:

  • Arduino IDE.

  • ESP32 Hardware libraries for the Arduino IDE.

  • Python for the compilation of Arduino projects.

  • Drivers for your host device, e.g., USB Virtual Serial Port driver.

Libraries

Please download the library archive from https://github.com/Turta-io/Modular

Then, copy its contents to your Arduino Libraries folder.

You can find the Arduino Libraries folder inside your Arduino sketch directory. It is generally located inside the My Documents folder.

Samples

The library comes with included samples. There is no need to download additional files for the examples.

Source Code

The hardware, its drivers and the sample code are open source. You can use them under the terms of the MIT license. Please feel free to customize and prototype them for your projects.

Arduino Library

Turta_TempRH_Module library is responsible for initializing the sensor, reading calibration data and reading temperature and humidity values with respect to calibration data.

To use the library on Arduino IDE, add the following #include statement to the top of your sketch.

#include <Turta_TempRH_Module.h>

Then, create an instance of the Turta_TempRH_Module class.

Turta_TempRH_Module th

Now you're ready to access the library by calling the th instance.

Initialization

To initialize the sensor, call the begin method.

begin()

This method turns the sensor on and then reads the calibration coefficients to the memory.

Basic Members

Read Temperature

Returns the last measured temperature reading from the sensor.

double readTemperature()
  • Parameters

    • None

  • Returns

    • Double: Temperature

Read Humidity

Returns the last measured relative humidity reading from the sensor.

double readHumidity()
  • Parameters

    • None

  • Returns

    • Double: Relative humidity.

Advanced Members

HTS221 Sensor includes advanced functions, just like controlling its internal heater for humidity sensing. Heater control methods will be implemented in the next release.

Examples

You can open the example from Arduino IDE > File > Examples > Examples from Custom Libraries > Turta Temp RH Module. There is one example of this sensor.

Temp RH Sample

Troubleshooting

If you're experiencing difficulties while working with your device, please try the following steps.

Problem: You're reading NaN instead of sensor data. Cause: The host device does not communicate with the sensor over the I2C protocol. There is a software bug on the ESP32 Arduino hardware library which prevents I2C communication. Solution: Please update the ESP32 hardware library.

Problem: Temperature reading is above, and humidity reading is below from it should be. Cause: ESP32's CPU can reach up to 240MHz, which heats itself and surroundings. Solution: For temperature and humidity reading applications, it would be better first to read the sensor data, then run the other tasks. If you're making just a temperature & humidity sensing device, you may wish to DeepSleep the host device while it is idle.

Problem: Humidity reading is much higher than it should be. Cause: In some cases, moisture does not escape from the sensor quickly. Solution: Please run the example application for a few hours and observe if the humidity level is decreasing. If not, you can bake the sensor module at 100 °C for 15 minutes to make moisture escape from the sensor's measuring hole.

Problem: Sensor readings are not accurate after inserting the sensor to the slot, while the application is running. Cause: The sensor library reads the calibration coefficients at the beginning of the application. If you insert the sensor module after the application is started, the library does not get the calibration coefficients and return inaccurate readings. Solution: Please press the reset button on the host board, or upload the application again while the sensor module is in the sensor slot.

Last updated