Hey, what's up, Guys! Akarsh here from CETech.
Today we are going to have a look at two small but very useful modules based on ESP Technology. The modules that we are talking about are the M5Stack Core2 module and the Bolt IoT Wifi module. We will have a little insight into both the modules and after that we will interface the Bolt IoT Wifi module to the M5Stack Core2 module and then, connect the circuit to the Bolt IoT Cloud to access the data sent by the modules over the cloud.
M5Stack Core 2 module is like the upgraded version of the M5Stick C module. If you have checked our last few projects you should have already known about the M5Stick C module. You can check those projects from here and here. Bolt IoT Wifi module is a module that is designed in such a manner that you can transfer data from this module directly to the cloud and today we are going to check how it works.
So let's jump straight into it.
Things used in this Project:-
M5Stack Core2 ESP32 IoT Development Kit
Bolt IoT Bolt WiFi Module
Bolt IoT Bolt Cloud
Arduino IDE
Get PCBs for Your Projects Manufactured
You must check out PCBWAY for ordering PCBs online for cheap!
You get 10 good-quality PCBs manufactured and shipped to your doorstep for cheap. You will also get a discount on shipping on your first order. Upload your Gerber files onto PCBWAY to get them manufactured with good quality and quick turnaround time. PCBWay now could provide a complete product solution, from design to enclosure production. Check out their online Gerber viewer function. With reward points, you can get free stuff from their gift shop.
About M5Stack Core2 Module
M5Core2 is the second generation core device in the M5Stack development kit series, which further enhances the functions of the original generation of cores. The MCU is an ESP32 model D0WDQ6-V3 and has dual-core Xtensa® 32-bit 240Mhz LX6 processors that can be controlled separately. Wi-Fi is supported as standard and it includes an onboard 16MB Flash and 8MB PSRAM, USB TYPE-C interface for charging, downloading of programs, and serial communication, a 2.0-inch integrated capacitive touch screen, and a built-in vibration motor.
M5Core2 also features a built-in RTC module that can provide accurate timing. The power supply is managed by an AXP192 power management chip, which can effectively control the power consumption of the base and the built-in green LED power indicator helps to notify the user of the battery level. The battery capacity has been upgraded to 390mAh, which can power the core for much longer than the previous model. The M5Core2 retains the TF-card(microSD) slot and speakers. However, in order to ensure higher quality sound output, the I2S digital audio interface power amplifier chip is used to effectively prevent signal distortion. There are independent power and reset buttons on the left side and bottom of the base.
The 3 icons on the front of the screen are capacitive buttons that are programmable. There is a small expansion board on the back of the base with a 6-axis IMU sensor and microphone.
Operations:
Power on: One-click the power button on the left
Power off: Long press the left power button for 6 seconds
Reset: Click the RST button on the bottom side
About Bolt IoT Platform and Wifi Module
Bolt is a great IoT Platform using which you can perform a number of IoT Applications very easily. The 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. You can 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 transfer data from your sensors to the Bolt Cloud platform.
The Bolt IoT Platform provides an easy interface to quickly connect your hardware to the cloud over GPIO, UART, and ADC. Also, connects to MODBUS, I2C, and SPI with an additional converter. Bolt is equipped with industry-standard protocols to ensure secure and fast communication of your device data with the cloud. Bolt has built-in safeguards to secure all user data from unwanted third-party intrusions and hacks. Bolt provides a quick alert system providing valuable information sent directly to your phone or Email. You can config the contact details and set the threshold and using Bolt, You can scale from prototype to millions of devices in just a few weeks' time.
So this was about the Bolt IoT Cloud Platform. Another important part of the Bolt IoT Platform is the Wifi module. It is an ESP32-based module that you can use to transfer data directly to the cloud. The module has an analog pin to which you can different types of sensors to collect data. There are 5 Digital I/O pins to which you can connect Digital Sensors. The module is very useful and can be programmed easily with the help of Arduino IDE.
Hardware and Software Setup
Now we have some knowledge about the modules and the IoT Platform. We will make a project to see how things work. So firstly, we will make the circuit for the project. To complete the circuit setup, you need to follow the steps given below:-
Connect the Rx pin of the Core2 module to that of the Tx pin of the Bolt module and Connect the Tx pin of the Core2 module to the Rx pin of the Bolt module.
Connect the 5V pin and GND pin of the Bolt module to the Vcc and GND pins of the Core2 module.
This will complete the Circuit setup. Now let's move on to the Software Setup and uploading the code. To complete the Software Setup, you need to follow the below steps:-
Open Arduino IDE and move on to the Files option. Inside files move to Preferences and open that.
Click on additional Boards Manager URLs and paste the following URL there. https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
Now head over to Tools -> Board -> Boards Manager. Search for M5Stack there and Install the boards. Restart the IDE.
#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;
}
Once the installation is done, you can connect your Core2 module to the Computer. You can access the code for the project from here. Copy the code and paste that into your Arduino IDE.
Select the Correct Board and COM Port and then upload the code.
With this, the Hardware and Software Setup for the project is done. Now you need to set up the Bolt IoT Cloud to collect data sent by this circuit.
Bolt Cloud Platform Setup
As you have completed the Setup on the circuit end, now you need to set up The Bolt Platform to receive and log data sent by your circuit. To Complete the Setup You need to follow the steps given below:-
Open the Bolt cloud platform here and select the Add Product icon.
Click on "Create a new project".
Enter the details and select communication as UART.
Click configure Icon and open up the Hardware details and set the details as given below:-
CSV Values to be sent = 2
Baud Rate = 9600
How often to send data = 5 Minutes
Pin CSV0 = temp
Pin CSV1 = hum
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');
And with this, the setup of the Bolt Cloud is also done. Now you are ready to test the device.
Testing the Setup
As we are done with all the setup-related things, Now it's time to check the operations of the Setup. To receive the data from the Circuit to the Platform, you need to link your setup with the cloud setup you have made. For that, follow the below steps:-
Connect your Bolt Kit with your credentials, then it will show up in the hardware section of the Cloud.
Link the product which you created in the last step. Once you are linked with your device, open up the cloud portal.
Once you open the Cloud Platform, you will see your project data there. There you will see details like how many data points are received and there will also be a graph that is created on the basis of your data received and you can check and create useful insights from that visual representation. Another interesting thing about this Platform is that you can access it from your mobile phone also. You just need to install the Bolt IoT Application from Google Play Store and log in to that application. using your account credentials and then you will be able to access your project dashboard on your mobile phone.
So this brings us to the end of this project. Hope you liked this project. Like this, you can create a number of useful IoT projects very easily and access them from anywhere. I will be back with some more fun projects very soon until then Goodbye!!