Giter Club home page Giter Club logo

esp32_w5500_gw's Introduction

ESP32_W5500_GW

An MQTT ESP-Now Gateway -- Using the W5500 module to create a hardwired ethernet connection

== WARNING ==

This is an alpha version of this code,released here in the hope that it will help others to get the basic hardware (ESP32 + WizNet W5500 Ethernet module) working.

Son-of-the-warning

The original ESP8266 version of this project timed-out and crashed when configured to use DHCP rather than a hard-coded IP. I would recommend you stick with a hard-coded IP for initial testing, as I haven't tried DHCP at all, yet (let me know how it goes if you do).

== LICENCE NOTE ==

Because this version of the code is released complete with Hristo Gochkov's SPI library (see lib directory), it is also released under the same GNU Lesser 2.1 licence. Later versions will probably be released without the library and under a different licence.

The code

This is a PlatformIO build (and if you haven't tried PlatformIO yet, you really should, it's great!), but is easily adapted to the Arduino IDE, if that happens to be your weapon of choice.

Under PlatformIO, the platformio.ini file will automatically download and install the correct Ethernet and PubSubClient libraries for you when you type "pio run" for the first time. The SPI library is already shipped in the lib directory, as that particular version wasn't generally available when I originally wrote the code (and it contains a coule of fixes essential to the ESP32 platform).

What does it do?

At the moment, this is simply something to get you going with the ESP32 and the W5500 module. It doesn't do anything much more than initialize the module and make an initial connection to your MQTT server (broker).

It does have some clunky hardware checks in the start-up code, so pay attention to the serial output from your ESP32 when you first run it; it will try to guide you to solutions for simple hardware issues.

You should be able to build on this code to implement any of the client/server samples in the /examples directory of the Ethernet library.

Practical notes

This was written with the specific intention of building an ESP-Now to MQTT gateway, so there is no code on the ESP32 side for authenticating with or joining a local WiFi network (the premis of ESP-Now is that it is a fast, point-to-point connection without all of the niceties, or overhead, of a full WiFi network connection). Adding back the WiFi stuff is extremely easy (basically, look at any networked, non-ESP-Now code and copy it).

Don't ask me where you should input your access-point logon credentials. :-)

The physical connections between the ESP32 and W5500 are different, but simpler than the ESP8266 version (you don't need to buffer SCS chip-select signal on the ESP32).

  • GPIO23 <--> MOSI
  • GPIO19 <--> MISO
  • GPIO18 <--> SCLK
  • GPIO5 <--> SCS
  • GPIO26 <--> RESET

As always, you do need a good solid DC supply for both boards and a good ground connection between them in addition to the data lines listed above.

esp32_w5500_gw's People

Contributors

pucebaboon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

kingvei skalentev

esp32_w5500_gw's Issues

It does not compile

Hi, I just pulled the complete repo and tried to build it.

It gets some weird errors in regards with the Ethernet Library.

In file included from .piolibdeps\Ethernet_ID872\src\EthernetClient.cpp:22:0: .piolibdeps\Ethernet_ID872\src\Ethernet.h:258:2: error: invalid abstract return type 'EthernetClient' EthernetClient available(); ^ .piolibdeps\Ethernet_ID872\src\Ethernet.h:214:7: note: because the following virtual functions are pure within 'EthernetClient': class EthernetClient : public Client { ^ In file included from C:\users\dan\.platformio\packages\framework-arduinoespressif32\cores\esp32/Arduino.h:157:0, from .piolibdeps\Ethernet_ID872\src\EthernetClient.cpp:21: C:\users\dan\.platformio\packages\framework-arduinoespressif32\cores\esp32/Client.h:31:17: note: virtual int Client::connect(IPAddress, uint16_t, int) virtual int connect(IPAddress ip, uint16_t port, int timeout) =0; ^ C:\users\dan\.platformio\packages\framework-arduinoespressif32\cores\esp32/Client.h:32:17: note: virtual int Client::connect(const char*, uint16_t, int) virtual int connect(const char *host, uint16_t port, int timeout) =0; ^ In file included from .piolibdeps\Ethernet_ID872\src\EthernetClient.cpp:22:0: .piolibdeps\Ethernet_ID872\src\Ethernet.h:259:2: error: invalid abstract return type 'EthernetClient' EthernetClient accept(); ^ In file included from .piolibdeps\Ethernet_ID872\src\EthernetServer.cpp:22:0: .piolibdeps\Ethernet_ID872\src\Ethernet.h:258:2: error: invalid abstract return type 'EthernetClient' EthernetClient available();

Any hints will be welcomed :)

Cheers o/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.