I actually received this board before the New Year. Due to some special reasons this year, I haven't updated it. I'm sorry, so today I took advantage of the holiday to write another experience report. This test is still based on the previous experience, this time it was changed to Alibaba Cloud's cloud test.
The baseboard is the same as last time. The connection is still directly connected to the serial port 1 of the EC-01F.
This is the schematic diagram of the light sensor, which is a new sensor used this time. I will use the data it reads to make connections.
Take a quick look at the baseboard program and use the previously packaged one.
The previous method is still used for connecting to the cloud. New sensor code has been added.
Let’s take a look at the configuration of Alibaba Cloud first.
First, you need to register on the Alibaba Cloud platform, then enter and select the Internet of Things platform. It is currently free to use during the testing phase.
After entering, go to the public instance and create our product.
You can find some public categories. I chose the light intensity sensor under the field of smart life. You can actually check it yourself. This mainly determines the data structure uploaded later.
The next step is to add our devices, that is, the devices we want to connect to the Internet.
Functionally, we only have one illuminance value. Remember this mark, it is for the identification of the following data.
After the device is created, it is time to write the underlying code. Our illuminance value already has the results of the previous test.
You can also view our historical data. Next, let me introduce the changes to our baseboard program.
The data in the red boxes are what we want to change.
This just needs to be configured according to the cloud platform.
Next, add our BH1750 sensor code to the test function, concatenate the strings through sprintf, and upload it to the MQTT server through the EC616S_MQTT_Pub function. In this way, the server can parse the data and the Alibaba Cloud platform can see the data.
There are several places that need to be modified here. This place needs to be defined larger because the character length we did not change before was shorter, and the character defined by the macro will be longer after the change.
After that, you can basically upload data to the Alibaba Cloud platform stably.
Through this test, I found that the connection to Alibaba Cloud is still very convenient, and splicing data through the MQTT protocol is also more intuitive.