🚚 Free delivery on orders over: €35 Croatia • €60 EU • $100 US

BLYNK + CRODUINO NOVA: TURNING THE LED ON (PART 1/3)

BLYNK + CRODUINO NOVA: TURNING THE LED ON (PART 1/3)-Uncategorized @hr

INTRODUCTION

If you have ever wondered how you could connect your project to the Internet, you are in the right spot. In this tutorial, we will get acquainted with two powerful tools in the world of “Internet of things”. Those are Dasduino Connect and the application “Blynk”. Blynk is a way for connecting between the physical board and hardware (e.g. Dasduino Connect) or mobile applications. Using a mobile application, you can control the board (e.g. control the lighting) or read data from it (e.g. temperature).

Blynk tutorial series consist of 3 parts;
1st part: Introduction, LED
2nd part: Temperature and humidity reading
3rd part: Controlling the motor

HOW TO START WORKING WITH BLYNK APPLICATION

Getting started with the Blynk application is very simple. With just a few clicks, you can begin with your project. The steps are explained on the official site of Blynk application. So let’s go, one by one:

  1. 1. Select and install the appropriate version of the application on your smartphone or tablet, depending on whether you own an Android or iOS.
  2. 2. Create your account by clicking on „Create New Account“ in the application.
  3. 3. Start creating a new project by clicking on the “+” sign at the top.
  4. 4. Then, enter the project’s name and select the device you will use in the project, e.g.  „ESP8266“. Click „Create“.
  5. 5. After creating a project, the application will automatically send AuthToken (authorization token) to your e-mail adress (the one you have entered while registering). Each new project will be given a new token which must be included in the program code later on. Token serves as a sort of authorization identifier when connecting devices (e.g. Dasduino Connect) to smartphones.
  6. 6. Install the Blynk library which will simplify writing of the code. If you are not sure how to install the library, check it on the link.
  7. 7. You are now ready to start with your project. You can select a template from the “Blynk Sketch Code Builder“. On the left, you have the ability to adjust the type of microcontroller, types of connection, adding tokens and of course, selecting a template for the desired project. A template will automatically be printed, based on you parameters, and you should simply copy it to Arduino IDE and continue programming as usual.

TURNING THE LED ON OR OFF

In the first example, we will use the application to turn the LED diode connected to Dasduino Connect on or off.

ADJUSTING THE APPLICATION

Start creating a new project by clicking on the upper right “+” sign. Enter the name and select ESP8266 as a board. Click “Create”.

Once we have created a new project, the application will send the mentioned token to your e-mail listed while registering. For this project, only one button is necessary to turn the LED on or off. Click the “+” sign again and select “Button” from the Widget Box. The button should appear on the screen.

Click the button in order to adjust settings. In the settings you can rename the button as you wish, but let’s name it “Led”. Under Output, change “PIN” to “GP13”, so we connect the button to pin 13 of the Dasduino Connect and using it we turn the diode on or off. “Button” has two modes, push and switch mode. The button will be ON in the push mode, only when being pushed, but when we release it, the state changes to OFF. In order to simplify this, change the mode to “Switch”, so that we can change the button mode with only one push.

 

 

CONNECTING

Once we have adjusted the application, connect the LED, resistor and Dasduino as shown in the picture.

PROGRAM CODE

All we have left to do is program Dasduino Connect. The Blynk application, along with its library, has access to all pins of the chosen microcontroller, so that we do not need any complicated code for this example. It is only necessary to upload the basic code which we also have in the templates. If you are not sure which parameters we need to set in order to program Dasduino Connect, we will remind you in our previous tutorial. Make sure not to forget to include authorization token to the code and enter your WiFi network data.

#define BLYNK_PRINT Serial
#include "ESP8266WiFi.h"
#include "BlynkSimpleEsp8266.h"
char auth[] = "AuthToken";
char ssid[] = "NazivWiFiMreže";
char pass[] = "LozinkaWiFiMreže";
void setup(){
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
}
void loop(){
  Blynk.run();
}

In the following example, see how, using smartphone, you can collect data about temperature and humidity from the DHT11 sensor using Blynk application and Dasduino Connect. (LINK)