How To Configure WisBlock Integration to Blynk

KHM-034-00.png

With RAKwireless' wide range of sensors and modules, you can imagine an infinite number of project possibilities, one of which could be integrating your project into a web or mobile dashboard for monitoring and control.

And this is where the Blynk platform comes in handy: you can create your own IoT dashboard with little to no experience in web development.

KHM-034-01.png

You can edit the widget by clicking the Edit button.

This platform offers two (2) dashboards for your project:

  • Mobile
  • Web

To help you start, you will need the following devices and follow the steps outlined below:

KHM-034-02.png

Create a Blynk account

The first step is to create a Blynk account. Enter your email address and check your email for confirmation. Then you can create your password.

KHM-034-03.png

Follow the Quickstart Guide by Blynk

KHM-034-04.png

In selecting the hardware, choose ESP32 since RAK11200 is based on the Espressif ESP32-WROVER.

KHM-034-05.png

Choose your preferred IDE. In this example, you will be using the official Arduino IDE.

KHM-034-06.png

Install the Blynk library for Arduino.

KHM-034-07.png

You can now enter your WiFi credentials and then copy the code.

KHM-034-08.png

đź“ť NOTE: You will be unable to connect if you do not enter the SSID or password and copy the code.

Before uploading your code, make sure that you are connected to the Blynk Cloud Server.

KHM-034-09.png

Ensure that the BOOT0 and GND pins are shorted before uploading the code to the RAK11200. After a successful upload, you must press the reset button once more.

KHM-034-010.png

RAK11200 requires the BOOT0 pin to be configured properly before uploading. If not done properly, uploading the source code to RAK11200 will fail. See the RAK11200 Quick Start Guide for more information.

Upon successful upload you can open your serial monitor and see this message:

KHM-034-011.png

In the Blynk Console, you can also see the status of your device.

KHM-034-012.png

Adding sensors or other modules to the platform

Attach your RAK12003 to the Wisblock Base Board.

KHM-034-013.png

The complete code is available on the GitHub repository.

Add functions for the RAK12003 and mixed it with the Blynk-generated code earlier.

  • tempSetup() function for setting up the RAK12003
void tempSetup() {
  TwoWire &wirePort = Wire;
  MLX90632::status returnError;
  Serial.println("MLX90632 Read Example");

  Wire.begin(); //I2C init

  if (RAK_TempSensor.begin(MLX90632_ADDRESS, wirePort, returnError) == true) //MLX90632 init
  {
    Serial.println("MLX90632 Init Succeed");
  }
  else
  {
    Serial.println("MLX90632 Init Failed");
  }
}
  • objectTemp() and internalTemp() functions return
double objectTemp() {
  double object_temp = RAK_TempSensor.getObjectTempF(); //Get the temperature of the object we're looking at in Farenheit
  return object_temp;
}

double internalTemp() {
  double sensor_temp = RAK_TempSensor.getSensorTemp(); //Get the temperature of the sensor in Celcius
  return sensor_temp;
}
  • Attaching the objectTemp() value to the V5 Virtual pin
void myTimerEvent()
{
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V2, millis() / 1000);
  Blynk.virtualWrite(V5, objectTemp()); // this is from RAK12003
}

Virtual pins are used to send sensors’ data to the Blynk Platform. The Wisblock RAK12003 Infrared Temperature Sensor is used in this example. However, you could use any sensor of your choice; simply add the variable where your sensor data is stored to the Blynk.virtualWrite function's parameter.

Double-check the credentials:

  • Blynk Authentication Token - this is automatically generated on the template. You can also check My Devices > Your Device Name > Device Info.

KHM-034-014.png

  • WiFi SSID and Password

Then you can proceed with uploading your code. Before uploading, remember to short the BOOT0 and GND pins and press the reset button, and then press the reset button again after a successful upload to run your newly uploaded code.

KHM-034-015.png

To integrate sensor data, go to the Datastreams settings in your console and create a new data stream.

KHM-034-016.png

You can use virtual pins to attach the sensor’s data.

KHM-034-017.png

The following code will write the data into the V5 and can be later used in your dashboard.

Blynk.virtualWrite(V5, sensor_data);

Create dashboard widgets from your datastream

A dashboard widget can be anything from a label to a chart. See the list of widgets at Blynk Documentation.

To create a web dashboard widget, go to web dashboard and click edit. Then drag and drop your desired widget.

KHM-034-018.gif

You can edit the widget by clicking the following icon:

KHM-034-019.png

Set your desired settings for your widget, and don't forget to include the Datastream as well.

KHM-034-020.png

Final Thoughts

The Blynk platform greatly enhances the interactivity of a project without the need to learn or perform actual web and mobile development. This is really a great tool to create awesome projects such as:

  • Weather Monitoring Station
  • Greenhouse Monitoring and Control
  • Hydroponics and Aquaponics Projects

This platform is available for free. Although an upgraded version is available for larger organizations and map integration features, the free version is more than adequate for the projects mentioned above.

Updated