BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Local Server Arduino USB connection

Hello,

I am having a issue with getting my Arduino Uno to connect to the local server with the “blynk-ser.sh” file in linux. The server connection works under the default but its port is 8441 (app says "Your Arduino UNO is not in network). I believe is should be 8442 correct?
When I changed the port to 8442 it also says (app says "Your Arduino UNO is not in network), but that is due to the fact that “SSL_connect(): socket closed by peer”. I attempted to follow the directions here, but that did not work, because it puts me back to 8441.

Below are the terminal output for both scenarios.

Any help would be appreciated.

I’ve tried Default:

develop@develop-GB-BXBT-2807 ~/Arduino/libraries/Blynk/scripts $ sudo bash ./blynk-ser.sh -c /dev/ttyACM0
[ Press Ctrl+C to exit ]
Resetting device /dev/ttyACM0...
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <-> openssl-connect:cloud.blynk.cc:8441,cafile=/home/develop/Arduino/libraries/Blynk/scripts/certs/server.crt,nodelay
2016/01/24 13:11:28 socat[5955] N opening character device "/dev/ttyACM0" for reading and writing
2016/01/24 13:11:28 socat[5955] N opening connection to AF=2 45.55.195.102:8441
2016/01/24 13:11:28 socat[5955] N successfully connected from local address AF=2 192.168.2.8:59119
2016/01/24 13:11:28 socat[5955] N SSL connection using ECDHE-RSA-AES128-GCM-SHA256
2016/01/24 13:11:28 socat[5955] N SSL connection compression "none"
2016/01/24 13:11:28 socat[5955] N SSL connection expansion "none"
2016/01/24 13:11:28 socat[5955] N starting data transfer loop with FDs [3,3] and [4,4]

Changed port to 8442:

develop@develop-GB-BXBT-2807 ~/Arduino/libraries/Blynk/scripts $ sudo bash ./blynk-ser.sh -c /dev/ttyACM0 -p 8442
[ Press Ctrl+C to exit ]
Resetting device /dev/ttyACM0...
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <-> openssl-connect:cloud.blynk.cc:8442,cafile=/home/develop/Arduino/libraries/Blynk/scripts/certs/server.crt,nodelay
2016/01/24 13:14:28 socat[6173] N opening character device "/dev/ttyACM0" for reading and writing
2016/01/24 13:14:28 socat[6173] N opening connection to AF=2 45.55.195.102:8442
2016/01/24 13:14:28 socat[6173] N successfully connected from local address AF=2 192.168.2.8:35332
2016/01/24 13:14:28 socat[6173] E SSL_connect(): socket closed by peer
2016/01/24 13:14:28 socat[6173] N exit(1)
Reconnecting in 3s...

My understanding is that 8441 is SSL and 8442 is TCP.
You say the server connection works under the default port but … have you ever had a connection to 8441 or 8442?
Do you have any firewalls blocking these ports?

When you say local server I assume you mean local to you. The script is trying to connect you to the cloud server. I was actually going to suggest you try the cloud server to start as we know that server is set up correctly with firewalls off etc.

Which server do you want to connect to?

I have never had a connection to either and the firewall is currently off to solve the local server issue I had.

In your last post in the local server thread it looks like you connected, no?

No offence to any server guys, especially as I know nothing about servers, but if you are having trouble locally try the cloud first.

I have used Uno’s with USB to the cloud but not on Linux unless you include Pi’s OS as a Linux derivative.
When I’m using USB it is mainly on a Windows machine and it is very reliable.

Just looking at your 8441 connection and it looks like you were successfully connected to the cloud. Use the right sketch and app details to test it then move on to local server. I believe you will just need to change the script stuff from cloud.blynk.cc to 192.168.10.1 (your local ip) for example.

So I have solved all of the issues concerning the connecting the arduino to the server, but the app still comes up with “Your Arduino UNO is not in network”.

I’ve created my own certs and they seem to work.

bash ./blynk-ser.sh -s localhost
[ Press Ctrl+C to exit ]
Resetting device /dev/ttyACM0...
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <-> openssl-connect:localhost:8441,cafile=/home/develop/Arduino/libraries/Blynk/scripts/certs/server.crt,nodelay
2016/01/25 17:23:27 socat[19532] N opening character device "/dev/ttyACM0" for reading and writing
2016/01/25 17:23:27 socat[19532] N opening connection to AF=2 127.0.0.1:8441
2016/01/25 17:23:27 socat[19532] N successfully connected from local address AF=2 127.0.0.1:44865
2016/01/25 17:23:27 socat[19532] N SSL connection using DES-CBC3-SHA
2016/01/25 17:23:27 socat[19532] N SSL connection compression "none"
2016/01/25 17:23:27 socat[19532] N SSL connection expansion "none"
2016/01/25 17:23:27 socat[19532] N starting data transfer loop with FDs [3,3] and [4,4]

The blynk.log reads when i start the bash ./blynk-ser.sh -s localhost I get the screen shot below and I cant read anything.

So 2 issues:
App is connected to server but I dont know if the board is
WiFi board not working on server either
blynk.log corrupt. (fixed after reinstalling server)

Working:

17:31:13.332 INFO  - Using data dir '/home/develop/Blynk'
17:31:13.338 DEBUG - Starting reading user DB.
17:31:14.036 DEBUG - Reading user DB finished.
17:31:14.172 INFO  - Initializing mail transport. Username : example@gmail.com. SMTP host : smtp.gmail.com:587
17:31:14.764 DEBUG - hard.socket.idle.timeout = 15
17:31:14.764 INFO  - Plain tcp/ip hardware server port 8442.
17:31:14.766 INFO  - Enabling SSL for hardware.
17:31:16.349 INFO  - SSL hardware port 8441.
17:31:16.441 INFO  - Enabling HTTPS for admin UI.
17:31:16.475 INFO  - HTTPS admin UI port 7443.
17:31:16.491 INFO  - Enabling SSL for application.
17:31:16.494 WARN  - Found server certificates but no client certificate for '/home/develop/Blynk/server' path. Using one way ssl.
17:31:16.521 DEBUG - app.socket.idle.timeout = 600
17:31:16.522 INFO  - Application server port 8443.
17:31:16.540 INFO  - Enabling HTTP for app.
17:31:16.540 INFO  - HTTP for app port 8080.

Depending on your log level, the Blynk.log should say something like “hardware joined” when the board connects.

I’m not sure how good your knowledge of linux is, but with tail -f blynk.log you can monitor the log file realtime to see if the board connects to the server.

@Lichtsignaal, the blynk.log continuously went corrupt, either I could not view it at all or it was a mass of Chinese letters. For the time being I have switch back to one of my windows machines to get the server running properly, then I will focus on trying to get it to work on Mint. Thanks again for the valuable input.