logo elektroda
logo elektroda
X
logo elektroda

ESP32 with Ethernet - Compatible with ESPHome.

DewastatorLampowy 4149 11

TL;DR

  • A custom ESP32 WROOM-32UE weather-station motherboard adds Ethernet, irrigation control, and sensor expansion for Home Assistant and ESPHome.
  • The design uses a LAN7820 Ethernet PHY, MIC4684 inverter, TE 2301994-2 socket with integrated signal transformer, and an optional LTC4311 I2C amplifier footprint.
  • ESP32 compatibility makes the board fully usable with ESPHome, and the provided YAML runs the PHY for easy Home Assistant integration.
  • Active PoE was abandoned because it needed expensive extra parts, a suitable switch, weaker PHY protection, and Chinese passive PoE splitters cost about $3.5.
Generated by the language model.
ADVERTISEMENT
Treść została przetłumaczona polish » english Zobacz oryginalną wersję tematu
📢 Listen (AI):
  • PCB with ESP32 and LAN7820 Ethernet connector. .

    Hi,

    As the summer season is approaching, I have decided to build a weather station (or rather a "motherboard" for it) to control the irrigation system and also to allow a quick view of current parameters such as temperature, humidity or pressure, with the possibility of extending the functionality.

    For a while I was looking for ready-made solutions - the most suitable for me were Olimex and LILYGO modules available for about $20-25 with active PoE to which I would attach individual sensors. However, they lacked screw connectors for easy connection of further sensors, which prompted me to make my own board (something like a mother board with such connectors). At some point I thought: since I would have to design a PCB anyway, why not make my own solution and learn something in the process?

    This is how the first version of the design and the first PCB came about, which initially included an active PoE circuit on the LTC4267. I eventually abandoned it for a number of reasons, which led to the development of a second version - the one I am presenting now.

    Schematic:
    Circuit diagram of a motherboard with ESP32 and LAN7820. .

    I chose the ESP32 WROOM-32UE as the main CPU, which takes up less board space due to the lack of an antenna, which I don't need anyway. The downside of this is the slightly increased price of the ESP32 WROOM compared to the regular ESP32. In addition, the use of ESP32 ensures full compatibility with ESPHome, making it much easier to integrate everything into the Home Assistant. The LAN7820 chip (schematic copied from the internet), also chosen for its ESPHome compatibility, is responsible for Ethernet communication.

    The inverter is based on the MIC4684, which I just happened to have on hand. It provides up to 2A of current, which is more than enough for my needs. The chip can be powered at up to 32V, which allows you to use a higher voltage than the standard 5V - useful when using passive PoE splitters.
    Why did I abandon active PoE? For several reasons:
    1. cost, active PoE requires quite a lot of additional components, such as an isolated DC-DC converter, a special MagJack or a signal transformer. These components alone cost more than all the rest of the circuitry on the board.
    2. requires a suitable switch.
    3. in the first version, the PHY chip was not sufficiently protected, which resulted in its failure after several connections and disconnections of the Ethernet cable - a known problem in PoE solutions.
    4. On Chinese portals you can buy an active PoE splitter with an isolated 12V output for about $3.5 - about the cost of the flyback transformer alone for me.

    As an Ethernet socket, I chose the 2301994-2 from TE, which has an integrated signal transformer, simplifying the PCB design. It is not one of the cheapest, but I managed to get some at a good price.
    The last thing worth discussing is the I2C amplifier, based on the LTC4311, this is optional, but it costs nothing to put a footprint on the PCB and can be useful when you want to connect devices/sensors that are a little further away.


    If anyone would be interested I provide a link to a github with schematics, PCB fabrication files and the sample YAML for ESPHome needed to run the PHY.
    https://github.com/aycarambaa/ESP32-Lan7820-Ethernet.git
    Attachments:
    • Gerber.zip (148.37 KB) You must be logged in to download this attachment.

    Cool? Ranking DIY
    About Author
    DewastatorLampowy
    Level 7  
    Offline 
    DewastatorLampowy wrote 48 posts with rating 21. Been with us since 2018 year.
  • ADVERTISEMENT
  • #2 21479423
    gulson
    System Administrator
    Thank you for sharing your project.
    And what made you give up on WiFi alone? Just the desire to provide power, or the stability/security?
    I'll tell you, I have a couple of ESPs going non-stop and I'm shocked how they have a stable connection over WiFi, sooner the router itself has problems or lack of on the operator side.

    Send the ESP to me on Private Message and I'll send a small gift.
  • ADVERTISEMENT
  • #3 21479545
    Anonymous
    Level 1  
  • #4 21479636
    DewastatorLampowy
    Level 7  
    >>21479423 I gave up on Wi-Fi because of the distance. In addition, twisted pair cable had already been laid to the cameras, over which I would have had to run power anyway. As for the stability of the WiFi on the ESP, I have a couple of watches at home and indeed I don't recall them ever disconnecting.

    >>21479545 Pretty cool chips, they have a lot of memory, built-in USB and Ethernet. Unfortunately, at the moment ESPHome doesn't support them, but I suspect it's only a matter of time.
  • #5 21479922
    yahooyahoo
    Level 24  
    It is very nice to look at such an aesthetically designed board :-) .
  • #6 21480487
    krzbor
    Level 29  
    DewastatorLampowy wrote:
    3. In the first version, the PHY chip was not sufficiently protected, resulting in its failure after several Ethernet cable connections and disconnections - a known problem in PoE solutions.
    .
    Could you please elaborate on this? The current is received on the primary side of the transformer (cable side) and the PHY is on the secondary side.
  • ADVERTISEMENT
  • #7 21480529
    efi222
    Level 21  
    gulson wrote:
    I have a couple of ESPs going non-stop and I am shocked how they have a stable connection over WiFi, sooner the router itself has problems l
    .
    Confirmation.
    A friend has a fancy Asus router and in the schedule he has a reboot set once a week. Otherwise he has been experiencing hang-ups.
  • ADVERTISEMENT
  • #8 21480959
    DewastatorLampowy
    Level 7  
    >>21480487 When unplugging/plugging the rj45 plug, there can sometimes be a momentary 'spike' of voltage on the transformer, in the previous version I protected against this by adding TVS diodes on the RX and TX lines, while I forgot to protect the middle tapping of the transformer, as recommended by the manufacturer:
    https://microchip.my.site.com/s/article/LAN8720A-ESD-Protection

    In addition, I send a short article, also from the manufacturer of the circuit on this subject:
    https://ww1.microchip.com/downloads/aemDocume...plicationNotes/ApplicationNotes/00002157B.pdf
  • #9 21483467
    xPolioli
    Level 1  
    >>21479423 That's right, I also have an esp-based solution at my company that monitors the temperature in my server rooms and when the value is exceeded, it sends me an sms notification, and as far as wifi is concerned, I don't think I've had any interruption on the esp side itself since the modules were fitted.
  • #10 21488596
    robgold
    Level 23  
    I glanced at the layout out of curiosity. As I understand it, the connector at the bottom is only the input for signals and power supply ? In the case of the output for e.g. 3.3V it is better to derive the power supply from the capacitor (C28) not from the leg of the stabiliser.
    - Around C23, C22, C24 you have such a messy fill. It's good that there is one via there to whip up the antenna effect but with inverters it's worth just cutting something like that out.
    - Have you thought about routing the paths to C12, C14, C13, C16, C15 differently? So that the signal first enters these capacitors (no via, each via is an inductance) and only then from the capacitor to the IO ESP. In this way, using already small capacitances with NPO dielectric and an operating voltage of 50V, you can have a minimum ESD protection of these inputs.

    By the way, very cool looking.

    PCB layout with component placements and traces. .
    Section of PCB design with components and traces.
  • #11 21489747
    DewastatorLampowy
    Level 7  
    >>21488596 The connectors at the bottom are signal inputs/outputs, you are right, the via could have been moved a few mm to the left. The area around C24, C22, C23 I left that filling as such "isolating" the feedback path from the +5V line, while I was doing it "by feel", I don't have much experience in designing DC-DC converters, next time I will remember. As to the last point, I've heard somewhere that the ESP32 has ESD protection as such, but I don't know how effective it is. Inductance probably doesn't matter too much in this case, I don't foresee signals above 100Khz for I2C. Anyway, also an interesting comment about ESD protection, I will try to follow it in the future.
    Thanks.
  • #12 21489885
    robgold
    Level 23  
    >>21489747 ESD protection in the ESP itself may not be able to help. The system is too far away. The potential landing will extend across the board and may "mess up". Therefore, it would be best to connect along the TOP layer by the shortest route to capacitors C12-C15 and only from them take the signal further. Somewhere you have to take over and dissipate this energy charge. There is also the option of using spark gaps on the PCB. This is for the future.

    According to the datasheet, the ESP32U has:
    - Human body model (HBM): ±2000 V which is not too much.
📢 Listen (AI):

Topic summary

✨ The discussion revolves around the design and implementation of a weather station using an ESP32-based motherboard with Ethernet capabilities, aimed at controlling an irrigation system and monitoring environmental parameters. The author initially considered ready-made solutions like Olimex and LILYGO modules but opted to create a custom PCB for better connectivity and functionality. Responses highlight the advantages of using Ethernet over Wi-Fi for stability, especially in environments with existing cabling. Participants also discuss the ESP32-P4 module, ESD protection strategies, and PCB design considerations, emphasizing the importance of signal integrity and power management in the design process.
Generated by the language model.

FAQ

TL;DR: For ESPHome users building outdoor weather or irrigation nodes, this custom ESP32 Ethernet board favors 2 A power capacity and "full compatibility with ESPHome" over Wi‑Fi-only simplicity. It solves long-distance installation, sensor expansion, and safer cable-powered deployment with passive PoE splitters instead of costly active PoE. [#21479417]

Why it matters: If you need one cable for data and power at a distant sensor point, Ethernet on ESP32 can simplify installation and improve expansion options.

Option Approx. cost / hardware note Main advantage Main drawback
Custom ESP32 + LAN7820 board Custom PCB; passive PoE splitter about $3.5 Screw terminals, ESPHome compatibility, tailored I/O More design effort
Olimex / LILYGO ready-made modules About $20–25 Fast start, known hardware No screw connectors for easy sensor wiring
Active PoE version Added isolated DC-DC, special MagJack or transformer Single-cable powered Ethernet Higher cost, more parts, suitable switch required
Wi‑Fi-only ESP32 No Ethernet hardware needed Simpler electronics Power still needed, range was the blocker here

Key insight: The biggest lesson was not Ethernet itself, but protection: an RJ45 plug event can damage the PHY if transformer center taps are left unprotected in a PoE design.

Quick Facts

  • The MIC4684 buck stage can deliver up to 2 A and accept up to 32 V, which makes higher-voltage input practical when a passive PoE splitter is used. [#21479417]
  • Ready-made Olimex and LILYGO boards considered by the author were about $20–25, but lacked screw connectors for easy sensor expansion. [#21479417]
  • An isolated 12 V active PoE splitter was available for about $3.5, roughly the cost of the flyback transformer alone in the abandoned active PoE approach. [#21479417]
  • The ESP32U ESD rating quoted in the discussion was HBM ±2000 V, which was described as modest for boards with external cables and connectors. [#21489885]
  • The author did not expect signal speeds above 100 kHz on the external I2C lines, which shaped the routing discussion around GPIO protection and inductance. [#21489747]

Why did the author choose an ESP32 WROOM-32UE with Ethernet instead of using Wi‑Fi alone for a weather station and irrigation controller?

The author chose ESP32 WROOM-32UE with Ethernet because the node was far away and twisted-pair cable was already installed for nearby cameras. Ethernet also let one cable carry data and, via a splitter, power. He picked the 32UE package because it saves board space by omitting the antenna, which he did not need, while still keeping full ESPHome compatibility for Home Assistant integration. [#21479636]

How do you make an ESP32 board with a LAN7820 Ethernet chip work with ESPHome and Home Assistant?

You make it work by pairing an ESP32 with the LAN7820 and using the provided ESPHome configuration for the PHY. 1. Build the board around ESP32 WROOM-32UE and LAN7820. 2. Use the sample YAML the author shared to start the Ethernet PHY. 3. Add the ESPHome device into Home Assistant. The design was explicitly built because ESP32 gives "full compatibility with ESPHome," making Home Assistant integration easier. [#21479417]

What is active PoE, and why can it make a custom ESP32 Ethernet board much more expensive and complex?

"Active PoE" is a powered-Ethernet method that negotiates power delivery over the cable, requiring dedicated interface and isolation parts. In this project, it raised cost because it needed an isolated DC-DC converter, a special MagJack or signal transformer, plus more protection work. The author said those extra parts alone cost more than the rest of the board circuitry, and active PoE also required a suitable switch. [#21479417]

What is a passive PoE splitter, and when does it make sense to use one with an ESP32 Ethernet project?

"Passive PoE splitter" is a small power-separation module that takes voltage from Ethernet cabling and outputs a local DC rail, without active 802.3af/at negotiation. It makes sense when you already have Ethernet cabling and want cheap remote power. Here, a Chinese-market active PoE splitter with isolated 12 V output cost about $3.5, and the board’s MIC4684 input range up to 32 V made higher-voltage feed practical. [#21479417]

ESP32 Ethernet vs Wi‑Fi for outdoor sensors and irrigation control — which is better for range, stability, and powering the device?

Ethernet was better here for range and powering, while Wi‑Fi was considered stable enough for shorter links. The author said distance was the reason to skip Wi‑Fi, and twisted pair was already laid to camera locations where power also had to be delivered. Other users reported ESP Wi‑Fi staying connected continuously, but that did not solve the cabling and power-distribution problem at the outdoor installation point. [#21479636]

How can plugging and unplugging an RJ45 cable damage the PHY on an Ethernet board, even when a transformer is used?

A plug event can create a brief voltage spike on the transformer, and that transient can still reach vulnerable PHY nodes if protection is incomplete. The author said his earlier board protected RX and TX with TVS diodes but forgot the transformer center tap, and the PHY failed after several Ethernet cable insertions and removals. That made the issue a real hardware failure, not just a theoretical ESD concern. [#21480959]

What ESD protection should be added around the Ethernet transformer and PHY center taps to avoid failures in PoE designs?

You should protect not only RX and TX lines but also the transformer center taps. The author said his first version had TVS diodes on RX and TX, yet still failed because the center tap was left unprotected, despite that being the manufacturer recommendation. That detail matters in PoE-related layouts because a transformer alone does not guarantee immunity during cable hot-plug events. [#21480959]

Why was the TE 2301994-2 MagJack chosen for this board, and what are the advantages of an RJ45 socket with integrated magnetics?

It was chosen because its integrated signal transformer simplified the PCB. The author used TE 2301994-2, noted it was not among the cheapest parts, and said he managed to source some at a good price. "MagJack" is an RJ45 connector with built-in Ethernet magnetics that combines the socket and transformer, reducing external parts and easing board routing. [#21479417]

How does the LTC4311 I2C extender help when sensors are placed farther away from the ESP32 board?

It helps by strengthening the I2C bus for longer sensor wiring runs. The author added an optional LTC4311 footprint because it cost almost nothing to reserve PCB space and could be useful when devices or sensors were placed a little farther away. That makes it a low-risk design option for a weather-station motherboard that may grow over time. [#21479417]

What are the pros and cons of building a custom ESP32 Ethernet motherboard instead of using ready-made Olimex or LILYGO modules?

A custom motherboard gives better expansion, but it costs design time and layout responsibility. The author liked Olimex and LILYGO modules in the $20–25 range, yet rejected them because they lacked screw connectors for easy sensor hookup. His own board let him add those connectors, choose the ESP32 WROOM-32UE, add optional LTC4311 support, and tailor power input, but it also exposed him to issues like PHY protection and DC-DC layout decisions. [#21479417]

How should decoupling or protection capacitors be routed to ESP32 GPIO lines to improve ESD robustness on a custom PCB?

Route the external signal into the capacitor first, then continue from the capacitor to the ESP32 GPIO. A reviewer suggested that for C12, C14, C13, C16, and C15, the trace should hit the capacitor before any via and only then go to the ESP I/O. He said each via adds inductance, and small NPO capacitors rated at 50 V can provide minimum ESD protection at those inputs. [#21488596]

What layout mistakes around a DC-DC converter can cause EMI or poor behavior, and how should copper fill and vias be handled near parts like the MIC4684?

Messy copper fill and unnecessary vias near the switching area can worsen behavior. A reviewer pointed to the area around C23, C22, and C24, called the fill messy, and said that with converters it is better to cut out problematic copper instead of leaving antenna-like shapes. He also criticized a via placement and implied the shortest, cleanest current paths matter around the MIC4684 converter section. [#21488596]

How much ESD protection does the ESP32 itself provide, and why might onboard protection still be necessary for external connectors and long wires?

The quoted onboard protection was only HBM ±2000 V, so extra protection can still be necessary. A reviewer warned that the ESP’s internal ESD structures may not save the system when the discharge enters through long traces or external cables, because the surge energy spreads across the PCB first. That is why he recommended catching the event near the connector side, with capacitors or even PCB spark gaps. [#21489885]

What is a PHY in an ESP32 Ethernet design, and how is it different from the RJ45 connector and transformer?

"PHY" is the physical-layer Ethernet chip that converts digital network signals into cable-side electrical signaling, while handling the electrical interface to the line. It differs from the RJ45 socket, which is only the connector, and from the transformer or magnetics, which provide isolation and coupling. In this thread, the PHY was the part damaged by cable plug events when protection around the transformer connections was incomplete. [#21480487]

How do newer boards based on ESP32-P4, such as the Waveshare ESP32-P4-NANO, compare with ESP32 WROOM designs for Ethernet projects and ESPHome support?

They look stronger on hardware, but they were not the practical ESPHome choice in this discussion. One poster noted ESP32-P4 boards such as the Waveshare ESP32-P4-NANO already had Arduino Core support. The author replied that these chips offered a lot of memory plus built-in USB and Ethernet, but ESPHome did not support them yet. For an ESPHome-first project, ESP32 WROOM remained the safer option. [#21479636]
Generated by the language model.
ADVERTISEMENT