This is a tutorial on how to connect the SIM7000G module in TagoIO through the MQTT protocol. To start the project it is necessary to have an account in TagoIO and configure APN via terminal according to the commands below:
AT+CNACT=1,"apnname"
AT+CPSI?
AT+CNACT?
2. TagoIOIn the initial TagoIO console, select Devices in the left navigation column
Inside the device screen, click + Add Device in the upper right corner.
On the device creation screen, select MQTT
Create a name for your device and click Create Device
Click Reveal Token and copy the token to your notepad. Then click Close.
Select the Dashboards option on the left navigation bar and click + Add Dashboard in the upper right corner.
Enter a name for your dashboard and click Save.
On your dashboard screen click + Add widget
Select the widget Line
Give a name to the widget, select it and in the Variable option type temperature. Click Save
Please note that at this time no data will be available because the device has not yet sent any information.
Open Teraterm with the following settings:
Port "XX" (Select AT COM Port)
Speed: 9600
Data: 8 bit
Parity: none
Stop bits: 1 bit Flow control: none
Enter the commands as below to configure the device:
AT+SMCONF="url","mqtt.tago.io",1883
AT+SMCONF="USERNAME","user" // keeps "user"
AT+SMCONF="PASSWORD","your-device-token" // replace with your device token
AT+SMCONF="TOPIC","tago/data/post"
AT+SMCONF="KEEPTIME",60
AT+SMCONN
Use the following commands to post messages:
AT+SMPUB="tago/data/post",39,1,1 // 39 means the number of chars in your message
> {"variable": "temperature","value": 20}
Notice that your dashboard starts displaying the values according to the messages sent:
Practice with other values and see the different values that appear on your dashboard.
AT+SMPUB="tago/data/post",39,1,1
>{"variable": "temperature","value": 40}
AT+SMPUB="tago/data/post",39,1,1
>{"variable": "temperature","value": 60}
Congratulations! You finished your first application with SIM7000G and TagoIO!
Comments