Control Your IoT Cloud Kit via Blynk

Control Your IoT Cloud Kit via Blynk © CERN-OHL

Use the popular Blynk app to control and change the state of your IoT Cloud Kit through your smartphone.

  • 999 views
  • 1 comment
  • 3 respects

Components and supplies

Apps and online services

About this project

In this tutorial, we'll toy around the new IoT Cloud Kit from Arduino, featuring a MKR WiFi 1010, the Environmental Shield and the MKR Relay Proto Shield (among LEDs, breadboards, LEDs and wires).

We are going to control and monitor all data from the device using the popular bottom-up DIY monitoring app Blynk.

Install the App

After you create account / log in to the app, you'll be ask to input the hardware you are using.

Blynk has a huge user base and try to keep the list of hardware up-to-date. Nevertheless you won't find Arduino MKR1010 in the list, when you'll be ask to choose your hardware. Even if we are using Arduino MRK1010 you can select Arduino MKR1000 at this stage.

Give the project a name: I'll choose env-test. Since today I'm keeling an hacker, I'll shoose DarkTheme!

If you do everything all right you'll be sent an auth token to the mail address you specified when registered. Keep this code for you and don't share it to anyone!

Connect Your Blynk App to Your Board

In the Arduino IDE, open the Library Manager, and look for the Bkynk library.

Then open File>Examples>Blynk>Boards_wifi>Arduino_MKR 1010

Input your data (ssid, password, and token), then upload the code to the board.

In order to check if the connection between the Blynk servers and your board is actually working, you have to press the play button in the topo right corner and check if the little red dot disappeared from the lower right corner of the menu, as well as the notification area empty.

I'd like to test if the connection is really working by creating two pushbutton to control relay on D1 and D2.

If everything is working, by pressing I can hear the Relays ticking on the board.

Let's Add the Extra Data the Environmental Shield Is Providing

As you probaby noticed, when defining a PIN you can decide whether it being digital, analog or virtual. We'll import the Arduino_MKRENV Library and send our data as virtual pins.

#include <Arduino_MKRENV.h>
// Environmental Shield Data
float t;
float h;
float p;
float l;

Before the setup() function we are going to declare this function:

// This function sends Arduino's up time every second to Virtual Pin (5, 6, 7, 8).
// 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()
{
 float h = ENV.readHumidity();
 float t = ENV.readTemperature();
 float p = ENV.readPressure();
 float l = ENV.readLux();
 // 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);
 Blynk.virtualWrite(V7, p);
 Blynk.virtualWrite(V8, l);
}

In the setup(), we simply remind te board to update Blynk on a certain interval.

 // Setup a function to be called every second
 timer.setInterval(1000L, sendSensor);

Last but not least, we need to update our loop() function using timer.

void loop()
{
 Blynk.run();
 timer.run();
}

What If You Want to Automate a Process?

Blynk is really handy if you want to monitor data. If you want to be notified or create an action based on the behavior of the data, you'll have to create this heuristic on Blynk Cloud.

For example, if I want the relay to close when the light is growing over a certain threshold, I'll have to create an event.

Or Blynk app now is like this:

Happy Blynking with the IoT Cloud Kit!

Code

Arduino Cloud Kit to Bklynk
Check & monitor your Arduino MKR / Environmental Shield / Relay Proto Carrir using Blynk

Comments

Similar projects you might like

Make Your IoT Cloud Kit Send You Updates on Telegram

Project tutorial by Arduino_Genuino and officine-innesto

  • 1,985 views
  • 0 comments
  • 4 respects

IoT Cloud - Getting Started

by 5 developers

  • 32,011 views
  • 13 comments
  • 79 respects

Moisture Monitor - Orchid & Plant IoT w/ Blynk

Project showcase by Mitch K

  • 3,701 views
  • 0 comments
  • 11 respects

Control Arduino Using Smartphone via USB with Blynk App

Project tutorial by Smart Technology

  • 2,137 views
  • 1 comment
  • 3 respects

Control Arduino Uno Using ESP8266 WiFi Module and Blynk App

Project tutorial by Adithya TG

  • 19,554 views
  • 11 comments
  • 35 respects
Add projectSign up / Login