Plants take an important role in our lifes, producing the oxygen that we breathe. In our house we use plants for aesthetic reasons too. But often, we don't give them the importance that they deserve, usually just because we don't think about it or we don't have the time.
In this tutorial we're going to take care of that by sending important environment data (moisture of the soil, temperature and light values) to thethings.iO with Sigfox. Then, all the data will be available for us in our thethings.iO dashboard.
For acomplishing this project, we 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.
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.
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.
Consider reading our previous post about connecting Sigfox to the IoT platform thethings.iO on the thethings.iO Blog before step 4 and 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.
- Navigate to the previous Sigfox URL and go to Device. Inside, click on your device type and navigate to Callbacks.
- Click New default callback.
- Choose the following configuration:
- Type: DATA UP-LINK.
- Channel: URL.
- Url pattern: Paste your previous subscription URL from thethings.iO.
- Use HTTP method: POST and click Ok.
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 parameters, copy the data you send from Sigfox and change “quote” to “data” to try your function.
Download our code from: Akeru Cloud Code.
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!