HowTo: 'hard' ethernet link - Arduino to RPi Blynk Server

OK, am fighting the good fight…

Have a local Blynk Server set up, a basic ‘button’ app intended to flash an LED on an Arduino Mega (pin 50) - this is another question…

I’ve also gotten the sample LED_Blynk to compile nicely with library references to Ethernet2 - needed, as we are using the W5500 ethernet shield.

machines on our 192.168.42.0 subnet see the Blynk server (10.0.0.102) just fine; Admin interface, pings, etc. working, as is the iPhone App connection.

So, am trying to connect the Arduino-with-LED on this subnet, using something like this (I see that dns is already declared, so have renamed it:

Below is my slightly-modified LED_Blink sketch:

// LOU: This is the problem. dns is already declared in the ethernet library.
byte mac = {
0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED
};
// LOU MOD: for local network:
IPAddress ip(192, 168, 42, 77);
byte dnsServer = { 192, 168, 42, 1 };
byte gateway = { 192, 168, 42, 1 };
byte subnet = { 255, 255, 255, 0 };

WidgetLED led1(V50);

SimpleTimer timer;

void setup()
{
Serial.begin(9600); // See the connection status in Serial Monitor
Ethernet.begin(mac, ip, dnsServer, gateway, subnet);

// LOU NOTE: Blynk ‘vanilla’ apparently presumes DHCP connection
// Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud.
// LOU NOTE: try this for local server auth
Blynk.begin(auth, IPAddress(10,0,0,102), 8443);

Only evidence of networking is ‘DHCP failed!’ How to explicitly use a ‘hard’ IP address?

Problem: I see no evidence in Blynk server log that the Arduino is even attempting a connection. I must believe my network setup is incorrect. Help!

Follow on: is my declaration of Pin 50 on the Arduino Mega as simple as above?

Just checked my Mega and I think it has the full complement of 128 virtual pins without any mods to the library. So V50 for virtual LED should be OK.

The port you need is 8442 not 8443 unless you have made some mods along the line.

How have you connected the 2 subnets? Guess if they can see each other you should be OK.

For reference I don’t have any Ethernet.begin, just this:

Blynk.begin(auth, "blynk-cloud.com", 8442, arduino_ip, dns_ip, gateway_ip, subnet_mask, arduino_mac);

Costas - Tks for getting back to me on this…

Have tried your 8442 suggestion - could it be this easy?; I had only tried that because various ‘examples’ floating around indicated 8443 - the App Server - was the auth port. Anyway, No Joy on 8442.

I should lay the groundwork first…

Am attempting all this using a W5500 ‘breakout board’ (which occludes all the pins on Arduino Uno) So I’m trying it on the Mega, which has all those other nice extra digital pins!

I’m only calling Ethernet.begin() as I assumed I’d need this to solidly declare the W5500’s ethernet address; anything on the 192.168.42.0 'net.

Blynk Server is running on a RaspBerry Pi, at 10.0.0.102. Each device has a route to/is able to ping the other.

In addtion, the BlynkBlink demo uses pin 9, which the W5500 board needs for ethernet itself.

Kinda dead in the water here!

Server log startup indicates:

2016-10-10 15:32:50.673 INFO - Hardware plain tcp/ip server listening at 8442 port.
2016-10-10 15:32:50.678 INFO - Hardware SSL server listening at 8441 port.
2016-10-10 15:32:50.680 INFO - Application server listening at 8443 port.
2016-10-10 15:32:50.681 INFO - HTTP API server listening at 8080 port.
2016-10-10 15:32:50.683 INFO - HTTPS API server listening at 9443 port.
2016-10-10 15:32:50.685 INFO - HTTPS Admin UI server listening at 7443 port.
2016-10-10 15:32:50.686 INFO - Web Sockets server listening at 8082 port.
2016-10-10 15:32:50.688 INFO - Web SSL Sockets server listening at 8081 port.
2016-10-10 15:32:50.690 INFO - Mqtt hardware server listening at 8440 port.

and I do get reasonable-looking output when connecting from iPhone app.

(aside: I also just realized that server reads even my backup properties files - not good! My editor is set to produce backups like server.properties~. Yikes!)

99% sure you need port 8442.

Can’t you put the Pi on the 192.168.42.0 subnet?

Correction, 100% sure.

You can try changing the MAC address, just change a couple of Hex digits. E.g. make A into F, 0 into 5. Some routers and DHCP servers can get grumpy when you do too much requests or from multiple MAC addresses on a single port. Also rebooting the router/modem might help to clear the ARP cache and all MAC address related caches.

If you can reach the 10.x.x.x network from the 192.168.42.x and vice versa I assume you have a router installed between the networks and not some sort of NAT firewall, right?

the 10.x.x.x. net is served up by its own access point; its point is mostly to provide wireless to a handful of devices, which enjoy back and forth among subnets, and out/in to the WAN. I don’t think this is an IP filtering/firewalling issue - but I infer your point…

Will try your MAC address idea…

To avoid confusion I can highly recommend integrating the AP into the normal network. e.g. give it a static 192.168.42.x address or set it up transparantly to pass along DHCP requests to connecting devices from the main router :slight_smile:

Sure, that would seem the obvious short-term solution… But not possible for the next week, at least.

In any case, this isn’t the goal. I’d like to prove out hard-wired IP addresses from Arduino to a RaspBerryPi running Blynk Server.

I do realize that there are a few variables in the mix; because I’m using a W5500, the Ethernet2 library is in play. But isn’t there a solid set of examples on using hard IP addresses? Or some switch to be sure DHCP isn’t in use? Or are you saying that DHCP is a requirement?

You can check out the Manual Connection example. I think it has full disclosure of how to set a hard IP on your hardware.