Help with RPi connection issues

Can some kind soul tell me what I’m missing here?
I had this simple setup working yesterday but can not get Blynk running on RPi Zero W.

I’m just trying to make an led blink. I have managed to feed two live video streams to tthe phone app but get the following error msg whn trying to connect:

pi@pi2:~ $ cd blynk-project
pi@pi2:~/blynk-project $ node index.js
OnOff mode
Connecting to: blynk-cloud.com 8441
SSL authorization…
Connected
Authorized
Disconnect blynk
REARMING DISCONNECT
Connecting to: blynk-cloud.com 8441
SSL authorization…
Connected
Disconnect blynk
Connecting to: blynk-cloud.com 8441
SSL authorization…
Connected
Disconnect blynk

Any thoughts or pointers?

There might be something in your code tripping a JS error… Try without SSL, just TCP.

Thanks Gunner- good pointer. That worked and then inexplicably deleting the TCP option from the AUTH statement(?) allowed it to run with SSL. It really bugs me that I cant work out why this is the case! Ive got tthe RPi Camera working and sending a jerky stream to the app so I can see if I’ve managed t
to blink and LED over the wifi.

Now to get the temperature & humidity sensor reading to the app…

Can you point me in the direction of useful information?
ANNNNNNDDDDDD… I’m struggling to find information about connecting to my local server running on my other rpi zero. Is there a nodejs config file I have to edit to point to my local server/network?

I must be more awake this morning as I have achieved the immediate goals for this project- rpi running a camera and humidity/temp sensor.


Next- do I have blynk run as a service or run it through rclocal?
On a side note- running the app on android the video has much better response on the video stream widget. The delay is more than 10 seconds on the iphone only about 2 seconds on the hTC

2 Likes

Good work!! :smiley: Getting my PiCam to stream is one of my next goals… just havent had the focus to work on it yet. But I did get the pan and tilt to work.

What method did you use to stream the video?

It is just a modification of the connection command in your script…

const Blynk = require('blynk-library');  // Links variable 'Blynk' to the Blynk Library
const AUTH = 'xxxxxxxxxx';  // My top secret auth code
var blynk = new Blynk.Blynk(AUTH, options = {
	 connector : new Blynk.TcpClient( options = { addr: "xxx.xxx.xxx.xxx", port: 8080 } )
	 });  // This takes all the info and directs the connection to my Local Server.

Hi- I used this link for the instructions. [https://elinux.org/RPi-Cam-Web-Interface]. It worked pretty much as written. It was in an article about using Telegram which I dont need to use because the video will stream through Blynk! [https://quavoce.wordpress.com/2017/09/29/telegram-send-messages-photos-animated-gifs-from-your-raspberry-pi-and-rpi-web-cam/]

1 Like

Did you get your RPi to link with your Local Server yet?

Meanwhile… thanks to your post and info, I finally had the incentive to get my PiCam online with Blynk :smiley:

The connect-disconnect seems to be a bug in the JS library. It will happen also with pure TCP without ssl. The difference in that with ssl on the long run the program will crash, while it won’t with tcp. But still is very annoying.

Cool looking project!
Decided to leave connecting to the local server as I wanted to experiment with away from base connections. Can use VNC to access the camera stream and get the temp/humidity through Blynk.

BTW- do you know what happened to the graph widget- could only find the Super Chart which really eats the beans!

SuperChart is the replacement for the original graph. It really has some better features, so give it a chance :slight_smile: (I am not a dev, just a user like yourself)

Realised that it was a passing comment. What I aam having problems with today- if youve got a moment- I want to add a counter that shows how long the proramme has been running. At the moment it give a display in seconds which is useful for making sure its not crashed. My question is where do I find ref-materials/how to guides for node js?

var sensorLib = require('node-dht-sensor');

var AUTH = 'xxxxxxxxx';

var blynk = new Blynk.Blynk(AUTH);

var v1 = new blynk.VirtualPin(1);
var v9 = new blynk.VirtualPin(9);
v1.on('write', function(param) {
  console.log('V1:', param[0]);
});

v9.on('read', function() {
  v9.write(new Date().getSeconds());//-would like this to show hours/mins/secs uptime
});
// Setup sensor, exit if failed
var sensorType = 22; // 11 for DHT11, 22 for DHT22 and AM2302
var sensorPin  = 4;  // The GPIO pin number for sensor signal
if (!sensorLib.initialize(sensorType, sensorPin)) {
    console.warn('Failed to initialize sensor');
    process.exit(1);
}

// Automatically update sensor value every 2 seconds
setInterval(function() {
    var readout = sensorLib.read();
    blynk.virtualWrite(3, readout.temperature.toFixed(1));
    blynk.virtualWrite(4, readout.humidity.toFixed(1));
    
    console.log('Temperature:', readout.temperature.toFixed(1) + 'C');
    console.log('Humidity:   ', readout.humidity.toFixed(1)    + '%');
}, 2000);


I noticed that the exported csv file has a number that gets 2000 bigger every 2 secs - where is that generated?- And could I use  that  with some  simple maths to give hours/mins/secs in a value display in the app?- And is console.log the echo to the terminal-  if I disable  that would that save resources on the pi and make it more stable?





Finding stuff for NodeJS is just a matter of Google. Thankfully there is lots out there.

Finding Blynk related references is a bit more effort :slight_smile: there is primarily this forum and the few people like us that use Blynk Client on the RPi. Search this forum for keywords like NodeJS or javascript for those nuggets.