Blynk Library for Omega

The Omega now officially supports Blynk and the Blynk Library. You can now use the Blynk app to control your Omega!

[[TOC]]

Overview

Using the Blynk Library and Node.js, you can control your Omega through the Blynk mobile app. For further reading on the library’s functionality refer to the documentation or check out blynk.cc.

Installation

To install the Blynk library run the following commands:

opkg update
opkg install blynk-library

This will install Node.js 4.3.1 as well, if it is not already installed.

OnOff Package

If you would like to use Blynk to control the Omega’s GPIOs, you will need to install the onoff Node package as well:

opkg update
opkg install onoff-node

Installation Size

See the table below for info on how much space each of the mentioned packages will take up on your Omega:

Package Size
nodejs 8.5MB
blynk-library 260kB
onoff 880kB

Getting Started

Follow along with Blynk’s guide for info how to get started!

Optional: Auth Token Check

You can run a quick check to see if your Auth Token works correctly:

node /usr/bin/blynk-library/bin/blynk-client.js <Auth Token>

Using the Library

The modules will be installed to the /usr/bin/ directory, so you will need to point to the correct directory for import. Your import code should look like this:

var BlynkLib = require('/usr/bin/blynk-library');

Testing

The following is a test script to illustrate communication via the Blynk App. On the App side create a button that is a virtual pin 1 (V1)

Then create a file test.js:

var BlynkLib = require('/usr/bin/blynk-library');

var blynk = new BlynkLib.Blynk('<YOUR AUTH TOKEN HERE!>'); // Make sure to replace this with your Auth Token
var v1 = new blynk.VirtualPin(1);

v1.on('write', function(param) {
  console.log('V1:', param);
});

And you can run the script with the following command:

node test.js

Press the button on you app and note the output on the screen.

You can take this further by using the OnOff module to control the Omega’s GPIOs.