Hello, I’m trying to connect my Arduino UNO to the Blynk app to control 5 MG995 servos with an Adafruit 16-Channel Servo Shield… for a robotic arm. To do this I’m using my Raspberry pi 3B+ as a local server, the Arduino is connected to it via USB.
The local server is online and I can access the Blynk app, the problem is that the blynk-ser.sh keeps reconnecting every 3 seconds, I can’t figure out if i configured the .sh file with the wrong port for the local server address or if it’s something else that i didn’t specify in the Arduino code.
This is what i see on my Raspberry local server when I try to run the file blynk-ser.sh:
Thank you for helping me.
I also tried with port 9443 and the loopback address, it manages to connect successfully but it gives me an error regarding the SSL connection:
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <-> openssl-connect:127.0.0.1:9443,cafile=/home/pi/Arduino/libraries/blynk-library-master/scripts/certs/server.crt,nodelay
2020/04/05 01:03:58 socat[3446] N opening character device “/dev/ttyACM0” for reading and writing
2020/04/05 01:03:58 socat[3446] N opening connection to AF=2 127.0.0.1:9443
2020/04/05 01:03:58 socat[3446] N successfully connected from local address AF=2 127.0.0.1:48280
2020/04/05 01:03:58 socat[3446] E SSL_connect(): error:1416F086:SSL routines:tls_process_server_certificate:certificate verify failed
2020/04/05 01:03:58 socat[3446] N exit(1)
Reconnecting in 3s…
For the USB link, I belive port 8080 was what is to be used in the script. As it is a direct USB link between the Arduino and RPi, there is no need for SSL
With the port 8080 configured in the blynk-ser.sh file the SSL error is gone but I’m again in this loop:
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <-> openssl-connect:127.0.0.1:8080,cafile=/home/pi/Arduino/libraries/blynk-library-master/scripts/certs/server.crt,nodelay
2020/04/05 02:30:22 socat[3703] N opening character device “/dev/ttyACM0” for reading and writing
2020/04/05 02:30:22 socat[3703] N opening connection to AF=2 127.0.0.1:8080
2020/04/05 02:30:22 socat[3703] N successfully connected from local address AF=2 127.0.0.1:41680
2020/04/05 02:30:22 socat[3703] E SSL_connect(): Success
2020/04/05 02:30:22 socat[3703] N exit(1)
Reconnecting in 3s…
Since I have the Blynk library installed also in my Windows 10 PC, I modified the blynk-ser.bat file to connect to the address of my Raspberry pi local Blynk server 192.168.1.28:8080 and it works now!
My Arduino UNO is now online via USB and i can move all the servo motors… It’s still not clear to me why the file blynk-ser.sh on my local server gives me problems with the connection the addresses and the ports declared in both the files are the same
Ok so, I reinstalled again the library and I got the bash file working with these settings:
This is the output:
Resetting device /dev/ttyACM0…
Warning: Server connection may be insecure!
[ Press Ctrl+C to exit ]
Connecting: FILE:/dev/ttyACM0,raw,echo=0,clocal=1,cs8,nonblock=1,b9600 <-> TCP:raspberrypi.local:8080,nodelay
2020/04/05 12:45:32 socat[2060] N opening character device “/dev/ttyACM0” for reading and writing
2020/04/05 12:45:32 socat[2060] N opening connection to AF=2 192.168.1.28:8080
2020/04/05 12:45:32 socat[2060] N successfully connected from local address AF=2 192.168.1.28:52846
2020/04/05 12:45:32 socat[2060] N starting data transfer loop with FDs [5,5] and [6,6]
Thanks GTT and PeteKnight for helping me with this.