Just bought 2 w5500 modules for 2 uno’s using cat 5e cable to connect. Used example for send/receive string to see what results. Changed Mac in second uno upload as suggested somewhere, Hoping that was sensible. No ‘Ethernet cable detected’. Checked cable with tester and ‘‘twas ok. Have used Ethernet at home for sky box, ps4 and computers, hence many cables and tester available.
There seems to be confusion on the forum and internet whether the cable should be cross-over type or not.
I need to pass a short message/notification from the front of my house to the rear. The front where I am and the rear where a 12v rain detector is (about 35 feet).
I’ve tried RF, CAN, Bluetooth and Arduino cloud to no avail, for range and connectivity reasons.
Ethernet is my last hope. You would think this project would be straight forward but apparently not, I’ve tried with several examples and read many posts, mainly to get a better understanding of what is needed.
Any suggestions on how I might achieve my goal will be greatly appreciated. Ignorance is not bliss, it’s b***** frustrating.
Thanks, Chris
Thanks for advice which I’ve taken in that made and tested crossover cable. Used the link status sketch which confirmed ‘link on’.
Trying to use client & server TCP tutorial sketch but cannot configure boards. Sketch suggests change to server address given in #1 client sketch ie 192.168.0.180. This is shown on serial monitor as o.o.o.o.
There is no connection to home network, wifi or internet. Just Ethernet cable between uno’s.
I only need a one off msg to be passed from one to the other. I’m sure I can take it from there.
Sorry if I’m being a pain. Let me know and I’ll stop bothering you.
Thanks for your patience and kindness.
Chris
Ethernet is a serial connection, so you cannot connect Tx to Tx and Rx to Rx directly. To address this, you need to swap the connections, which is the purpose of a crossover cable it connects the Tx lines on one device to the Rx lines on the other.
When you connect to a switch, hub, or router, this function is typically built into the device and transparent to the user. Many modern Ethernet devices have Auto-MDI/MDI-X functionality, which automatically detects the cable type and adjusts the port configuration accordingly, eliminating the need for a crossover cable. The ports are internally configured based on what is plugged in.
I recommend using an IP range within Class C (192.168.0.0 – 192.168.255.255), which provides about 65,000 addresses—ideal for small private networks. These addresses are reserved for internal use and won’t conflict with devices on the internet.
Typically, 192.168.1.x or 192.168.0.x ranges are used, with 192.168.1.1 or 192.168.0.1 being assigned to your router. Avoid using these addresses for other devices to prevent conflicts, as well as any other addresses already in use.
The safest and easiest option is to enable DHCP (Dynamic Host Configuration Protocol) on your router. This allows your router to assign IP addresses automatically to devices on the network. You can then print out or check the assigned IP address from your device or router interface for reference.
Thanks to everyone for their assists and advice. I managed to get a result that suits, not with Ethernet yet but near where I started, with client and server wifi and 2 uno r4 wifi boards. I was able to pass 0’s and 1’s which act as true and false or yes and no. As well as an LED and Buzzer at the press of a Button. Server at the front of the house and client at the back, about 15 meters. Used Arduino tutorial for communication between 2 uno boards with a few tweaks, like you do.
I need now to merge the rain detection part with the new code, in place of button presses and maybe add an LCD message too.
When I’m done I’ll publish the code etc for other noobies to consider.
Thanks again and good luck.
Chris.
Has anyone successfully managed to get 2 w5500 modules to communicate directly via Ethernet?
I’ve been researching and trying for a few weeks now but so far unresolved. The Arduino get started tutorials regarding this have examples for of client/server direct communication in both wifi and Ethernet.
I’m successfully using the wifi version but can’t get the Ethernet examples to work at all.
There are many topics and queries on our forum and others about this but no one seems to have cracked it yet.
Unless, you have or know someone who has, in which case have mercy and please tell.
Many thanks, Chris
Hi, thanks for replying. Communicate between 2 uno's with w5500 modules connected by crossover cat 5e cable. I require simple string or variable to be passed from Client to Server 15m apart in different rooms to let me know rain status as I do astrophotography while watching tv with my wife.
I'm doing this with wifi but wanted to know how to do it with ethernet.
So I'm hoping someone has already achieved this.
Any help will be appreciated.
Chris
The sketches being used: https://arduinogetstarted.com/tutorials/communication-between-two-arduino. Ethernet Client & Server. Changed mac address only.
serial port reports: TCP Server IP address: 0,0,0,0
So the two never link up.
I have Sky Broadband with router hardwired to SkyQ primary box and secondary. Also wirelessly connected to 2 ipads and computer as and when required.
Thanks for suggesting posting.
Chris
Here is the code I'm using:
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/tutorials/communication-between-two-arduino
*/
// ARDUINO #1: TCP CLIENT + A BUTTON/SWITCH
#include <ezButton.h>
#include <SPI.h>
#include <Ethernet.h>
const int BUTTON_PIN = 7;
const int serverPort = 4080;
ezButton button(BUTTON_PIN); // create ezButton that attach to pin 7;
byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x03};
IPAddress serverAddress(192, 168, 0, 48);
EthernetClient TCPclient;
void setup() {
Serial.begin(9600);
button.setDebounceTime(50); // set debounce time to 50 milliseconds
Serial.println("ARDUINO #1: TCP CLIENT + A BUTTON/SWITCH");
// Initialize Ethernet Shield:
if (Ethernet.begin(mac) == 0)
Serial.println("Failed to configure Ethernet using DHCP");
// connect to TCP server (Arduino #2)
if (TCPclient.connect(serverAddress, serverPort))
Serial.println("Connected to TCP server");
else
Serial.println("Failed to connect to TCP server");
}
void loop() {
button.loop(); // MUST call the loop() function first
if (!TCPclient.connected()) {
Serial.println("Connection is disconnected");
TCPclient.stop();
// reconnect to TCP server (Arduino #2)
if (TCPclient.connect(serverAddress, serverPort))
Serial.println("Reconnected to TCP server");
else
Serial.println("Failed to reconnect to TCP server");
}
if (button.isPressed()) {
TCPclient.write('1');
TCPclient.flush();
Serial.println("- The button is pressed, sent command: 1");
Serial.println(serverAddress);
}
if (button.isReleased()) {
TCPclient.write('0');
TCPclient.flush();
Serial.println("- The button is released, sent command: 0");
}
delay(500);
}
/*
* Created by ArduinoGetStarted.com
*
* This example code is in the public domain
*
* Tutorial page: https://arduinogetstarted.com/tutorials/communication-between-two-arduino
*/
// ARDUINO #2: TCP SERVER + AN LED
#include <SPI.h>
#include <Ethernet.h>
const int LED_PIN = 7;
const int serverPort = 4080;
byte mac[] = {0x00, 0xAA, 0xBB, 0xCC, 0xDE, 0x02};
EthernetServer TCPserver(serverPort);
void setup() {
Serial.begin(9600);
pinMode(LED_PIN, OUTPUT);
Serial.println("ARDUINO #2: TCP SERVER + AN LED");
// Initialize Ethernet Shield:
if (Ethernet.begin(mac) == 0)
Serial.println("Failed to configure Ethernet using DHCP");
// Print your local IP address:
Serial.print("TCP Server IP address: ");
Serial.println(Ethernet.localIP());
Serial.println("-> Please update the serverAddress in Arduino #1 code");
// Listening for a TCP client (from Arduino #1)
TCPserver.begin();
}
void loop() {
// Wait for a TCP client from Arduino #1:
EthernetClient client = TCPserver.available();
if (client) {
// Read the command from the TCP client:
char command = client.read();
if (command == '1') {
Serial.print("- Received command: ");
Serial.println(command);
digitalWrite(LED_PIN, HIGH); // Turn LED on
} else if (command == '0') {
Serial.print("- Received command: ");
Serial.println(command);
digitalWrite(LED_PIN, LOW); // Turn LED off
}
delay(500);
Ethernet.maintain();
}
}
Your two or more topics on the same or similar subject have been merged.
Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.
Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.
Repeated duplicate posting could result in a temporary or permanent ban from the forum.
Could you take a few moments to Learn How To Use The Forum
It will help you get the best out of the forum in the future.
You might want to use fixed IP addresses, but that part is not initialized in your code. Or you might want to send raw frames, but that is not done in the code either.
I apologise for unintended duplication of post and for any seeming discourtesy. I have read the guidelines of do’s and don’t as you suggested. They are quite long but I will do my best to keep within them.
Thanks for your time and effort.
Chris
Thanks zwieblum, sounds though, wrong code for what I’m trying to do. I will try and give better details next time I need help.
I’ll also follow up on your advice.
As I’ve said before ignorance is not bliss it’s very frustrating.
Thanks again,.
Chris
Good question Perry, but I don’t know the output and the spec is scant. I have linked the detector to 12v lamp and buzzer and from those get whether power is on or off via an optocoupler link to a UNO R4 wifi pin. I have successfully sent msg to another UNO R4 wifi in another room by wifi and there a buzzer and LCD screen.
I just wanted to learn how to do it by Ethernet.
So much to learn and at 77 it’s not easy.
More research and investigation needed.
A link to the detector would help, by which I mean to where you bought it or some kind of specification for it, along with how you wired it.
So do you want to learn how to communicate via ethernet or how to communicate the output from the detector from one place to another? They are different questions with, quite possibly, very different answers (as I hinted in my previous reply).