Project tutorial
The Environment Cube! Know the Land Beneath You using Sigfox

The Environment Cube! Know the Land Beneath You using Sigfox © LGPL

A cube with all the necessary sensors, suitable for a wide range of applications like agriculture, monitoring, ,etc.

  • 8 respects

Components and supplies

Apps and online services

About this project


So, the project I am making will be great help to the agricultural field, where we need to run several tests on the soil before we can start plantations.

Now, my EnvironmentCube is a smart cube which just needs to be placed in soil and then leave the rest of the work to the cube. It is equipped with several high quality sensors which will measure almost all the factors that are needed to be considered when we are testing the land.

It will measure the salinity level of the sand, water content, temperature, humidity and the air quality of the surrounding environment which will be a great help.

Now, the readings can be accessed readily from the Thingspeak api with the help of sigfox technology at the backend part.

Step 1

Constructyourown3 D printedcube: Now the first step is to make the casing of your cube. Keep in mind that you need to fit a small power source for your Arduino Nano and the Bluetooth module, keep holes for the sensor outlets and make the cube such that you can open and close it whenever you want. I didn't have access to a 3D printer so I cant share an image of the box I used.

Step 2

Hardware Connections:

Now that you have your cube casing ready, lets proceed to the next step. Now we will connect out sensors to the arduino MKR fox 1200 board which have 7 input pins available, which would be enough for our sensors.

We will use a custom size breadboard for parallel voltage outputs for our sensors. The connection process of sensors is described for arduino UNO, the same connections will be made to the MKR board.

Now that we have all the hardware connections ready, lets get our software part ready.

Step 3

Setting up the software part for obtaining readings:

Now we set up our board and configure it with the sigfox first.

  • The first step is the official page of Arduino MKRFox 1200:

  • After this, you must register your Sigfox board. You can follow this steps:

SigFox First Configuration:

  • This procedure registers your board and connects the board to the internet network.

  • You will require this steps to access the readings of your board on the thingspeak dashboard using its API.

Step 4

Now, the next step is creating a thingspeak account.

Now, after your account is created, you can create a new channel. Now your channel can receive the data from the Sigfox backend. For this reason, you must select the API key of your channel and add to the URL in the Sigfox Backend system. Go to API keys page and write your API keys on your Sigfox Backend page. See the next step.

Step 5: Add the Command to the Sigfox Developer Portal

1 / 2

  • Click on Device type and after click on "Callbacks".
  • Select Type DATA and Uplink
  • Select Channel URL
  • Add this line to "Custom payload config":
  • status::uint:8 temp::int:16:little-endian t::int:16:little-endian h::int:16:little-endian
  • Select "Use HTTP method" GET
  • Add this line to your Callback. Modify the ############# with your Thingspeak api key.

Step 6: All the Code and the Software

1 / 2

First of all, install the Sigfox library on your Arduino IDE. This is the Arduino libraries. You can see the official guide to add the Arduino libraries:

Install the Arduino Low Power libraries, Sigfox and the required libraries for all the sensors what we use.

In the callback data on the backend page, there are the names of the variables of your Arduino code. See inside the code.

t = dht.readTemperature();msg.t = convertoFloatToInt16(t, 60, -60);h = dht.readHumidity();msg.h = convertoFloatToUInt16(h, 110);[...]msg.moduleTemperature = convertoFloatToInt16(temperature, 60, -60);[...]SigFox.write((uint8_t*)&msg, 12);

The code catches the Temperature and Humidity data by the DHT-11 sensor, and convert the data to "int". After sending the data to the Thingspeak platform by using the SigFox.write command. Now the same process is followed for all the sensors that we are using.

Now, the biggest advantage using this arduino board is that it is a low energy device so it is possible to power that whole cube with just a battery, which makes it a very compact device.

I have attached a sample arduino code for the temperature and humidity sensor so it will be easy for you to write the codes for the different sensors, you just need to simply import the specific libraries and modify the pin numbers, and use the sigfox.write function to send the data to thingspeak dashboard for monitoring.



The code for temperature and humidity sensor DTH 11Arduino
#include <ArduinoLowPower.h>
#include <SigFox.h>
#include <DHT.h>

#define DHTPIN 1
#define DHTTYPE DHT11

float temperature;
float t;
float h;

    ATTENTION - the structure we are going to send MUST
    be declared "packed" otherwise we'll get padding mismatch
    on the sent data - see
    for more details
typedef struct __attribute__ ((packed)) sigfox_message {
  uint8_t status;
  int16_t moduleTemperature;
  int16_t t;
  int16_t h;
} SigfoxMessage;

// stub for message which will be sent
SigfoxMessage msg;

void setup() {
  if (!SigFox.begin()) {
    // Something is really wrong, try rebooting
    // Reboot is useful if we are powering the board using an unreliable power source
    // (eg. solar panels or other energy harvesting methods)
  //Send module to standby until we need to send a message

void loop() {
  t = dht.readTemperature();
  msg.t = convertoFloatToInt16(t, 60, -60);
  h = dht.readHumidity();
  msg.h = convertoFloatToUInt16(h, 110);
  // Start the module
  // Wait at least 30ms after first configuration (100ms before)

  // We can only read the module temperature before SigFox.end()
  temperature = SigFox.internalTemperature();
  msg.moduleTemperature = convertoFloatToInt16(temperature, 60, -60);
  // Clears all pending interrupts

  SigFox.write((uint8_t*)&msg, 12);

  int lastMessageStatus = SigFox.endPacket();


  //Sleep for 15 minutes
  LowPower.sleep(15 * 60 * 1000);
void reboot() {
   while (1) ;


Similar projects you might like

The Environment Cube! Know the Land Beneath You!

Project in progress by Dhairya Parikh

  • 23 respects

Sigfox kWh Meter

Project tutorial by jassak

  • 15 respects

SIGFY (Sigfox Farm Yield) with Crop and Health Monitoring

Project tutorial by Team SIGFY

  • 31 respects

Arduino MKR FOX 1200 Sigfox Meteo Station

Project tutorial by Giovanni Gentile

  • 10 respects

Portable Environment Monitor

Project tutorial by Tharindu Liyanage

  • 9 respects
Add projectSign up / Login