Introduction: Blink a LED With Blynk App (Wemos D1 Mini Pro)

This Instructable will take you through controlling a LED using the Blynk App and the Wemos D1 Mini Pro. I found the instructions on their website to be a little confusing so I put together this. Hope you find it useful.

This is my first Instructable, hope it's a winner.

Step 1: Breadboard Layout

We will switch on an LED connected to your Wemos D1 Mini Pro using the Blynk App on your smartphone.

Connect an LED as shown here:

Step 2: Schematic View

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: App Settings - Name & Board Selection

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

Step 6: Authentication Token

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 a Widget

Your project canvas is empty, let’s add a button to control our LED. Tap anywhere on the canvas to open the widget box. All the available widgets are located here. Now pick a button. Widget Box

Step 8: Drag N Drop

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

Step 9: ​Widget Settings

Each Widget has it’s own settings. Tap on the widget to get to them. Set the Output to Virtual Pin 3 (V3).

Step 10:

Run The Project

When you are done with the Settings - press the PLAY button. This will switch you from EDIT mode to PLAY mode where you can interact with the hardware. While in PLAY mode, you won’t be able to drag or set up new widgets, press STOPand get back to EDIT mode. You will get a message saying “Arduino UNO is offline”. We’ll deal with that in the next section.

Step 11: Arduino 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).

#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>

#include <BlynkSimpleEsp8266.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[] = "";

int LED = D8; // Define LED as an Integer (whole numbers) and pin D8 on Wemos D1 Mini Pro

void setup() { // Debug console Serial.begin(115200); pinMode(LED, OUTPUT); //Set the LED (D8) as an output Blynk.begin(auth, ssid, pass);

}

void loop() { Blynk.run(); } // This function will be called every time button Widget // in Blynk app writes values to the Virtual Pin V3 BLYNK_WRITE(V3) { int pinValue = param.asInt(); // Assigning incoming value from pin V3 to a variable if (pinValue == 1) { digitalWrite(LED, HIGH); // Turn LED on. } else { digitalWrite(LED, LOW); // Turn LED off. } }

Step 12: ​Blynking

Go back to the Blynk App, push the button and turn the LED on and off! It should be Blynking.

Step 13: Photo of Finished Product

Step 14:

Arduino Contest 2017

Participated in the
Arduino Contest 2017