As it should be for a decent gig, I have a weather station, which I collected from DHT22, Raspberry Pi and Nokia screen, this is a continuous power solution that transmits data via Ethernet.
But now I needed a mobile weather station on the balcony, wireless and battery powered.
I used the Z-Uno Z-Wave motherboard as a radio module, and decided to try the Sensirion SHT20 I2C-powered as the temperature and humidity sensor.
Materials and prices:
Z-Uno is constantly updated, adding support for new peripherals and libraries. At the moment, the current firmware version 2.0.9 and it has support for the following devices:
- 1-Wire DS18B20 temperature sensor
- DHT22 && DHT11 temperature and humidity sensor
- 125Khz RFID card reader
- I2C BMP180 pressure and temperature sensor
- and other devices, examples here z-uno.z-wave.me/examples
Sensor Sensirion SHT20, working on I2C bus in the list of supported was not there, so I had to write my implementation for Z-Uno. The sketch syntax for Z-Uno is most similar to Arduino, the whole sketch fits in 35 lines:
Sketch for Z-Uno to work with the sensor temperature and humidity Sensirion SHT20#include <Wire.h> #include "SHT2x.h" int16_t temperature; uint8_t humidity; ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING); #define ZUNO_CHANNEL_TEMPERATURE 1 #define ZUNO_CHANNEL_HUMIDITY 2 ZUNO_SETUP_CHANNELS( ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(getterTemp), ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getterHumid) ); void setup() { Wire.begin(); } void loop() { temperature = SHT2x.GetTemperature(); zunoSendReport(ZUNO_CHANNEL_TEMPERATURE); humidity = SHT2x.GetHumidity(); zunoSendReport(ZUNO_CHANNEL_HUMIDITY); zunoSendDeviceToSleep(); } byte getterTemp(void) { return temperature; } byte getterHumid(void) { return humidity; }
SHT2x.cpp modified for Z-Uno SHT2x.h #ifndef SHT2X_H #define SHT2X_H
Of the special things, in the sketch there is only a line that translates Z-Uno into sleep mode:
ZUNO_SETUP_SLEEPING_MODE(ZUNO_SLEEPING_MODE_SLEEPING)
And setting which channel to send temperature to, and to which humidity:
ZUNO_SETUP_CHANNELS( ZUNO_SENSOR_MULTILEVEL_TEMPERATURE(getterTemp), ZUNO_SENSOR_MULTILEVEL_HUMIDITY(getterHumid) )
Otherwise, the usual Arduino code.
Sensirion SHT20 works on I2C and is connected by 2 wires. By default, pins 9 and 10 are defined for I2C in the Wire.h library.
Information from the sensor can be viewed on the phone and it is used in automation, to control the humidifier and air conditioning.
Data is updated every 12 minutes; in this mode, the sensor should work more than 2 years from one set of batteries.
Gain's body G517B 90 x 60 x 20 cm was specially chosen with a place for the battery compartment, everything fits perfectly.
The development of a Z-Wave temperature and humidity sensor took about 2 hours and 3746 r. You can also add an E-Ink screen and hang it on the wall!