This workshop will guide you through working with The Things Uno to send sensor data over The Things Stack to an application.
- The Things Uno
- Micro-USB cable
- Sensors, jumpers and optional breadboard as provided, ex: a Potentiometer and connecting wires.
- Computer running Windows 7 or higher, Mac OS X or Linux
- Wifi for your laptop.
- Gateway coverage to The Things Stack instance that you are sending data to.
Head over to the documentation page on The Things Uno and setup the IDE.
To follow along with this workshop, you'll need an account with an instance of The Things Stack. Check the page on setting up an account with The Things Stack Community Edition.
For this workshop there are two actions with the Arduino IDE that will be used the most.
The Serial Monitor is used to read serial data from the Arduino. It's recommended to keep this window open in the background.
To enable this go to Tools
> Serial Monitor
. Set the baud-rate to 9600
if not set already.
Secondly, to upload your code to the Arduino, use the options under Sketch
. For this guide, since you're using a USB connection, always upload via the Upload
option (and not Upload using programmer
).
- Connect the USB cable to the Arduino IDE and select the port as explained the preparatory step.
- Connect the Pot with the
- Open the PotMeter.ino sketch in the Arduino IDE.
- Upload it.
- Play around with the pot and note the values printed on the screen.
- Choose a lower threshold and and upper threshold for your specific pot. These values will be used in later steps.
- Connect the USB cable to the Arduino IDE and select the port as explained the preparatory step.
- Open the DeviceInfo.ino sketch in the Arduino IDE and upload it.
- Copy the screen the
DevEUI
andJoinEUI
values to a separate file. - Register this device on The Things Stack Community Edition.
- For the App Key, provide an arbitrary value or to generate one from the Console.
openssl rand -hex 16
- Connect the USB cable to the Arduino IDE and select the port as explained the preparatory step.
- Open the Join.ino sketch in the Arduino IDE.
- Replace the following fields in the sketch
appEUI
: Value you noted earlierappKey
: The same random value used for theApp Key
field while registering the device.freqPlan
: Replace the wordREPLACE_ME
with the correct frequency plan based on your region.
- Go to
Sketch
->Verify/Compile
. If correct, upload the sketch. - Check the serial monitor for the device to Join the network.
- Connect the USB cable to the Arduino IDE and select the port as explained the preparatory step.
- Open the Traffic sketch in the Arduino IDE.
- Set the
SENSOR_THRESHOLD_LOW
andSENSOR_THRESHOLD_HIGH
values based on your own sensor value that were noted in step 1. - Go to
Sketch
->Verify/Compile
. If correct, upload the sketch. - Head over to the application tab of The Things Stack Community Edition and check your data payloads.
- Add the Payload formatter to translate the array of bytes to a human-readable format. Link to Payload Formatter