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/12/06 06:16] – 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. | ||
| Line 14: | Line 14: | ||
| === 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 === | === Specifications === | ||
| Line 25: | Line 25: | ||
| === Electrical connection === | === Electrical connection === | ||
| - | 1-wire data connection is connected to port GPIO2. | + | The 1-wire data connection is connected to port GPIO2. |
| === Software, libraries and externals === | === Software, libraries and externals === | ||
| Line 38: | 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 |