As stated in a previous article about the MXChip IoT DevKit it contains several sensors including a HTS221 Humidity & Temperature sensor. You can see this in the image of the board below
Lets investigate the sensor
The HTS221 is an ultra-compact sensor for relative humidity and temperature. It includes a sensing element and a mixed signal ASIC to provide the measurement information through digital serial interfaces. The sensing element consists of a polymer dielectric planar capacitor structure capable of detecting relative humidity variations and is manufactured using a dedicated ST process.
Features
0 to 100% relative humidity range
Supply voltage: 1.7 to 3.6 V
Low power consumption: 2 μA @ 1 Hz ODR
Selectable ODR from 1 Hz to 12.5 Hz
High rH sensitivity: 0.004% rH/LSB
Humidity accuracy: ± 3.5% rH, 20 to +80% rH
Temperature accuracy: ± 0.5 °C,15 to +40 °C
Embedded 16-bit ADC
16-bit humidity and temperature output data
SPI and I²C interfaces
Parts
About $41 for the board
seeed studio MXChip AZ3166 IOT Developer Kit Compatible with Arduino
Code
This is for the Arduino IDE once you have added support for the MXChip
[codesyntax lang=”cpp”]
#include "HTS221Sensor.h" DevI2C *i2c; HTS221Sensor *sensor; float humidity = 0; float temperature = 0; unsigned char id; void setup() { i2c = new DevI2C(D14, D15); sensor = new HTS221Sensor(*i2c); // init the sensor sensor -> init(NULL); } void loop() { // enable sensor -> enable(); // read id sensor -> readId(&id); Serial.printf("ID: %d\r\n", id); // get humidity sensor -> getHumidity(&humidity); Serial.print("Humidity: "); Serial.println(humidity); // get temperature sensor -> getTemperature(&temperature); Serial.print("Temperature: "); Serial.println(temperature); // disable the sensor sensor -> disable(); // reset sensor -> reset(); delay(1000); }
[/codesyntax]
Open the serial monitor and you will see something like this
ID: 188
Humidity: 32.10
Temperature: 33.50
ID: 188
Humidity: 33.60
Temperature: 34.40
ID: 188
Humidity: 34.30
Temperature: 35.00
Links