Intel Edison – sending data to cloud thanks to Arduino

Intel Edison – sending data to cloud thanks to Arduino

Due to high interest in my previous article about the Intel Edison platform, I decided to post the second part much sooner. This time I'm talking about using the module from the programming point of view.

I also got an idea regarding the Forbot courses – I'm counting on your opinions!


Intel Edison programming

When the platform is already standing on your desk, there comes the time when you can start writing a program. It's not that obvious, though, since we have a few different options to choose from. The good news for programmers is that on the Intel website we can find information prepared for Windows, MacOS and Linux users.

For testing Edison I used Windows, and the rest of the article pertains to this system. The sequence of actions is mostly analogous, though, and it shouldn't cause anyone much trouble. We can create applications using 3 compilers:

  1. Arduino,
  2. Intel® XDK IoT Edition,
  3. Eclipse.

Since recently I've been spending all my time writing the Arduino course, I'm sure you can guess which one of the Edison programming options I chose? Obviously it was the first option. Why? Arduino itself is very easy, so I unconsciously counted on a similarly easy start with Edison. But before I started flashing the LED I had to do some preparations.

System update, settings

After uploading the software package (available to download from the Intel website) I connected the board to the computer with two USB cables. According to the manufacturer's website, an external power supply is recommended but it's not required. So obviously I didn't use it, which turned out to be a mistake.

Without an additional power supply, the board refused to fully start, it wasn't properly detected. Of course first I reinstalled the drivers, switched the cables for shorter ones and read some information online. Eventually I connected the power supply and the system fully started. The computer showed the new drive I had been waiting for:

Intel Edison widoczny w systemie.

Intel Edison visible in the system.

Then I updated the operating system (Yocto Linux). It was relatively easy. In a nutshell: connect the system to the computer, remove the old system, download the appropriate archive from the manufacturer's website, upload it to the above drive, connect to the module through through Putty, run the command:

There's some magic happening on the screen and the new system appears in front of our eyes.. The next step was configuring the WiFi – we do everything from the console by running the command:

The process of configuring WiFi looks like this:

Konfiguracja WiFi na Intel Edison.

WiFi configuration on Intel Edison.

After that we can connect to the platform using the provided IP address, which you can see on the screenshot below:

Połączenie z Intel Edison za pomocą WiFi.

Connecting to Intel Edison through WiFi.

Let's leave the console for now and move on to Arduino, which was uploaded with the Intel software package. It's a compiler version, which to the long list of Arduino boards has added Intel Galileo and Intel Edison.

After selecting the platform we need to define the COM port – here we select "the second one". That's because we don't upload programs through the port that we have used before to communicate with Linux.

First I uploaded the standard flashing LED code:

The effect is visible in the animation below (the green LED on the right from Edison):


It's a shame to use such a well-developed platform for flashing 1 LED, though. That's why I started to create another program. It was going to be a simple weather station that collects the following information from the sensors connected to Edison:

  1. Ambient temperature
  2. Temperature of Edison's first core
  3. Light intensity
Elementy potrzebne w przykładzie.

Elements necessary for the example.

In order to do that, I built a very simple circuit on a breadboard. According to the diagram below. I used an ordinary photoresistor as a light sensor, and the LM35 analog sensor acted as a thermometer. The potentiometer visible in the diagram was used for regulating the resistance in the voltage divider created with the phototransistor. Thanks to that, I could easily regulate the sensor values.

Schemat do pierwszego przykładu z Intel Edison.

Diagram of the first example with Intel Edison.

Next, using the examples, I created a simple program that collected information from the sensors. "Collected" is actually too big of a word – it simply read the information and didn't do anything with it. The whole thing looked as follows. The function reading the temperature of the core comes from the examples:

The information is collected, time to get to know the Intel IoT Analytics cloud.

The first confrontation with the cloud

To begin your adventure with IoT it's necessary to visit the website of the Intel IoT Analytics project. On the site we find a login and registration form.

logowanie do chmury Intela.

Logging in to the Intel cloud.

After logging in to the system we go to account settings, we need to get the activation code that is valid for one hour:

Kod aktywacyjny.

Activation code.

Now we return to Edison and connect to it through WiFi (using Putty). As I said at the beginning, this description only gives general directions, so I'm not going to describe every single step in detail right now (more information at the end of the article).

It's necessary to install the iotkit-admin agent which allows us to communicate with the cloud. Then we use the provided code and activate Edison.

After a few seconds it's going to be visible in our devices:

Urządzenia podłączone do naszego konta.

Devices connected to our account.

Registering system components

Now we need to register the components the system is going to use. To be more clear, we need to declare which information we're going to send from Edison and what's supposed to happen to it later. For this purpose we use sensors and actuators available in the catalog, for example:



Hopefully the detail view sufficiently explains what components are:

Szczegóły komponentu w chmurze Intel IoT.

Component details in the Intel IoT cloud.

Now it's time to actually register the components, which you do from the Edison console. Each sensor needs to be added separately, running a command similar to this one:

Each element needs to have its own unique alias assigned, in this case it's tempOut and the type – here it was the temperature reading. Choosing the appropriate type means that in the chart we're going to see the appropriate scale and unit.

Now we can return to Arduino and start sending the data.

Intel Edison – sending data to the cloud

Now it's time to add the function of sending information to the cloud to our previous program. It's very easy. You just run commands similar to this one:

Very simple, isn't it? Communicating with a cloud is not much more difficult than using UART with Arduino. Running this command causes the value of the variable tempOut provided as the second argument to be attributed in the cloud to the component registered under the name tempOut. Of course the similarity of the names of the two values is coincidental.

The entire program looks as follows:

After uploading the program, the data starts to be regularly sent to the cloud. It's going to be visible right after logging in, on the main page.There we will find information about the number of devices connected to our account that send data, and about the number of collected samples:

Informacja o aktywnych urządzeniach.

Information about active devices.

In the chart tab we're going to find the most interesting part – charts. First we need to select the device and the information we're interested in (you can see that I had registered another thermometer that I didn't end up using):

Wybór odpowiednich parametrów.

Selecting the appropriate parameters.

The chart is displayed below. We can choose how often it's going to refresh. This allows us to have a chart that changes in real time:

Automatyczna aktualizacja wykresu.

Chart updating itself automatically.

What's interesting, the cloud also allows us to define certain rules that trigger certain actions. For example, we can receive an email when the sensor reading drops below a set threshold. There are more options, but for now I'm not going to describe them.

IoT systems on Intel Edison – Course?

As I said at the beginning, I didn't describe working with Intel Edison in much detail. It's not a topic that can be dealt with briefly in just two articles.

Remember that in this case the cost of hardware will be pretty high – but its capabilities largely exceed those of other technologies. The module itself is also very universal. 

Summary of the adventure with Intel Edison

It's time to summarize my brief adventure with Edison. Despite not having had much experience with IoT, I have to admit that accustoming myself to that world wasn't that scary at all. As you can see, writing the first program using GPIO, WiFi and cloud technology is not difficult.

It's a shame that for now there's only a limited number of projects based on Intel Edison on the Polish Internet (and not only there). It seems to be caused by the lack of adequate educational materials, and the official ones sadly have some shortcomings. But, as I said, Forbot can change that – everything depends on the results of the poll above!