USB-Serial doesn't work

Hey there,

Recently I tried to setup a Serial-USB connection to my home network from my office (and before you say, it’s the firewall, I manage the firewall :wink: ) and it doesn’t work.

The sketch:

//#define BLYNK_PRINT Serial1
#include <BlynkSimpleStream.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "token";

WidgetLED mainLED(V0);

BLYNK_WRITE(V1)
{
  int state = param.asInt();
  
  if(state)
  {
    mainLED.on();
  }
  else
  {
    mainLED.off();
  }
}

void setup()
{
  // Debug console
  //Serial1 .begin(9600);

  // Blynk will work through Serial
  Serial.begin(9600);
  Blynk.begin(auth, Serial);
}

void loop()
{
  Blynk.run();
}

Serial output from the blynk-ser.sh script says it’s connected, but when I press the Button on V1, the LED doesn’t go on. This is the same for both TCP and SSL connections. The server is my home Pi with the ports open (it responds fine to telnet, disconnect on SSL port and opens non-SSL port).

When I add the MAC address of the Wifi board to our Guest network, it works flawless. It can make the connection and responds (superfast I might add!) to the button. Sketch is basically the same, except for library and other Blynk.begin of course.

I used Serial-USB script before, but that was at home with an Arduino Mega. That worked fine, so the only difference is I’m on another network, but all the ports are open just fine (via Wifi works great) and SSL is excluded from the blynk-ser.sh script. Any ideas?

Hey, I just checked it, it works for me.
Please try using latest Blynk from master branch.
I think, no need to disable SSL.
Please post the script output here.

Still nothing… button doesn’t work with the serial-usb. With Wifi it’s fine, so basically the setup is OK.

MacBook-Pro-van-Bastiaan:scripts bastiaan$ ./blynk-ser.sh
       1 ports found. You can specify port manually using -c option
Select serial port [ ]: /dev/cu.wchusbserialfd130
Resetting device /dev/cu.wchusbserialfd130...
Warning: Server connection may be insecure!
[ Press Ctrl+C to exit ]
Connecting: GOPEN:/dev/cu.wchusbserialfd130,raw,echo=0,clocal=1,cs8,nonblock=1,ixoff=0,ixon=0,ispeed=9600,ospeed=9600,crtscts=0 <-> TCP:<url to home>:8442,nodelay
2016/11/14 13:52:55 socat[5766] N opening character device "/dev/cu.wchusbserialfd130" for reading and writing
2016/11/14 13:52:57 socat[5766] N opening connection to LEN=16 AF=2 <externalip>:8442
2016/11/14 13:52:57 socat[5766] N successfully connected from local address LEN=16 AF=2 192.168.115.230:55104
2016/11/14 13:52:57 socat[5766] N starting data transfer loop with FDs [5,5] and [6,6]

So it appears to work, but the LED doesn’t go on. Unfortunately I cannot reach my server at the moment due to a broken Login-Pi at home, so I cannot check the log files on the server.

  1. Does it stay like this, or does it disconnect/reconnect in few seconds?
  2. You use local server - did you specify it in the script or on the command line?
  3. Please re-check auth token.

It stays like this, everything appears to be normal, no messages of “not in network”, but the led just doesn’t flip. I tried the Wifi sketch again to double check, but that works flawless.

-edit

It’s not that big of a deal because I control my own firewall, but I was just wondering how come :slight_smile:

If it stays like this, it means the device is connected and authorized OK.

Yes, exaclty, that is what I found weird. Everything seems to be OK, but it just doesn’t work.

May I ask on what platform you tested? I’m on my MacBook here, but I can try to test it on Windows. Maybe that could make a difference?

It shouldn’t.
I would recommend you to enable prints, send them to SwSerial/Serial1 and debug through prints.
It’s hard to find the black cat in a dark room :wink:

Not in our house, LOL. Anyway, I’ll bring my serial convertor tomorrow and maybe try from the local network tomorrow too. Tnx so far :slight_smile:

Well, it works fine on Windows … just not on Mac OS X :smiley:

You can shoot me now, lol.

wow - could you find more details about this case?

Probably, but not in the near future. I’m kind of done for the time being.

1 Like