In Part 5 of the M5GO IOT Starter Kit series I look at using the IOT Starter Kit with M5Stack EZdata2 IOT server.
Part 4 is available here: https://www.hackster.io/AJB2K3/m5go-iot-starter-kit-part-4-all-about-the-base-4197a7
Part 3 is available here: https://www.hackster.io/AJB2K3/m5go-iot-starter-kit-using-units-part-2-3613fa
Part 2 is available here: https://www.hackster.io/AJB2K3/m5go-iot-starter-kit-using-units-722343
Part 1 is available here: https://www.hackster.io/AJB2K3/m5go-iot-starter-kit-part-1-8ef6ae
The EZData2 Server is an IOT service for handling small amounts of data like a reduced version of Amazon AWS or Microsoft Azure services. The EZData2 server receives data sent to it from M5Stack controllers and gives very basic display facilities for the data. Not only does EZData2 receive data from a device, it also makes this data available to other permitted devices.
In order to get started with EZData2 we first need a data source. If you have read all the parts so far you will know where to find the data source. If you haven't worked it out yet, the data source I will be using will come from the ENV sensor found it the kit. For more information on the ENV Unit you can check out part 2 of the series found here: https://www.hackster.io/AJB2K3/m5go-iot-starter-kit-using-units-722343
First step is to build the basic code structure as shown below:
Now that the basic code is ready, we can proceed to modify it to work with the EZData2 server. To communicate with the EZData2 server we make use of the following blocks:
In order to start communicating with the EZData2 server, we first have to initialise a connection to the server using one of the following Init blocks.
The first Init block uses the M5Stack controllers ID as the device token and a user defined Key.
The second Init block is used for specifying a user selectable device token and key.
The third block is used for defining a dataset to be created using the device key specified in the first two blocks.
The last block is for just defining a device token without
If we visit the EZData2 server we can see that the M5GO is detected but not yet sending any data.
In order to send data to EZData2 we alter the code as follows:
This creates a map that consists of key and value pairs. When EZData2 is opened again the data still may not be visible. If it's not, click on the reload button and or the Icon on the left for the controller and the data received by EZData2 will be shown.
EZdata2's manager does not automatically load the data from the EZData2 server as it's just a simple visualisation tool so you will need to keep hitting the refresh button to see the latest received data.
When data is discovered six actions are made available to each stream of data.
From left to right, the actions are:
The puzzle shaped button creates a custom block in UIFlow2 to receive data from the EZData Server and looks like this:
The square with a pencil action allows you to edit the received values in the following panel:
The bin shaped icon deletes the Key.The next icon with the vertical line brings up the history of data received by the EZdata2 server and looks like this:
The arrow shaped icon allows you to share the data sources by bringing up a panel with generated links to the uploaded data source.
And the big "Add to Dataset" button allows you to add the data to the dataset manager.
Dataset Manager.If we click on the Dataset Manager tab after hitting the Add to Dataset button there will be data shown but if you didn't hit the button, you can click on the add to button in the left panel to add our data to the dataset.
Once data is added to the data set manager we have the actions to create the custom block again (see above) or delete the data from the manager.
Above the dataset we can find some more functions:
The first item is a dropdown list containing the datasets we have available. If there are no other datasets then only one item will be displayed.
The "+" Symbol is used to create a new dataset.
The next Icon is used to change the name of the dataset.
The Bin icon is used to erase datasets.
The circle icon is used to reload the available datasets in the EZData2 server.
There is another Icon at the top of the screen that I haven't covered.
This icon access the Ezdata2 server from a command line interface allowing deeper access to the data.
This is just the basics on using EZData2 for basic IOT services. I will return to EZData2 and the accompanying mobile app but its time for a little more electronics.
Contact Me.Due to Issues with code and researching functions, this part has taken a lot longer than the other parts. If you find this useful then there is more crossover guides coming. You can drop a Message in Hackster.io message box below of find me via the following links:
https://twitter.com/Cpt_J_Purcell
https://bsky.app/profile/jamespurcell.bsky.social
On Discord (if I ever work out how to share the profile!)https://mastodonapp.uk/@AdamBryant
And on the M5Stack Facebook group and community forum.
If you have some spare change you can now buy me a tea @ https://bmc.link/ajb2k35
Comments