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.
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:
- RAK5005-O WisBlock Base Board
- RAK11200 ESP32 Module for WiFi
- RAK12003 WisBlock IR Thermometer Module
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.
Follow the Quickstart Guide by Blynk
In selecting the hardware, choose ESP32 since RAK11200 is based on the Espressif ESP32-WROVER.
Choose your preferred IDE. In this example, you will be using the official Arduino IDE.
Install the Blynk library for Arduino.
You can now enter your WiFi credentials and then copy the code.
đź“ť 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.
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.
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:
In the Blynk Console, you can also see the status of your device.
Adding sensors or other modules to the platform
Attach your RAK12003 to the Wisblock Base Board.
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()
andinternalTemp()
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.
- 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.
To integrate sensor data, go to the Datastreams settings in your console and create a new data stream.
You can use virtual pins to attach the sensor’s data.
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.
You can edit the widget by clicking the following icon:
Set your desired settings for your widget, and don't forget to include the Datastream as well.
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