IoT Platform x MIT AI2
Last updated
Last updated
IoT use cases are usually paired with a mobile application, by using MIT AI2, we can easily build an app for using IoT use cases.
MakerCloud has an official extension for using their platform with MIT AI2, please refer to their official documentation for details.
MakerCloud Official Documentation
Download a 3rd party MQTT extension for AI2.
Download the file from Download section.
Extract the aix file.
Go to MIT AI2, open a new project.
Find “Import Extension” from the left hand side menu.
Upload the aix file.
Drag the component into the screen.
In the properties of the MQTT component, enter the MQTT host in the Broker field.
Fill in other parameters according to the requirements of your IoT platform.
For ThingSpeak, fill in mqtt.thingspeak.com for broker and your ThingSpeak clientID for clientID.
Enter UserName and UserPassword if required, for ThingSpeak, enter the user name and password here.
Build the following program to test if you can connect to the IoT platform.
After pressing the button, the text should change to “true”, this indicates a connection to the IoT platform has been established.
Try sending a random number to the platform.
Enter the topic name, ThingSpeak is used as the example in this article.
Attach a string element to the message parameter.
For ThingSpeak, join the 2 strings containing the field number and the data.
Try the program, you should be able to see the data on ThingSpeak.
We can also subscribe and listen to MQTT data.
Build the following program to read MQTT data.
Use the following block to trigger an action after a message is received.
Try the program, you should be able to see the data on ThingSpeak and on your app.
The above program is available to download.