This project is very simple and only needs a few main things. A D1-MINI for wifi, DHT11 for temperature and humidity, and some soldering materials for your own PCB shield. If you like, you can purchase professional PCBs using my file at the bottom of this tutorial.
First, place the D1-MINI and DHT11 onto the breadboard.
Then wire them as shown below.
My PCB is shown below. First solder the DHT11 and pin headers to the PCB board. Then, you can solder the wires on the bottom side. To make things easier, you should place the pin header onto the D1-MINI before soldering, so you can get the right spacing and connect the DHT11 to the correct pins. One thing I would change though, is instead of the data going to D0, have it go to D5.
Here is the link to my EasyEDA file.
First, sign up for Blynk then create a new project named D1-MINI and DHT11.
Then click on the screen, scroll down on the sidebar, and select two Level V. You can get creative with displaying your data, so pick something more to your taste. You can also resize most everything to what you want. I selected to Level H and two Gauges.
Next, I configured the left side to be temperature and the right side to be humidity.
Next, add a Super Chart. Click on it to change the settings. Make sure you have two datastreams as shown below. You can make them look cool by changing all the settings for each one. You can also choose what timeframes you want.
#define BLYNK_PRINT Serial
#include <Wire.h>
#include <SimpleDHT.h>
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
Include libraries.
SimpleDHT11 dht11(14);
char auth[] = "your_auth";
char ssid[] = "your_ssid";
char pass[] = "your_pass";
Setting up DHT11 and Blynk. Change the auth, ssid, and pass to your credentials.
void setup() {
Serial.begin(9600);
Blynk.begin(auth, ssid, pass);
}
In setup, we start serial and Blynk.
void loop() {
byte temperature = 0;
byte humidity = 0;
int err = SimpleDHTErrSuccess;
if ((err = dht11.read(&temperature, &humidity, NULL)) != SimpleDHTErrSuccess) {
Serial.println("DHT Fail"); //while(1);
}
Serial.println("Sending data!");
Blynk.virtualWrite(V4, (temperature*1.8)+32);
Blynk.virtualWrite(V5, humidity);
Blynk.run();
delay(2000);
}
In the loop, we read the DHT11 and send the data to virtual pins 4 and 5.
Wrapping Up
If you have any questions or comments ;) , please post in the comments.
Check out my other tutorials!
and my website
Comments