I have followed this tutorial to test video streaming over WiFi, and it worked.
Now, I am trying to do the same over W5500 instead of WiFi. This is my wiring:
ESP32-CAM to W5500:
GPIO12 -> MISO
GPIO13 -> MOSI
GPIO14 -> SCLK
GPIO2 -> SCS
GND -> GND
5V -> V
I found this library to get a basic connection over Ethernet, but the example provided there didn't work, so I removed everything to bare bones to identify the issue:
Code: Select all
#include <SPI.h>
#include <EthernetSPI2.h>
byte mac[] = {0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
byte ip[] = {192, 168, 1, 15};
byte gateway[] = {192, 168, 1, 254};
byte subnet[] = {255, 255, 255, 0};
EthernetServer server(80);
void setup()
{
Serial.begin(115200);
Ethernet.init(2);
Ethernet.begin(mac, ip, gateway, subnet); //start Ethernet
// Check for Ethernet hardware present
if (Ethernet.hardwareStatus() == EthernetNoHardware) {
Serial.println("Ethernet shield was not found. Sorry, can't run without hardware. :(");
while (true) {
delay(200);
}
}
while (Ethernet.linkStatus() == LinkOFF) {
Serial.println("Ethernet cable is NOT connected.");
delay(500);
}
Serial.println("Ethernet cable is now connected.");
Serial.print("localIP: ");
Serial.println(Ethernet.localIP());
Serial.print("subnetMask: ");
Serial.println(Ethernet.subnetMask());
Serial.print("gatewayIP: ");
Serial.println(Ethernet.gatewayIP());
Serial.print("dnsServerIP: ");
Serial.println(Ethernet.dnsServerIP());
}
void loop()
{
}
As you can see, the W5500 connection checks passed, but for some reason IP is 0.0.0.0. I googled this and it always seems to be a hardware issue, but in my case I am 100% I wired everything correctly, and I checked with multimeter between ESP and W5500 pins to ensure I have continuity everywhere, no bad pins or anything. I also tried supplying 5V external power from PSU to all devices, but it didn't make any difference. I also tried supplying a different IP (192.168.2.15) so it doesn't clash with my home WiFi that the laptop is connected to, but it didn't help either.rst:0x1 (POWERON_RESET),boot:0x1b (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0030,len:4832
load:0x40078000,len:16460
load:0x40080400,len:4
load:0x40080404,len:3504
entry 0x400805cc
Ethernet cable is now connected.
localIP: 0.0.0.0
subnetMask: 0.0.0.0
gatewayIP: 0.0.0.0
dnsServerIP: 192.168.2.254
For testing, I tried removing W5500, and then I get "can't run without hardware", and if I unplug the Ethernet cable from the laptop, I get "Ethernet cable is NOT connected"), meaning ESP can see everything up to the laptop, so it shouldn't be a hardware problem.
Can anyone help me solve this issue? And afterwards, when it's solved, how do I adapt the live streaming server sketch (found in Arduino IDE -> File -> Examples -> ESP32 -> Camera -> CameraWebServer) to stream over this Ethernet connection rather than WiFi? Am I even going in the right direction here?