Introduction: Connected Plant With Sigfox, Akeru & Thethings.iO
Plants take an important paper on our lifes, producing the oxygen that we breathe. In our house we use plants for aesthetic reasons too. But we don't give the importance that they deserve, usually just because we don't think about it or we don't have time.
In this Instructables we're going to take care of that by sending important environment data (Moisture of the plant, temperature and light values) to thethings.iO with Sigfox. Then, all the data will be available for us in our thethings.iO dashboard.
Step 1: Hardware Requirements (+ Thethings.iO)
For accomplishing this project, we're gonna need:
- An Akeru board (It has the same pinout as an Arduino Uno + Sigfox modem).
- A Micro-usb cable (To connect the akeru with the computer).
- A Light Diode Resistor.
- An Lm35dz Temperature Sensor.
- A 10 kOhm Resistor.
- A Moisture Sensor (In our case from Seedstudio).
- A bunch of 0.1" male-to-male cables (For connecting our Akeru with the sensors).
Now, make sure you have an account at thethings.iO. If not, register quickly by clicking here.
Step 2: Sensor Connections
This is the resulting connections diagram: (An Arduino uno is displayed instead of an Akeru, because the Akeru board wasn't available on Fritzing).
- The Light Diode Resitor is connected to 5v, GND (via a 10 KOhm resistor in series) and the A0 pin.
- The Temperature Sensor is connected to 5v, GND and the A1 pin.
- The Moisture Sensor is connected to 3.3v, GND and the A2 pin.
Step 3: Arduino Code
Before opening the arduino IDE, download the Akeru library for arduino, located here: Akeru Arduino Library.
Place the Library in your Arduino Libraries folder, usually at:
- Linux: /Home/your-username/Documents/arduino/libraries
- Mac: /Users/your-username/Documents/Arduino/libraries
- Windows: \My Documents\Arduino\libraries
Now you're able to send data to Sigfox!
After this you'll need to create the code for measuring and sending the sensor data: Feel free to download our already done example from GitHub: Akeru Arduino code.
Step 4: Connecting Sigfox to Thethings.iO
Consider reading our previous post about on thethings.iO Blog connect Sigfox to the IoT platform thethings.iO before step 4-5. It contains a video showing those steps.
In order to receive the data from Sigfox, you’ll need to redirect all the messages using a callback from our Sigfox profile. You’ll need to configure our thethings.io profile for this:
- Navigate to Things Manager
- Create a new IoT product: Insert your product name. Then choose a name for each resource you’re going to use. Finally choose Sigfox inside Format.
- Click on Details on the product you’ve just created. then copy the clipboard the Subscription URL.
- In order to have resources, we need to have a thing token.
- Click on get activation codes and select one code. Now you’ll be able to create widgets.
- Type: DATA UP-LINK.
- Channel: URL.
- Url pattern: Paste your previous subscription URL from thethings.iO.
- Use HTTP method: POST and click Ok.
Step 5: Parsing Data From Sigfox
Now go to thethings.iO IoT platform and you will need to specify how to parse the data that Sigfox forwards to thethings.iO, in order to display the correct values:
- Go to Cloud Code
- Navigate to Functions and Edit the parser with the name that you gave before.
- Parse your resources by splitting the string that Sigfox sends (An hexadecimal number containing all the sensor values, one after the other). In the preview params, copy the data you send from Sigfox and change “quote” to “data” to prove your function.
Download our code from: Akeru Cloud Code.
Step 6: Creating the Dashboard Widgets
It’s time to create a dashboard with thethings.iO to show all the values of your sensors!
- Click on Add widget.
- Introduce a name for the widget.
- Select Thing Resource.
- Select Sigfox.
- Select your thing Token.
- Select the resource that you want to show.
- Select how you want to show your resource (Lines, bars, log…).
Repeat this process until you finish your awesome IoT Dashboard!
We have a be nice policy.
Please be positive and constructive.