In our previous blog entry, we described how we built a connected weather station in a garden, using the NoCAN IoT platform. Since that example kind of left out the 'I' in 'IoT', we will now describe how we connected our weather station to the Internet, thanks to the blynk platform. Even miles away from home, we can get real-time temperature and humidity readings from our testbed garden with just a smartphone :-)

First, we installed the blynk application from our favorite mobile app store following the detailed instructions provided on the blynk website. At the end of this process, we received our blynk auth token, a very important piece of information needed to connect a NoCAN network to the blynk platform.

Configuring nocanc

The nocanc tool can be used as a gateway between a NoCAN network and a blynk server.

The simplest way to configure nocanc for blynk is to edit the configuration file which is ~/.nocanc.conf on Unix-like systems and %userprofile%\_nocanc.conf on MS-Windows systems. See our tutorial for more details on the installation and configuration of nocanc.

We decided to use two blynk virtual pins: virtual pin 2 for temperature readings and virtual pin 3 for humidity. These values were chosen arbitrarily: we just need to match the values selected in the blynk mobile application as described further down. The content of the corresponding configuration file is as follows.

event-server = ...
auth-token = ...

blynk-token = "<your blink auth token>"



As explained in our tutorial, the variables event-server and auth-token need to be assigned to values corresponding to the nocand network manager. More importantly here, <your blink auth token> needs to be replaced with the actual value of the blynk auth token.

Now, assuming that nocand is already running, we can enable our gateway between our NoCAN network and the blynk platform by simply running nocanc blynk which then provides an output similar to the example below:

$ go run nocanc.go blynk
There are 0 blynk writers.
There are 2 blynk readers.
2018/05/14 22:12:32 Starting goblynk
2018/05/14 22:12:32 Connected to
2018/05/14 22:12:32 Sending message {cmd=2 id=1 len=32}:{"0123456789abcdef0123456789abcdef"}
2018/05/14 22:12:32 Waiting data to read
2018/05/14 22:12:32 Received {cmd=0 id=1 len=200}:{}
2018/05/14 22:12:32 Connected and authenticated to, connection cycle 1
2018/05/14 22:12:32 Waiting data to read
2018/05/14 22:12:32 Sending message {cmd=20 id=2 len=10}:{"vw","2","24.75"}
2018/05/14 22:12:32 Sending message {cmd=20 id=3 len=10}:{"vw","3","58.72"} 

On the mobile.

In the blynk app on our mobile, we created a new project and gaive it a random name (test). In the Choose device dropdown, we selected Generic Board, though you can pretty much select any device here since we will use what is called "virtual pins" and we are not really constrained by hardware limitations.

Next, in the application, we added a Labelled Value as shown listed in the screenshot below.

We gave it the label "temperature" and we associated it with the input pin V2 to match the nocanc configuration previously described. We customized the display to show "°C" after the value since we collect temperature in Celcius degrees. Finally, we selected the default PUSH as the reading rate.

Next, we moved to displaying humidity. Again we added a Labelled Value. We gave it the label "humidity" and we associated it with the input pin V3 just as we did in the nocanc configuration file. We customized the display to show "%" after the value. Finally, we selected the default PUSH as the reading rate, as we did before.

We then launched our test application on the mobile phone and watched the temperature and humidity display live. The data gets updated in real-time for as long as you have both nocand and nocanc blynk running.


Thanks to the optional blynk gateway built in the nocanc tool, connecting a NoCAN network to the internet is very simple. In fact, it probably takes 3 times longer to read this article than to connect a NoCAN network to a smartphone.

We will soon release the source code of our blynk Golang library, which might be useful to others who want to interface their Go application with blynk. If you don't know what Go is, give it a try! It's a great programming language that allowed us to build an application mixing low-level SPI communications with a microcontroller along with TCP/IP sockets and lightweight multi-threading.

To stay updated on the NoCAN project, don't forget to follow us on Twitter or on our Facebook page.