logo elektroda
logo elektroda
X
logo elektroda

ESP32 with Ethernet - Compatible with ESPHome.

DewastatorLampowy 2730 11
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

    Cool? Ranking DIY
    About Author
    DewastatorLampowy
    Level 7  
    Offline 
    DewastatorLampowy wrote 43 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
  • #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.
  • ADVERTISEMENT
  • #5 21479922
    yahooyahoo
    Level 23  
    It is very nice to look at such an aesthetically designed board :-) .
  • #6 21480487
    krzbor
    Level 27  
    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.
  • #7 21480529
    efi222
    Level 19  
    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 20  
    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 20  
    >>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.
Summary generated by the language model.
ADVERTISEMENT