Beginners Guide: Connecting An Arduino To thethings.iO

Arduino loves thethings.iO

Arduino loves thethings.iO

In today’s post we are going to show you Step by Step how to connect an Arduino to our platform, thethings.iO. You will only need:

  • An Arduino or Genuino board.
  • Ethernet, Wi-Fi (or Yún or an ESP8266, for the cheaper version) or GSM shield.

Now, make sure you have an account at thethings.iO. If not, register quickly by clicking here.

Once you have done this, you can start with this Step by Step.

Step 1: Preparing the environment

First you need the Arduino software installed. Afterthat, download the thethings.iO Arduino library in our github. Extract the thethingsiO from the .zip file and install it by copying the folder to your Arduino library folder.

The default path for the libraries is:

  • Linux: /Home/your-username/Documents/arduino/libraries
  • Mac: /Users/your-username/Documents/Arduino/libraries
  • Windows: \My Documents\Arduino\libraries

Now you can use the classes and functions described in the reference part of the repository.

Step 2: Sending Values

Now you need to open the Arduino software. Navigate to Examples > thethingsiO. Choose a protocol (if you are a beginner we recommend you to choose http) and then choose your shield (Ethernet, Wifi or GSM). Next, choose Send Values. An already “done” code will appear.
Now we need to make sure that we correctly initialize our Shield. For every shield there’s a method that does the previous action.

For the Ethernet shield, we need to provide the mac address of the shield (located below the shield):

void startEthernet() {
Serial.println("Connecting Arduino to network...");

// Local Network Settings

byte mac[] = { 0xAA, 0xBB, 0xCC, 0xDD, 0xEE, 0xFF }; // Must be unique on local network

// Connect to network amd obtain an IP address using DHCP

while (Ethernet.begin(mac) == 0) {
Serial.println(“DHCP Failed, retrying”);

Serial.println(“Arduino connected to network using DHCP”);

For the GSM shield, we need to provide the PIN number and the apn settings for your SIM card:

// PIN Number

#define PINNUMBER “”

// APN data

#define GPRS_APN “”
#define GPRS_LOGIN “”
#define GPRS_PASSWORD “”

For the Wifi Shield, you need to provide the SSID and the password:


//In case that you already activated the token with an activation code and we have the token, use the next code:

thethingsiOEthernet ethernet_thing(TOKEN);
thethingsiOWiFi wifi_thing(TOKEN);

// Choose the one depending of your shield.

thethingsiOGSM gsm_thing(TOKEN);

// If you have the activation code but not the token, add the following code:
thethingsiOEthernet ethernet_thing();
thethingsiOWiFi wifi_thing();

// Choose the one depending of your shield

thethingsiOGSM gsm_thing();
string token = activate(“Your activation code”);

// Insert this and the next line inside the setup method, after the start function of the shield

if (token > “0”) setToken(token); // If the activation code is correct, a token is provided

Now that you have your thing created, it’s time to send values.

void loop() {
thing.addValue("Power", random(1,5)); // Adding a value from a number between  1 and 5 with the identifier "Power"
thing.addValue("Temperature", random(0,40)); // Adding a value from a number between 0 and 40 with the identifier "Temperature"
thing.send(); // For sending the previous values to your dashboard }

Step 3: Arduino Monitoring with thethings.iO

Now it is time to monitor the data. Go to Things Manager and select the thing where you are sending the data, that’s the Thing Details.

Thing details with arduino data

Thing details with arduino data

Step 4: Arduino real-time dashboard

Let’s create a cool dashboard which you will be able to monitor this data in real-time.
First, we go to the thethings.iO dashboard. Here, you have to Add a Widget. You do this by pressing the blue circle in the lower right corner.

Add A Widget

Now, choose the kind of Data Source you want to see on your Dashboard.

Add a Widget_2

And select the Resource.

Add a Widget_3

After that, you have to select the Widget Type you’ll want it to appear on your dashboard. In our case we are choosing ‘Lines’ for ‘Temperature’, and ‘Pie’ for ‘Power’.
Add a Widget_Temperature
Add a Widget_Power

And this is an example of what your dashboard would look like if you added a bar graph and logs as well…



Start with thethings.iO

And that’s it! Easy, right? Now you have your Arduino connected with thethings.iO. Start connecting things now!


IKEA joins the IoT revolution

IKEA joins the IoT Revolution

IKEA joins the IoT Revolution

Internet of Things is now a reality, and lots of companies have to face it. Companies from many different fields (as we have seen: housing, decor, gardening…) have to improve their offers in order to survive in the new technological era. That’s why the famous Swedish company IKEA has decided to adapt things into the IoT’s world and also create new connected things to make our lives easier.

IKEA’s idea is to make a more sustainable life at home, so that is the reason why in the next decade the brand is going to create and develop new connected things, such as the whole kitchen. In a collaboration with IDEO, a global design company, and design students from Lund University (Sweden) and Eindhoven University of Technology (Netherland), IKEA has created the named Concept Kitchen, which was shown at the Milan Design Week.

Read more

How IoT will change our gardens

How IoT will change our gardens

How IoT will change our gardens

In this blog, we have had a quick look at different ways that Internet of Things is going to change our lives soon, like houses, cities, workplaces and even animals! As you see, Internet of Things is going to change absolutely everything, and your garden could not be less. In this post, we are going to know new connected garden equipment that will help you improve it.

It is commonly said that most people do not have many time to take care of their garden. Then, you need to ask yourself if you prefer to have a poor garden, or better hire a gardener who will care of it for you.

Firstly, you need to know that, as well as there are thermostats that can help you control your house temperature or humidity, there is also the garden version. Edyn Garden Sensor is an IoT device that tracks environmental conditions, such as light, humidity, temperature… and then recommends you which plants will thrive or the optimal time for planting, among others. You can see all the information just by using its app. Isn’t it easy?

Edyn Garden Sensor

Edyn Garden Sensor

Other IoT devices can also help you save lot of water, for example RainMachine, which is synchronized with NOAA (National Oceanic and Atmospheric Administration) and other international weather data sources, that sends information to the app about temperature, humidity, wind speed, solar radiation, amount of precipitation… This device also calculates daily evapotranspiration losses and, at the same time, auto-adjusts the watering duration depending on the needs of the plant. The main purpose of RainMachine is protect and nourish your garden to perfection.

Koubachi offers a new point of view in tracking and controlling your plants. It offers a plant sensor (there are the indoor and outdoor options) and measures vital plant parameters, like light level (sunlight or artificial), soil temperature, humidity… With it, your own plant will tell you when you should to water it or if you need to change its position. In your app you will have an inventory of your plants.

Koubachi Plant Sensor

Koubachi Plant Sensor

For all those that have tried to have a little vegetables’ garden at home, Click & Grow is the option they were looking for. Their first internet-connected device was Smartpot, a connected pot that allows you to watch how your plants grow. As they describe themselves, the process is simple: “plug it in, add a little water and let it take care everything else”. By using an innovative NASA-inspired technology, they make plants grow faster, but still 100% naturally, without pesticides, insecticides… Can you believe it?

Even the brand Parrot has been interested in the connected devices, specially with a garden product, so similar to Koubachi. It is called Flower Power, and measures the needs of your plants and sends it to your phone. Available indoor and outdoor, it controls fertility, humidity, temperature and light. When it detects a need, it advises you automatically, so you will know in real time when to water your plants, add fertilizer…

Even if you are a garden-lover or a garden-forgetful person, IoT is going to change the way you look at your garden for sure! Now, any excuse is going to be accepted.
thethings.iO connects all those devices to the Internet, as most of you know. Actually, some months ago we connected a Koubachi Plant Sensor here at thethings.iO’s office! If you want to know more about IoT world and thethings.iO stay tunned!

Discover how we can help you to connect wearables and devices to the Internet.

Try for free now

How IoT will change our animals

How IoT will change our animals

How IoT will change our animals

Could you ever imagine that Internet of Things is going to change our animals? Yes, this is possible, just keep reading and you will discover it!


Basically, the most common IoT devices for dogs or cats are the animal tracking-kind. Many companies have created a similar FitBit bracelet, but for dogs’ neck. It is commonly said that the dog is the best friend of the human, so why not start understanding it?

Some examples are WÜF or FitBark, which monitors the dog’s everyday activity and allows you to track its progress. By using FitBark, the dog’s master can understand its health, changes in behaviour, share experiences with friends and family, automatically share data to its vet, etc. It fits in all kind of dogs.

Read more

How IoT will change Sport

How IoT will change Sport

How IoT will change Sport

First, it was the Health app from Apple or Nike+, Nike + Running, Runtastic mobile apps…, and now lots of wearables and other devices are connected to the internet to measure, not only your steps, even more and more. From bracelets to t-shirts that control your movements. The inimaginable, has become real to change our lives. Do you want to know more? Keep reading, we are going to show you the latest news in the Internet of Sport Things field.


To practise Fitness is in style. Everyone knows what fitness it, and most people around the world have added it to their lifestyles. The Internet of Things fitness devices’ main role is to help athletics practise it in a better way.

If we think about running, the first device that comes to our minds is FitBit. What is it? It is a brand of connected bracelets that allow the customers to track their day-to-day. Your daily steps, the distance you have walked, the calories you’ve burned… everything is tracked with one FitBit device. To monitor your sleep at night, to wake you up with a quiet vibration, act as a clock or ask at phone calls (yes, you can connect it to your smartphone) are some of other capabilities Fitbit offers to customers. But there’s even more! All the data generated can help you see your own personal progress and keep the control. There are other sport brands that offer a similar product as FitBit, for example, Nike, with its device called FuelBand.

Read more

How the Internet of Things will change our houses

How IoT will change our houses

How IoT will change our houses

“Home, sweInternet-of-Things home”. Yes, IoT will be in your house too. Imagine yourself arriving from work. You lock your car just by touching your smartphone. Automatically, you can also open your house’ front door. You are in, and then, looking at your own smartphone, you can know exactly the temperature, humidity… there is in the house. And what about turning your lights on with just one click? Let’s talk about some of those opportunities that new homes will bring us…

Saving energy

As we have said and repeated lots of times, most IoT help us saving energy. Using a new system of connected, for example, lights, you can customize and adapt them depending on your needs at any time. Check Ledmotive, one of thethings.iO customer, and you will realise what we are talking about.

Read more

Light plays Music under the Sea in the Sónar Festival with thethings.iO

The Citclops Project presents the “Musical Tentacle” in the Sónar + D contest

The Citclops Project presents the “Musical Tentacle” in the Sónar + D contest

Every June, Barcelona feels the beats of the Sónar, the Electronic and Experimental Music Festival.

If two years ago, at thethings.iO we were connecting an IKEA sofa to the Internet to allow everyone to feel the music of the Festival, this time we are collaborating in another project called Citclops. The Citclops Project presents the “Musical Tentacle” in the Sónar + D contest, thanks to the Program STARTS organized by the European Commission, about the innovation and creativity in the technological and scientific field.

The “Musical Tentacle” is a project to sonify and artistically express scientific data used to measure the transparency of the sea water through the real-time broker of thethings.iO.


It only needs a buoy, a KdUINO (a low-cost Arduino), a water-resistant box and thethings.iO. The box fits a basic open-source electronics prototyping platform and communications payload. Buoy’ sensors, which measure the light in the water, are connected via cable to the box. The data generated is real-time transported to thethings.iO and accessible by using a mobile device because of the capability of connecting it to the buoy.

Musical Tentacle offers a unique opportunity to audio-visually experience variations in the transparency of our seas. Are you going to miss the chance to live it for yourself?

Don’t forget to follow us on Twitter!


thethings.iO interviewed at the Tech Lounge MWC15

Last March, as you might know, the Mobile World Congress took place in Barcelona. In that congress, Marc Pous, thethings.iO CEO was interviewed at the Intel TechLounge leaded by Sascha Pallenberg. Do you want to see it? Watch the following video:

Most Internet of Things companies do both hardware and software, so they have a lot of work reinventing the wheel. What would happen if each company focus on what they do best? thethings.iO brings to IoT companies a real-time cloud solution, allowing them to make just hardware. So they build the things, and then, thethings.iO connects them to the Internet.

AH! Don’t forget to follow us on Twitter!