This tutorial will help you set up your first working LoRa™ experiment. Simply follow these steps as you go. We will use the ATT_LoRa_IOT/examples/demo/demo.ino
of the AllThingsTalk LoRa™ client as our first example.
How to set up the Arduino IDE and SODAQ Mbili
To make sure your SODAQ Mbili runs as intended, connect your board and run the test Hello World sketch at the bottom of the SODAQ Mbili Getting Started guide. You find the serial monitor under Tools > Serial Monitor.
How to install Arduino SODAQ Mbili libraries
Our first program will consist of a single push button. We will use it as a toggle. In the AllThingsTalk Developer Cloud, this button will be represented by a LED light which turns on and off.
Depending on coverage, you might also need a base station
For more information on connector pin numbers, please check this Mbili sockets page.
Check here for more info on how to create and connect your LoRa device.
Now it’s time to upload the sketch to our device
demo.ino
sketch from the ATT_LoRa_IOT/examples/demo/
folder. This should open the demo.ino
as well as an empty keys.h
file.You can also open a sketch directly from your Arduino IDE as shown in the image below.
Get your device keys from AllThingsTalk
Add these keys to the keys.h
file of your sketch. It should now look similar to this
1 | #ifndef KEYS_h |
These keys however are unique for your device, meaning the
keys.h
file will be the same for all projects. You can copy it to your harddisk once and copy it from there to your project folder each time.
After uploading, you might need to flip the power switch on the SODAQ Mbili OFF and back ON.
We do this to make sure the Mbili reboots and starts up our sketch.
We are now ready to try out our demo! After the Mbili restarted, push the button and watch the graphical LED change in the platform.
If you don’t see your BINARY button asset, refresh your browser!
Apart from the AllThingsTalk Developer Cloud, we can also monitor traffic from the Arduino IDE using the serial monitor.