HTS221 humidity and temperature sensor

HTS221 is a humidity and temperature sensor that can be used by i2c. This sensor is available on ST X-NUCLEO-IKS01A1 expansion board. datasheet is available on ST web site : http://www.st.com/content/st_com/en/products/mems-and-sensors/humidity-sensors/hts221.html

Use the HTS221 (About Modules) module for it.

You can wire this up as follows:

Device Pin Espruino Pico
D15 (SCL) B6
D14 (SDA) B7
GND GND
+5V VBAT
+3V3 3.3

Note: To avoid links, you can use the ArduinoPico adaptor. In this case, check the pins to use for SPI1, it should be B8 and B9.

How to use module:

Polling:

I2C1.setup({scl:B6,sda:B7});
var temp = require("HTS221").connect(I2C1);

print(temp.getTemperature()); // degrees C
print(temp.getHumidity()); // % rh
print(temp.get()); // { temperature, humidity }

With interrupt pin:

I2C1.setup({scl:B6,sda:B7});
var temp = require("HTS221").connect(I2C1, { int: B8 });
temp.on('data', print);

Reference

// Initialise the module. See HTS221 for more information
exports.connect = function (i2c, options) { ... }

// Power down the HTS221
HTS221.prototype.stop = function () { ... }

// deprecated. It's now done automatically when the HTS221 class is created
HTS221.prototype.ObtainCalibratedTemperatureCoefficient = function () { ... }

// Read the temperature in degrees C
HTS221.prototype.getTemperature = function (callback) { ... }

// Read the humidity percentage (rh)
HTS221.prototype.getHumidity = function (callback) { ... }

// Get the current temperature in degrees C and humidity percentage (rh)
HTS221.prototype.get = function () { ... }

// Call the callback with a new humidity & temperature value
HTS221.prototype.read = function (callback) { ... }

// read register
HTS221.prototype.r = function (addr, cnt) { ... }

// read 16 bit regsister
HTS221.prototype.r16 = function (addr, signed) { ... }

// write register
HTS221.prototype.w = function (addr, data) { ... }

Buying:

The X-NUCLEO-IKS01A1 expansion board can be purchased from many places:

This page is auto-generated from GitHub. If you see any mistakes or have suggestions, please let us know.