ISO help troubleshooting Arduino Mega <--> Blynk local server connectivity

I’m unsure how much topology info is needed so I’ll give some basics, then specify what I’m looking to figure out in what I think is next step.

Basically, I have a remote router that routes 192.168 65.X (arduino Mega at 192.168 65.3) across a tunnel (VPN) into my home location. My local server resides at 192.168.155.65. My local server is an image of MPHERG/BLYNK-SERVER residing within Docker on a Synology NAS DS218+. The two networks route between eachother. “Layer3” is good. A Firewall resides between the networks and I see this FW logging, recurring:

6 Jul 06 2020 11:41:31 302013 192.168.65.3 49797 192.168.155.65 8080 Built outbound TCP connection 213891 for DMZ_155:192.168.155.65/8080 (192.168.155.65/8080) to CABIN:192.168.65.3/49797 (192.168.65.3/49797)

6 Jul 06 2020 11:41:32 302014 192.168.155.65 8080 192.168.65.3 49797 Teardown TCP connection 213891 for DMZ_155:192.168.155.65/8080 to CABIN:192.168.65.3/49797 duration 0:00:00 bytes 42 TCP FINs

Above log basically confirms that I’m building a connection between Arduino and NAS port 8080… I failed to mention, but my 8080 port is forwarded to the Blynk port 8080 within docker/Blynk instance.

From my PC, I’m able to log into ‘Blynk admin’ at https 192.168.155.65:9443

This leads me to believe the server side is halfway working (correct my assumption if I’m wrong). Oddly, when I enter “http://192.168 155.65:8080” into my chrome browser I get forwarded to ‘blynk io’. I technically don’t understand this… If someone could shine light here, great. Not likely the main issue I’m facing, but I’d like to understand this…

The next step I want is some debugging–either side (server or mega). My logs on server side are basically empty as far as I can tell, but I’m happy they’re being created. Want I want is logs from the Mega. I’m using Arduino software 1.8.13, and from below sketch, only get a ‘IP = 192.168.65.3’ written to Serial Monitor. From my sketch (below), it seems I have it configured to Blynk_Print and Blynk_Debug output… This is what I’m directly tshooting at the moment–why is nothing 'Blynk specific" sent to terminal?

Thanks in advance for reading this… I really hope I haven’t overlooked something obvious, but this does happen sometimes. I’m new to having an account here, but have been searching for the solution with keywords on www without luck. I’m fairly strong with IP networks technically, but not so strong with higher layers (especially applications or OS’s). Regardless, I’m stuck–any assistance/ideas are appreciated.

–Jared

My sketch:

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "this was generated from my phone Blynk app";

#define W5100_CS  10
#define SDCARD_CS 4
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG Serial

byte arduino_mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0x99, 0x00};
IPAddress arduino_ip (192, 168, 65, 3);
IPAddress dns_ip (192, 168, 255, 3);
IPAddress gateway_ip (192, 168, 65, 254);
IPAddress subnet_mask (255, 255, 255, 0);

void setup() {
  Serial.begin(9600); //debug console
  pinMode(SDCARD_CS, OUTPUT);
  //digitalWrite(SDCARD_CS, HIGH); // Deselect the SD card

  // initialize the ethernet device
  Ethernet.begin(arduino_mac, arduino_ip, dns_ip, gateway_ip, subnet_mask);
  Ethernet.setDnsServerIP(dns_ip);
  //print out the IP address
  Serial.print("IP = ");
  Serial.println(Ethernet.localIP());

  // You can also specify server:
  Blynk.begin(auth, "192.168.155.65", 8080, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);
  //Blynk.begin(auth, IPAddress(192,168,155,65), 8080);
  // For more options, see Boards_Ethernet/Arduino_Ethernet_Manual example


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

@J_red please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

Updated. Thanks.

In my quest to ‘blynk_print’ and ‘blynk_debug’, the arduino is now powered by wall wort… In my stumped state, I’ll try anything. Nothing changed. I question my blynk library–whether it’s corrupt, or even being “run” by my sketch. I did revert to an older version… No change, then went back to current version. The “blynk.begin” looks to be executed because I’m seeing the tcp loging across firewall. I may simplify by placing a PC on same network as the arduino, but I can’t imagine this allows me to print/debug anything–seem the two issues aren’t related. Just updating the thread as changes happen.

I’m a bit confused by the fact that you’re initialising your own Ethernet connection, then asking Blynk to do the same with the Blynk.begin command.
Normally, you’d do one or the other.

Pete.

I tested by commenting out the ‘Ethernet.begin’ line, leaving only first ‘Blynk.begin’ and lost connection–specifically, the router doesn’t know of arduino eth int in arp table. No com.

2nd step, enabled ‘Ethernet.begin’ and disabled first ‘Blynk.begin’ and regained arp entry (IP connection to arduino), but lost logs indicating it attempting com to server.

3rd step, enabled ‘Ethernet.begin’ and enabled second ‘blynk.begin’. Same status as 2nd step.

Having both ‘ethernet.begin’ and first ‘blynk.begin’ lines enabled provides most communication, although not enough! I really like seeing the logs informing that a arduino source address is attempting com tcp8080 with blynk server. The blynk server responds too.

As I mentioned, I’m not versed in programming… I’ve studied different languages in the 90’s, and some of it applies, but I mostly rely on others’ work. From what I have in my sketch, I thought the ‘ethernet.begin’ applied to the 5100 ethernet shield… and the ‘blynk.begin’ was application specific. This logic may be flawed, but since I was seeing tcp traffic, this wasn’t my focus. My focus is troubleshooting non-existent blynk debugging in the serial monitor. I have no idea why I don’t see this. The IP prints, but I get nothing blynk specific. Because three lines enables it, it seems like low hanging fruit to tshoot, but not sure next best step? Possibly need to reinstall libraries, but don’t know of best way of doing this.

Aside from this ‘blynk serial’ troubleshooting, I’m concerned about my sequence of blynk installation. I began by installing blynk app on my phone, registering, then generating a ‘auth’ for my PC usb serial connected arduino mega. I then worked at getting my mega connecting to blynk cloud, but didn’t like the translations involved in doing this, and preferred the advantages of local server. So I’m unsure of that auth applies to my local server… and this is the reason I want some kind of debugging–hoping it would help. So I’m missing some fundamental stuff, but learning things, nonetheless! Thanks for your help. I plan to keep reading and banging away at it… Have a good one!

I think this would be a good starting point…

https://docs.blynk.cc/#troubleshooting

As you’ll see, Blynk.begin is a multi-function process which does everything.
As you’re doing part of the process then Blynk.config and Blynk.connect may be a better choice.

If you log on to the server console you’ll be able to view the Auth code(s) for your project.
You should probably also check the project connection type in your app, to ensure that you have Ethernet chosen.

Pete.

Reading good.

After directing phone app to local server, then regenerating auth, appying auth to arduino, it works. I’m able to change an output state on the board. Really cool.

I have no idea why serial output doesn’t display blynk msg/debugging, and question the unnecessary config pointed out by Pete that doesn’t make sense either. Unsure whether the debugging logs that would be generated would have directed me to the problem sooner… I’m a guy that learns mostly by fixing things, so I plan to proceed with my project–and will learn as I go.

Thanks for your help, Pete. You were/are a big help. The link you sent was helpful too (I had seen it in the past, but info (noise) overload often trigger TLDR… Although that link is to valuable info–good study info for anyone familiarizing themselves.

I’m pretty excited to advance with SCADA at a remote (cell WAN only) cabin… I think the hardware/software (arduino/Blynk) has lots of potential. Having my server local on Synology NAS comes with many benefits too–mostly that the data will be stored on my property. I plan to look deeper into the security aspects, but expect it to be relatively secure vs cloud.

Take care! I’ll be around.

1 Like