BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Onion Omega 2 and Omega 2 Plus with Blynk

My Onion Omega 2 Plus (2+) is now connected to Blynk and doing some of the regular stuff like writing to Terminal and console plus controlling an ESP’s LED with Bridge etc.

@vshymanskyy when you have time could you please add this new device as the pinout is different to the original Omega.

I have onoff installed but console states no direct pin operations are available.

Any ideas?

@Dmitriy or @vshymanskyy there was a question asked some time ago about javacript notation to write to the lcd and @Lichtsignaal suggested it could just be lcd.write(…)

Tried all the combinations I can think of but no joy.

Could you please indicate the javascript syntax for simple and advanced LCD mode.

1 Like

@vshymanskyy the digital pins are working if you read and write to them from a virtual pin but not with direct control. Code for virtual pin control of the digital pins is:

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

var Gpio = require('/usr/bin/onoff-node/onoff').Gpio,
  relay = new Gpio(1, 'out');	// was 21 on Pi

var AUTH = 'xxxxxxxxxxxxxxxxxx';

var blynk = new Blynk.Blynk(AUTH, options = {
  connector : new Blynk.TcpClient()
});

var v8 = new blynk.VirtualPin(8);    		// button for GPIO 1 toggle

v8.on('write', function(param) {
  console.log('Toggle GPIO 1: ', param[0]);
  term.write('Toggle GPIO 1: ' + param[0] + '\n');
  if(relay.readSync() == 0) {  // toggle gpio 1 from high to low
	relay.writeSync(1);
  }
  else {
	relay.writeSync(0);
  }  
});
1 Like

thanks for reporting, added to the roadmap

1 Like

If anyone is trying to use their Omega 2 with Blynk the edit required to use some digital pins directly is:

Locate blynk-node.js in /usr/bin/blynk-library

Around line 329 change

var Gpio = require('onoff').Gpio;

to

var Gpio = require('/usr/bin/onoff-node/onoff').Gpio;

Some digital pins means pins that are common to the original Omega and the Omega 2 (or 2+) until such time as the pin definitions are updated.

@vshymanskyy Onion have a potentially useful browser tool to control GPIO’s that will look something like this when it is updated and the pins match the image of the MCU.

Currently if you try to update a GPIO, via the browser, that is also being controlled by Blynk the connection to Blynk will drop with a js error. Would be nice one day for it all to work together.

2 Likes

Moved this to the Projects section from the Help section.

Had the Omega 2+ doing what I wanted locally and now it is all cloud based.

My +2 takes snapshots from a cheapo webcam and emails them to me, all done without port forwarding and with the power of Blynk. Currently snapshots are sent on demand but can be set based on sensors or button pushes etc. Great for me as my WISP doesn’t provide port forwarding.

Posted the same image on the Omega site.

1 Like