Will be show how to use M5Stack Core2 with Bolt IoT Cloud Platform.
Things used in this project
Hardware components | ||||
M5Stack Core2 ESP32 IoT Development Kit | × | 1 | ||
Bolt IoT Bolt WiFi Module | × | 1 | ||
Arduino 101 | × | 1 | ||
Software apps and online services | ||||
Bolt IoT Bolt Cloud | ||||
Arduino IDE |
Story
In this tutorial, will show how to interface the M5Stack Core2 with the Bolt IoT Cloud platform and how to transfer the data between Bolt IoT Could.
Project Flow:
Bolt IoT platform gives you the capability to control your devices and collect data from IoT devices safely and securely no matter where you are.
Get actionable insights by deploying machine learning algorithms with just a few clicks to detect anomalies as well as predict sensor values.
Bolt IoT has specific hardware which allows you to directly from your sensors to theBolt Cloud platform.
If you have your own Controller, but you want to use the Bolt IoT Cloud, here is the solution. In my case, I have my ESP32 Controller which is from M5Stack.
I have used UART Protocol to communicate and transfer my M5Stack data to Bolt IoT Hardware and then the Bolt hardware will send the data to Bolt Cloud.
M5Stack Core 2 is an ESP32-based microcontroller that has an inbuilt TFT Display, Speaker, Microphone, and some additional sensors so that we can use this Core2 for a wide range of applications. We can’t directly connect your own hardware to Bolt IoT, we are going to use Bolt IoT to communicate with the Bolt Cloud platform.
M5Sack Core 2 has three IO ports.
- GPIO Port
- I2C Port
- UART Port
we are going to use UART communication between M5Stack and Bolt IoT. Bolt IoT out also has a UART Port by this Port M5Stack will communicate with Bolt Cloud.
Arduino Programming:
For M5Stack Programming First, open the Arduino IDE and paste the following URL in the properties to get the M5Stack boards packages.
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
Once you pasted the URL open up the Boards Manager and search for M5Stack, you will get the below option. Then download and install the Boards library.
Now we are ready to do some programming, use the below code and try to upload with the M5Stack Core2.
#include <M5Core2.h>
static const uint32_t Baud = 9600;
HardwareSerial mySerial(2);
void setup()
{
M5.begin();
Serial.begin(115200);
mySerial.begin(Baud, SERIAL_8N1, 13, 14);
Serial.setTimeout(100);
}
String data;
uint8_t dataRead = 0;
void loop()
{
if (mySerial.available() > 0) {
delay(50);
String readData = "";
Serial.print("Command from Bolt: ");
while (mySerial.available() > 0 ) {
readData = readData + (char)mySerial.read();
}
Serial.println(readData);
if (readData.indexOf("RD") != -1) {
String data = sensor_data_to_push();
mySerial.print(data);
Serial.print("Data sent to Bolt: ");
Serial.println(data);
}
}
}
String sensor_data_to_push() {
String data;
float hum = random(100);
float temp = random(100);
data = String(temp) + "," + String(hum);
return data;
}
Select the Boards and Port in your Arduino IDE. Make sure your selection.
Then hit upload the code to M5Stack Core2. After the code upload completion, Connect the Bolt IoT kit with the M5Stack as per the connection diagram.
Below the schematic of M5Stack Core 2 and the green marking shows the UART port of the Core2, Connect Core2 TX to Bolt’s RX and Core2 RX to Bolt’s TX and VCC and GND directly to the Core2.
Bolt Cloud Setup:
Open up the Bolt cloud platform https://cloud.boltiot.com/
and select Add Product icon.
Create a new project.
Enter the details and select communication as UART.
Then click configure Icon and open up the Hardware details and configure as shown below.
Next, select the Code tab and enter the below js code.
setChartTitle('M5Stack Core2 with Bolt IoT')
var lineGraph1 = new boltGraph();
lineGraph1.setChartType("lineGraph");
lineGraph1.setAxisName('Time','Temp C');
lineGraph1.plotChart('time_stamp','temp');
var lineGraph2 = new boltGraph();
lineGraph2.setChartType("lineGraph");
lineGraph2.setAxisName('Time','Pressure Pa');
lineGraph2.plotChart('time_stamp','hum');
Cloud Deployment:
Connect your Bolt Kit with your credentials, then it will show up in the hardware section of the Cloud.
Link the product which we created in the last section. Once you link with your device, open up the cloud portal.
Final Output:
The best part is, you can view this data on your Mobile.
Open your mobile application view for the data.
Schematics
Hardware Connections
Code
GitHub Repo
pradeeplogu0 / M5-with-Bolt-Cloud
Latest commit to the master branch on 6-5-2022 Download as zip