Hello Guys , I am totally new with ethernet module with arduino therefore I need extensive help.
My task is:
arduino ide version 1.8.x
1) connecting/configuring the connections with w5500 with arduino uno.
a) how to connect both together not respective with internet but only through ip address
b) please guide which library to use.
c) how to check that module and arduino both are working fine
plus I have checked other topics also in the forum but they didnt help.
2) Connecting oled to work with ethernet shield module
a) what will be the connections
b) code regarding it
c) I want to print few words like up,down,left,right on oled.
That Hanrun thing is not a shield. If it is not a W5500 either, it wouldn't surprise me.
You give no details of the display but, no matter what it is, it can (eventually) work in conjunction with an ethernet facility. This is accomplished by either sharing a bus, or using a separate i/O method.
@Nick_Pyner
This might help, I am using this.
OK, so it is a W5500, but it is not a shield. That said, it is an SPI device and the mystery display isn't, so what's the problem? The display is an I2C device and connects to A4, A5.
@Nick_Pyner
I am totally new to this topic and confused from where to start properly , so I need some step by step guide from connecting w5500 to oled. As I mentioned in my first post.
Will you help me ?
this shows UNO to ENC28J60 connections the W5500 is similar
do a web search for UNO W5500 - you will get plenty of links
most links are for the W5500 shield which plugs into a UNO but the ethernet chip is the same so should help you
try some example programs which come with the W5500 ethernet libraries
once you have the ethernet working move onto the LCD
I'm only familiar with the standard shield and I'm afraid I can't comment. I can only suggest that you use a ribbon cable to connect the module to Uno's icsp cluster, but you still need an extra conductor for CS. Ditching the module for a standard shield is also a pretty good idea. They are pretty cheap and you get an excellent SD slot thrown in at no extra charge.
As I said before, the display is simply connected to power and A4,A5 and has nothing to do with ethernet. Solder on a length of ribbon cable.
don't have the same W5500 module as in post 3 but I do have a Smart Electronics W5500 module
EDIT: updated connections
// W5500 CS UNO 10 SS
// W5500 MI UNO 12 MISO
// W5500 MO UNO 11 MOSI
// W5500 SCK UNO 13 SCLK
// W5500 RST UNO RES
// W5500 VCC UNO 3.3V
// W5500 GND UNO GND
// W5500 INT not connected
using the Ethernet library ran File>Examples>Ethernet>WebServer
serial Monitor output showing WebClient connection from Chrome and Firefox
Ethernet WebServer Example
server is at 192.168.1.177
new client
GET / HTTP/1.1
Host: 192.168.1.177
new client
GET /favicon.ico HTTP/1.1
Host: 192.168.1.177
Connection: keep-alive
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8
Referer: http://192.168.1.177/
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8
client disconnected
new client
GET / HTTP/1.1
Host: 192.168.1.177
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-GB,en;q=0.5
Accept-Encoding: gzip, deflate
DNT: 1
Sec-GPC: 1
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
client disconnected
and Firefox displays
tested Smart Electronics W5500 Ethernet with UNO, Feather 32u4, Due and MKRFOX
// connections UNO, Feather 32u4, Due, MKRFOX
// W5500 CS UNO 10 SS 32u4 D10 10 MKR D5 setup with Ethernet.init()
// W5500 MI UNO 12 MISO 32u4 MISO 14 MKR MISO D10
// W5500 MO UNO 11 MOSI 32u4 MOSI 16 MKR MOSI D8
// W5500 SCK UNO 13 SCK 32u4 SCK 15 MKR SCK D9
// W5500 RST UNO RES not connected
// W5500 VCC UNO 3.3V 32u4 3.3V MKR 3.3V
// W5500 GND UNO GND 32u4 GND MKR GND
// W5500 INT not connected
// DUE is similar to UNO except use SPI pins (not pins 11 12 13)
all work OK
Hi @horace I attempted the webserver example it was easily uploaded and compiled everything seemed fine but when I uploaded the ip address on chrome it kept on reloading and was'nt able to display any output.
I mentioned 192.168.1.177 on google search bar nothing was displayed it kept on uploading.
Serial monitor was'nt opened at same time, firewall was also off.
My connections:
w5500 sclk--13 Uno
w5500 scs--10 Uno
w5500 mosi--11 Uno
w5500 miso--12 Uno
w5500 3.3v--3.3v Uno
w5500 GND--GND Uno
w5500 RST--Res Uno
Output:
the serial monitor output
Ethernet WebServer Example
server is at 192.168.1.177
indicates the W5500 module is initialised and the webserver started on IP 192.168.1.177
enter 192.168.1.177 in the Chrome URL address bar, e.g.
NOT in the google search bar
yes yes, I entered in the chrome URL address bar.
what does Chrome display, e.g.
what is the IP address of you PC? e.g. run CMD and enter ipconfig
C:\Users\xx>ipconfig
Windows IP Configuration
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . : lan
Link-local IPv6 Address . . . . . :XXXXXXXXXXXXXXXXXXXXXXXXXXX
IPv4 Address. . . . . . . . . . . : 192.168.1.178
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.254
Wireless LAN adapter Wi-Fi:
Connection-specific DNS Suffix . : lan
Link-local IPv6 Address . . . . . : xxxxxxxxxxxxxxxxxxxxxxxxxxx
IPv4 Address. . . . . . . . . . . : 192.168.1.68
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.254
Ethernet adapter Bluetooth Network Connection 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Are you sure Uno is up to providing enough 3.3v to the W5500?
@Nick_Pyner I checked with multimeter it is giving 3.26-3.28v around. Is that fine ?
appears to power my W5500 module OK (and a ENC28J60 - not at same time)
I suspect the IP address 192.168.1.177 is not accessable by the host network
a ipconfig print out would display the host IP address
otherwise consider DHCP
@horace
IP address of my PC
Wireless LAN adapter Local Area Connection* 1:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Wireless LAN adapter Local Area Connection* 2:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Ethernet adapter Ethernet:
Connection-specific DNS Suffix:
Link-local IPv6 Address . . . . . : xxxxxxxxxxxxxxxxxxxxxxxxx
IPv4 Address. . . . . . . . . . . : 192.168.7.110
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . :
Wireless LAN adapter WiFi:
Connection-specific DNS Suffix . :
Link-local IPv6 Address . . . . . : xxxxxxxxxxxxxxxxxxxxxxxx
IPv4 Address. . . . . . . . . . . : 192.168.1.117
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
start with ping from your pc to 192.168.1.177 - does that work?
if so - try http://192.168.1.177 in the addressbar
try running File>Examples>Ethernet>DhcpAddressPrinter
what is displayed on the serial monitor?
try the following W5500 webserver which uses DHCP to get the IP address
/* W5500 Ethernet Web Server using DHCP
using the Ethernet library ran File>Examples>Ethernet>WebServer
A simple web server that shows the value of the analog input pins.
using an Arduino WIZnet Ethernet shield.
Circuit:
* Ethernet shield attached to pins 10, 11, 12, 13
* Analog inputs attached to pins A0 through A5 (optional)
created 18 Dec 2009
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe
modified 02 Sept 2015
by Arturo Guadalupi
*/
// connections UNO, Feather 32u4, Due, MKRFOX
// W5500 CS UNO 10 SS 32u4 D10 10 MKR D5 setup with Ethernet.init()
// W5500 MI UNO 12 MISO 32u4 MISO 14 MKR MISO D10
// W5500 MO UNO 11 MOSI 32u4 MOSI 16 MKR MOSI D8
// W5500 SCK UNO 13 SCK 32u4 SCK 15 MKR SCK D9
// W5500 RST UNO RES not connected
// W5500 VCC UNO 3.3V 32u4 3.3V MKR 3.3V
// W5500 GND UNO GND 32u4 GND MKR GND
// W5500 INT not connected
// NOTES:
// DUE is similar to UNO except use SPI pins (not pins 11 12 13)
// says "Ethernet cable is not connected." but works OK - see fix in setup()
// ESP32 gives compile time errors
#include <SPI.h>
#include "Ethernet.h"
// Enter a MAC address and IP address for your controller below.
// The IP address will be dependent on your local network:
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
// Initialize the Ethernet server library
// with the IP address and port you want to use
// (port 80 is default for HTTP):
EthernetServer server(80);
void setup() {
// You can use Ethernet.init(pin) to configure the CS pin
//Ethernet.init(10); // Most Arduino shields - Feather 32u4
//Ethernet.init(5); // MKR ETH Shield
//Ethernet.init(0); // Teensy 2.0
//Ethernet.init(20); // Teensy++ 2.0
//Ethernet.init(15); // ESP8266 with Adafruit FeatherWing Ethernet
//Ethernet.init(5); // ESP32 with Adafruit FeatherWing Ethernet
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("Ethernet WebServer Example");
// start the Ethernet connection:
Serial.println("Initialize Ethernet with DHCP:");
if (Ethernet.begin(mac) == 0) {
Serial.println("Failed to configure Ethernet using DHCP");
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
} else if (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is not connected.");
}
// no point in carrying on, so do nothing forevermore:
while (true) {
delay(1);
}
}
// print your local IP address:
Serial.print("My IP address: ");
Serial.println(Ethernet.localIP());
}
void loop() {
// listen for incoming clients
EthernetClient client = server.available();
if (client) {
Serial.println("new client");
// an HTTP request ends with a blank line
bool currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
Serial.write(c);
// if you've gotten to the end of the line (received a newline
// character) and the line is blank, the HTTP request has ended,
// so you can send a reply
if (c == '\n' && currentLineIsBlank) {
// send a standard HTTP response header
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close"); // the connection will be closed after completion of the response
client.println("Refresh: 5"); // refresh the page automatically every 5 sec
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
// output the value of each analog input pin
for (int analogChannel = 0; analogChannel < 6; analogChannel++) {
int sensorReading = analogRead(analogChannel);
client.print("analog input ");
client.print(analogChannel);
client.print(" is ");
client.print(sensorReading);
client.println("<br />");
}
client.println("</html>");
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
} else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
// give the web browser time to receive the data
delay(1);
// close the connection:
client.stop();
Serial.println("client disconnected");
}
}
serial monitor displays
Ethernet WebServer Example
Initialize Ethernet with DHCP:
My IP address: 192.168.1.177
new client
GET / HTTP/1.1
Host: 192.168.1.177
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
Referer: http://192.168.1.177/
Accept-Encoding: gzip, deflate
Accept-Language: en-GB,en-US;q=0.9,en;q=0.8