This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| en:iot-open:remotelab:itt:thermohygro [2018/11/14 19:27] – rim.puks | en:iot-open:remotelab:itt:thermohygro [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ===== Temperature and humidity sensor module ===== | + | ===== ITT Temperature and humidity sensor module ===== |
| This laboratory is located in the office of ITT Group in Tallinn, Estonia. | This laboratory is located in the office of ITT Group in Tallinn, Estonia. | ||
| ==== Introduction | ==== Introduction | ||
| This laboratory can be used to practice reading values from sensors and send them over MQTT. It can be used as a simple task of sending the sensor value or part of a bigger system, where actuators from other modules perform actions based on the sensor values received. | This laboratory can be used to practice reading values from sensors and send them over MQTT. It can be used as a simple task of sending the sensor value or part of a bigger system, where actuators from other modules perform actions based on the sensor values received. | ||
| + | |||
| + | {{: | ||
| ==== Prerequisites ==== | ==== Prerequisites ==== | ||
| Line 9: | Line 11: | ||
| ==== Technical details ==== | ==== Technical details ==== | ||
| - | This laboratory consists of a DHT22 temperature and humidity sensor module attached to the ITT IoT controller module. | + | This laboratory consists of a DHT22 temperature and humidity sensor module attached to the ITT IoT controller module. |
| === Sensors === | === Sensors === | ||
| - | This laboratory uses the DHT22 temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure temperature. The sensor only transmits digital data (no analog | + | This laboratory uses the DHT22 temperature and humidity sensor. It uses a capacitive humidity sensor and a thermistor to measure temperature. The sensor only transmits digital data (no analogue |
| + | |||
| + | === Specifications === | ||
| + | * 1-wire digital interface | ||
| + | * Humidity from 0-100% RH | ||
| + | * -40 - 80 degrees C temperature range | ||
| + | * +-2% RH accuracy | ||
| + | * +-0.5 degrees C | ||
| + | |||
| + | === Electrical connection === | ||
| + | |||
| + | The 1-wire data connection is connected to port GPIO2. | ||
| === Software, libraries and externals === | === Software, libraries and externals === | ||
| Line 25: | Line 38: | ||
| ==== Hands-on labs ==== | ==== Hands-on labs ==== | ||
| - | //List study scenarios | + | |
| - | | + | === Example code === |
| - | | + | |
| - | | + | <code c> |
| - | | + | #include < |
| - | Note, assume that more professional group automatically contains less professional ones. Note - use language and as appropriate | + | #include < |
| - | < | + | |
| - | | + | #include < |
| - | | + | #define DHTPIN D4 // what pin we're connected to |
| - | | + | #define DHTTYPE DHT22 // DHT 22 |
| + | |||
| + | DHT dht(DHTPIN, DHTTYPE); | ||
| + | |||
| + | void iot_connected() | ||
| + | { | ||
| + | | ||
| + | | ||
| + | } | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | | ||
| + | | ||
| + | iot.printConfig(); | ||
| + | iot.setup(); | ||
| + | pinMode(16, OUTPUT); | ||
| + | dht.begin(); | ||
| + | |||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | iot.handle(); | ||
| + | |||
| + | float h = dht.readHumidity(); | ||
| + | float t = dht.readTemperature(); | ||
| + | |||
| + | char buf[10]; | ||
| + | String(t).toCharArray(buf, | ||
| + | |||
| + | | ||
| + | iot.publishMsg(" | ||
| + | delay(2000); | ||
| + | | ||
| + | |||
| + | String(h).toCharArray(buf, | ||
| + | | ||
| + | delay(2000); | ||
| + | } | ||
| </ | </ | ||
| + | |||
| ==== Support ==== | ==== Support ==== | ||
| - | //Give some information on how to access help, how to get support in case of the trouble etc.// | + | info@ittgroup.ee |