This is an old revision of the document!
This laboratory is located in the office of ITT Group in Tallinn, Estonia.
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.
For this laboratory, the student should understand basic MQTT concepts like topics, broker, subscribing and publishing.
This laboratory consists of a DHT22 temperature and humidity sensor module attached to the ITT IoT controller module.
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 values). The sensor is calibrated and doesn't require extra components so you can get right to measuring relative humidity and temperature.
1-wire data connection is connected to port GPIO2.
The user can connect and program this controller using the Distancelab environment.
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.
#include <Arduino.h> #include <ittiot.h> #include <DHT.h> #define DHTPIN D4 // what pin we're connected to #define DHTTYPE DHT22 // DHT 22 (AM2302) DHT dht(DHTPIN, DHTTYPE); void iot_connected() { Serial.println("MQTT connected callback"); iot.log("IoT DHT example!"); } void setup() { Serial.begin(115200); Serial.println("Booting"); iot.printConfig(); // print json config to serial //Peale Serial.begin ja enne iot.setup 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,10); digitalWrite(16,HIGH); iot.publishMsg("temp",buf); delay(2000); digitalWrite(16,LOW); String(h).toCharArray(buf,10); iot.publishMsg("hum",buf); delay(2000); }
List study scenarios (hands-on labs), linking to the Dokuwiki pages with hands-on labs descriptions (there should be a separate page for each scenario). Classify each scenario and refer to the target group using starting keywords: * Beginners * Undergraduates * Masters * Professionals Note, assume that more professional group automatically contains less professional ones. Note - use language and as appropriate to the target group, i.e.:
* Beginners: Elementary operations on the Arduino 2x16 LCD screen. * Undergraduates: Visualizing temperature and humidity on the remote screen. * Masters: Using power saving states to limit power consumption.
Give some information on how to access help, how to get support in case of the trouble etc.