This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| en:iot-open:remotelab:itt:thermohygro [2017/11/09 13:15] – created pczekalski | en:iot-open:remotelab:itt:thermohygro [2020/07/20 09:00] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | Please create content | + | ===== ITT Temperature and humidity sensor module ===== |
| - | Copy/paste it, then replace | + | This laboratory is located in the office of ITT Group in Tallinn, Estonia. |
| + | |||
| + | ==== 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 | ||
| + | |||
| + | {{:en:iot_homelab_kit:hardware:hum2.png? | ||
| + | |||
| + | ==== Prerequisites ==== | ||
| + | For this laboratory, the student should understand basic MQTT concepts like topics, broker, subscribing and publishing. | ||
| + | |||
| + | ==== Technical details ==== | ||
| + | This laboratory consists of a DHT22 temperature and humidity sensor module attached to the ITT IoT controller module. | ||
| + | |||
| + | === 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 analogue values). The sensor is calibrated and doesn' | ||
| + | |||
| + | === 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 === | ||
| + | * ITTIoT libary - used to program | ||
| + | * Adafruit DHT sensor libary - used to read the values from the DHT22 sensor. | ||
| + | |||
| + | === Communication === | ||
| + | The user can connect | ||
| + | |||
| + | === Limits === | ||
| + | At the same time, only one user can program the controller. But all users connected to the Distancelab MQTT broker can read the values if they are being transmitted over MQTT. That is assuming they use the topic described in the controller program. | ||
| + | |||
| + | ==== Hands-on labs ==== | ||
| + | |||
| + | === Example code === | ||
| + | |||
| + | <code c> | ||
| + | #include < | ||
| + | #include < | ||
| + | |||
| + | #include < | ||
| + | #define DHTPIN D4 // what pin we're connected to | ||
| + | #define DHTTYPE DHT22 // DHT 22 (AM2302) | ||
| + | |||
| + | DHT dht(DHTPIN, DHTTYPE); | ||
| + | |||
| + | void iot_connected() | ||
| + | { | ||
| + | Serial.println(" | ||
| + | iot.log(" | ||
| + | } | ||
| + | |||
| + | void setup() | ||
| + | { | ||
| + | Serial.begin(115200); | ||
| + | Serial.println(" | ||
| + | iot.printConfig(); | ||
| + | iot.setup(); | ||
| + | pinMode(16, OUTPUT); | ||
| + | dht.begin(); | ||
| + | |||
| + | } | ||
| + | |||
| + | void loop() | ||
| + | { | ||
| + | iot.handle(); | ||
| + | |||
| + | float h = dht.readHumidity(); | ||
| + | float t = dht.readTemperature(); | ||
| + | |||
| + | char buf[10]; // Put whatever length you need here | ||
| + | String(t).toCharArray(buf, | ||
| + | |||
| + | digitalWrite(16, | ||
| + | iot.publishMsg(" | ||
| + | delay(2000); | ||
| + | digitalWrite(16, | ||
| + | |||
| + | String(h).toCharArray(buf, | ||
| + | iot.publishMsg(" | ||
| + | delay(2000); | ||
| + | } | ||
| + | </ | ||
| + | |||
| + | ==== Support ==== | ||
| + | info@ittgroup.ee | ||