Introduction: Send Temperature & Humidity to Blynk App (Wemos D1 Mini Pro).

This Instructable looks at using the Wemos D1 Mini Pro to send datta (Temperature & Humidity) to the Blynk APP.

Step 1: ​Getting Started

We will get a temperature and humidity reading pushed to your Blynk App on your phone. Connect an LED as shown here: Note. I have used the blue DHT11 Digital Temperature/Humidity module which has three pins. The module is from Banggood. Other similar modules from different suppliers may have a different pin layout. Check this. The colours below are correct for the Banggood module:

Blue = Data signal (left)

Red = Vcc +5v (middle)

Black = Ground (right)

Step 2: Important.

As mentioned above.

Note. I used the blue DHT11 Digital Temperature/Humidity module from Banggood which has three pins. Other similar modules from different suppliers may have a different pin layout. Check this. The colours are correct for the Banggood module:

Blue = Data signal (left) Red = Vcc +5v (middle) Black = Ground (right)

Step 3: Getting Started With the Blynk App

Create a Blynk Account After you download the Blynk App, you’ll need to create a New Blynk account. This account is separate from the accounts used for the Blynk Forums, in case you already have one. We recommend using a real email address because it will simplify things later.

Why do I need to create an account?
An account is needed to save your projects and have access to them from multiple devices from anywhere. It’s also a security measure. You can always set up your own Private Blynk Server (Links to an external site.)Links to an external site. and have full control.

Step 4: ​Create a New Project

After you’ve successfully logged into your account, start by creating a new project.

Step 5: Name/Board/Connection

Give it a name and select the appropriate board (Wemos D1 Mini). Now click create.

Step 6: Authentication

Your Authentication token will be emailed to you and you will also be able to access it in the settings of your project. A new number will be generated for each project you create.

Step 7: ​Add Two Widgets (Value Display)

Your project canvas is empty, let’s add a two display widgets to show temperature and humidity. Tap anywhere on the canvas to open the widget box. All the available widgets are located here.

Step 8: Drag N Drop

Drag-n-Drop - Tap and hold the Widget to drag it to the new position.

Step 9: Humidity

Widget Settings - Each Widget has it’s own settings. Tap on the widget to get to them. Set them up with the following settings.

Step 10: Temperature

Widget Settings - Each Widget has it’s own settings. Tap on the widget to get to them. Set them up with the following settings.

Step 11: Run the Project.

Step 12: Run the Code.

Now let’s take a look at the example sketch for a Wemos D1 Mini Pro. Notice there are three key components that you will need to include:

1. char auth[] = ""; Specific to your project (Blynk App).

2. char ssid[] = ""; Specific to the network that we are connecting to (network name). You can "hotspot" from your phone also.

3. char pass[] = ""; Specific to the network we are connecting to (password).

CODE

#define BLYNK_PRINT Serial
 
#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.h>

#include <DHT.h> 

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "";
 
// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "";
char pass[] = "";
 
#define DHTPIN D4          // What digital pin we're connected to
#define DHTTYPE DHT11     // DHT 11<p>DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;
float t;
float h;

void setup()
{
  // Debug console
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  dht.begin();
  timer.setInterval(1000L, sendSensor);
}
 
void loop()
{
  Blynk.run();
  timer.run();
}
 
 
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendSensor()
{
  h = dht.readHumidity();
  t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit
//  l = analogRead(LDR);
  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}
 

Step 13: ​Display

Go back to the Blynk App and check your display. You should see the current temperature & humidity.

Step 14: Photo of Project

Step 15: Video of Project Working

Arduino Contest 2017

Participated in the
Arduino Contest 2017