Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Arduino_Genuino
Published

DHT11 Temperature and Humidity sensor in the Cloud

Take readings from the DHT11 Temperature/Humidity sensor and display them on the Arduino IoT Cloud.

BeginnerFull instructions provided1 hour14,557
DHT11 Temperature and Humidity sensor in the Cloud

Things used in this project

Hardware components

Arduino MKR WiFi 1010
Arduino MKR WiFi 1010
Or another IoT Cloud compatible board.
×1
DHT11 Temperature & Humidity Sensor (3 pins)
DHT11 Temperature & Humidity Sensor (3 pins)
×1
Jumper wires (generic)
Jumper wires (generic)
×1
Breadboard (generic)
Breadboard (generic)
×1

Software apps and online services

Arduino IoT Cloud
Arduino IoT Cloud

Story

Read more

Code

IoTDHT11

Arduino
Upload this sketch from the IoT Cloud
/*
Sketch generated by the Arduino IoT Cloud Thing "DHT11"
https://create.arduino.cc/cloud/things/1473e29f-8db8-4365-bf0d-e4aab76b4db1
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float humidity;
float temperature;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
#include <EduIntro.h>
DHT11 dht11(D7);  // creating the object sensor on pin 'D7'
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// Your code here
dht11.update();
temperature = dht11.readCelsius();
humidity = dht11.readHumidity();
}

Credits

Arduino_Genuino
91 projects • 11344 followers
Contact

Comments

Please log in or sign up to comment.