This step by step guide will help you set up your first working Sodaq ONE LoRaWAN experiment. It will show how to send data from the Sodaq ONE to the AllThingsTalk cloud, using the onboard pushbutton.
If you are using the AllThingsTalk Product kit, the Arduino LoRaWAN SDK and PDK are already installed on your Sodaq ONE.
To install the Arduino LoRaWAN PDK, go to Sketch > Include library > Add .ZIP library in your Arduino IDE. Select the arduino-lorawan-pdk-master .zip file you just downloaded and click open.
Alternatively, unzip the file and copy the contents to your Arduino library folder.
First we need to create our device.
If you just created a new account, you will have a default ground called playground. You can use this ground to create your device or create a new ground if you want.
pushbutton-containers
example sketchpushbutton-binary-payload
example sketchpush-button-payload-definition.json
in the textarea. You find this file in the examples folder of the arduino-lorawan-pdkNext we need to add these keys of our device (dev addr, apps key and nwks key) to our example sketch, so it knows where to send its data. You can find them under SETTINGS > Connectivity of the device you just created.
keys.h
file as shown below1 | uint8_t DEV_ADDR[4] = {0x08, 0x1B, 0x3A, 0x74}; |
We are now ready to upload and run our sketch!
Simply hit the upload icon in the Arduino IDE. This will save the sketch, compile it and upload it to your Arduino.
After uploading, you might need to flip the power switch on the SODAQ Mbili OFF and back ON to make sure the Mbili reboots and starts up our sketch.
Try press the Button. This should send its state to AllThingsTalk and update the Binary Sensor accordingly.
Alternatively, you can also open the Tools > Serial monitor of the Arduino IDE. This can be very useful when debugging your own sketches.
- Make sure you select the correct COM port to listen (under Tools > Port )
- When the monitor is open, make sure the Baud rate is set to 57600
pushbutton-payload-builder
example in the File > Examples > arduino-lorawan-pdk folderpushbutton-payload-definition.json
fileAs a next step, please try the Track & Trace demo
The LoraWAN™ based Track-and-Trace device has been designed to run for a long period on a battery.
The device has an onboard charging circuit for a LiPo battery and solar panel, so besides powering your device with the USB cable, you can also connect a battery and even a solar panel.
Solder the included PIN headers onto the board and connect your LiPo Battery and/or Solar Panel following the PIN definitions
The picture below shows how the battery can be connected:
The image below shows the jumper (or small wire to connect both pins) and the battery.
Instead of using the jumper for the EXTERNAL_SWITCH, you can accomplish the same by setting
ENABLE_PIN_IO
toHIGH
in your sketch.
Optional, the included Solar panel can be connected between the pins
For more information on using a battery, please visit http://support.sodaq.com/sodaq-one/battery/.