Wiring The ESP-32 To Ethernet

Since its introduction years ago, the ESP-8266 has taken over the world. It’s the chip inside thousands of different projects, and the basis for dozens of different IoT thingamadoos. The follow-up to the 8266, the ESP-32, is even more capable. It has a ton of peripherals inside, including an Ethernet MAC. What’s that? Yes, it’s possible to put Ethernet on an ESP-32, and give an IoT board PoE. That’s what [Patrick] is doing for his Hackaday Prize project, and it’s an awesome idea.

This build began as you would expect, with an ESP-32 module attached to one side of a board with some breakouts for the GPIOs and a USB to Serial chip. The tricky part here is the PoE part of the Ethernet, which requires MagJack Ethernet connectors, a flyback transformer, and a PoE-PD controller. These were expensive parts, and the design of such a board requires some thinking — you need isolation across the transformer, and proper ground planes for this mess.

There’s something slightly brilliant about using an ESP-32 in a wired configuration. Far too often, we see these modules used as wireless nodes in a sensor net. The battery consumption is significant, and all those makers are adding USB power input to their fancy WiFi sensor nets. If you’re running wires for power anyway, why not add Ethernet and do away with all that mucking around with WiFi setup. It’s a great project, and one of the better entries in this year’s Hackaday Prize.

31 thoughts on “Wiring The ESP-32 To Ethernet

  1. Other then being a cool hack, why! Might as well kust use a proper micro with a mac. Unless he wants to make a cheap AP for the other sensors, but then its more of a money saving thing.

    If you are not using the wifi of the esp32 its just a soso chip imo

    1. Why? I’ll turn that around and ask you: why not?
      What “proper micro” should I have used instead?

      Think about it: the ESP32 has both WiFi and an Ethernet MAC. You could just as well ask: why use it for WiFi if it has an Ethernet MAC? It’s only because WiFi use has been more common up till now that this question came up in your mind. If it’s a soso chip, why even use it for WiFi? There are other WiFi micros out there.

      Bottom line is: the ESP32 is a popular target chip in the maker community, has a big community, has many development platforms ported to it, is cheap and works pretty well. I really would like to hear from you what “proper micro” would have been a better option. That’s not a rhetorical question, I’m genuinely curious.

      1. Dont get me wrong it is much appreciated that you designed and are sharing this.

        What i mean however, the esp was popular for enabeling wifi on a super low budget which of course is what makers and hackers a like love.
        But now we have this ethernet enabled chip which makes the wifi mostly useless.

        As to it being a soso chip, the while propriatery/blob sdk is what makes it a meh platform. I understand the reason for having it, wireless regulations are a pain and hiding the details in blobs make it ‘safe’.

        Anyhow without the wifi need, therebare tons ofnreally good micros, stm32 based, efm32 surely aswell, atmegas etc etc etc. Just look what riot-os for example runs on.

        POE very cool thing for doing iot. I just dont get why on an wifi enabled chip, its like adding fancy rimms on an airoplane and use it for highway driving ;)

        1. Oh I now understand better where you’re coming from. I agree having a binary blob for WiFi in there when not using WiFi would be annoying. Don’t know if it can be removed if you’re not using WiFi.
          I realize there are some great other micros, but for something like this I need to follow the community, and the ESP32 happens to be very popular. I don’t think I’d find the same audience if I did this with an STM32 or EFM32 I’m afraid.
          I don’t know why you mention ATMega in the same breath with those great chips though. I’d get the community if I did that, but I’d have to call it PoE-PoS if I did that. ;)

  2. Despite of how “crude” those ESP-xx came to market (in terms of documentation, examples, etc), I love the fact that some people will put great effort to make peripherals and code work. Sense of community at its best (and this fellow may as well score some prizes at Hackaday after all).

    1. That’s true of the ESP8266, but not of the ESP32, where Espressif has been pretty good about providing documentation (ESP-IDF is also *really* nice to use). I think the weak documentation for the 8266 was largely due to Espressif being caught by surprise at how popular it became with hackers and they have since put a good bit of effort into supporting the hobbyist community. They even hired SpriteTM to help cater to the needs of hobbyists.

  3. One advantage of USB power over poe is that most locations have power already available, and a micro USB charger costs about $2. Having said that, I think this is a fantastic project and I hope I’ll be able to buy boards on eBay in six months.

    1. What’s more likely, that the $2 USB charger will set your house on fire, or that the $200 PoE Ethernet switch will?
      And what’s more convenient and reliable, having to route Ethernet and mains to your outdoor CCTV camera, or only Ethernet?

      And: The switch shows the actual power consumption of every PoE device, and you can switch them on and off individually, also remotely and rule-based, if you want.

    2. There are literally TONS of ESP32 boards that are USB powered out there, no point in me duplicating something that I could not possibly be competitive in. :)

      PoE may be a niche, but it’s one that has not been served well yet, and it’s right up my alley since I specialize in solving power problems in embedded and IoT.

      Since the design is working very well, I’m getting ready for production as we speak, so it may be less than 6 months. ;)

    1. That’s the transformer used in (most?) SWPS.

      While a ‘flyback’ transformer traditionally generates huge voltages and gets the name from it initial design function (for CRT use), the design lends itself to other uses too – such as energy storage/high reluctance.

      ‘Flyback’ is now kindof a nick-name, now often refered to as ‘line-output’ transformers.

      Compared to a regular transformer, they tend to be air-gapped and shrouded (like a ferrite sandwhich), but also smaller and capable of high frequencies.

  4. I wonder if the ESP32 would grow into a TPLINK POE-10R case. The output Ethernet connector could be removed for more room. I might just go and have a look later.
    These POE boxes are very handy. I have quite a few running various devices from my POE switch here at home.
    The POE splitter has a selectable 5V,2A, 9V, 1A or 12V 1A output and the Ethernet feeds through, so it is easy to add an IP camera powered over the Ethernet, for instance.

    https://www.amazon.com/TP-Link-Gigabit-Ethernet-Splitter-TL-PoE10R/dp/B003CFATQK/ref=sr_1_1?s=electronics&ie=UTF8&qid=1534719955&sr=1-1&keywords=TPlink+POE10R

    1. I have several of them, the can sometimes be found on ebay for little money.
      I even use them to expand the range of devices, that use passive PoE.
      Typically, those devices use 12V and passive PoE injectors, and therefore can achieve a range of maybe 20-30m.
      Using the TL PoE-10R and a PoE switch, I can extend that to >100m.

  5. Can this be used like a relay I’m thinking? That would be interesting. Wonder what the limiting data transfer rate component is as I’m not familiar with the ESP systems yet. One of those… have one of each and looks cool… just not integrated into a system yet since I haven’t read into much.

      1. Awesome. So the relay @13W (~5V @ 2.5A or ~12V @ 1A) to switch as the limiting factor. PoE in itself was an interesting concept for me to discover and see how easy it is to make ourselves in the most basic form (like max distance you can just basically put barrel plugs on each end and use a wall wart at the max distance for the two wires current capability to be safe… which I don’t recall at the moment), then discover the other PoE methods kind of like transferring AC longer distances with smaller wire.

        Yeah, have the vehicle cap actuators lift the truck cap up to walk in or straighten the roof line when not in low drag mode like when the back of the cap is closet to the tailgate like the Mike Basich Ram design cap I want to do and modify more for radio directional finding. Great other ideas I didn’t think about also!

        I was also wondering about the ESP32’s themselves being coded to act as a relay, though I am not sure of the duplex capabilities and the data transfer rates. So also as a communications relay or access point can envision applications too potentially. Like I said, I haven’t even read the datasheets regarding yet.

        Also, like noted above regarding in defense of Ethernet (copper or fiber)… if you look around and I’ll add Letgo, Offerup and other sites… free or even cheap wire (haven’t seen free fiber yet, though cheap) can be found. Plus, hardwired systems are more secure than wireless though is really convenient to be able to use our phones to switch or be notified of device events.

  6. Let us all remember that in more than a few particular situations, WiFi is horrible at best. Wired Ethernet is amazing, and always will be. Until everyone has fiber straight to their computer, and don’t give me any 60Ghz nonsense. PoE is even more amazing because you don’t need wall power, wall warts, etc. Also… Security. Also, reliability. And reliability too. And no passwords, WEP, WPA2, AES you just plug it in.

    Long live copper.

  7. Fantastic project, but as far as the question “why not run ethernet cables when you are running power cables anyway?” Well, a power outlet might be closer and you might not have any more Ethernet ports available

  8. I power my FlightAware Raspberry Pi over PoE as I have to keep it near ADS-B antenna. Since RPi doesn’t support PoE I bought adapter on eBay for 6 bucks. It takes PoE ethernet and on other side it has microUSB with 5V and of course Ethernet. It is designed for RPi but can be used for any device that uses USB power and ethernet.
    That being said I think effort for making ESP32 PoE enabled is excellent, as it’s easier to use long UTP cables with PoE than long USB cables. But if that addition costs like 30 bucks it would be good idea to consider only adding ethernet to ESP and use cheap splitter to do PoE-Ethernet separation. With RJ45 jacks that already have magnetics inside that would keep the costs lower.

  9. “The tricky part here is the PoE part of the Ethernet, which requires MagJack Ethernet connectors, a flyback transformer, and a PoE-PD controller.” as it says in the title. There is nothing tricky here as there are many solutions for this.
    use one of these and be done with it.

  10. Great! We need more ethernet hacks here!

    I think the kids these days are too afraid of wires. Just using WiFi for everything is deceptively simple. Sure, just put in an SSID and a password then it works. Why would you want to run wires? Or.. does it work? I’ve had so much more trouble with WiFi than I ever have with ethernet.

    Do you have a lot of neighbors with computers? Then your WiFi will be spotty. Do you have plaster walls? Then wireless is going to suck. Is there some sort of microwave link, bad, noisy appliances, etc…? Will a lot of devices be pushing data to one another at the same time? A good Ethernet switch can handle routing so that multiple pairs of devices communicate simultaneously. WiFi is just a dumb shared bus like an old ethernet hub but far less secure.

    Do you like that you are broadcasting your private network out over the public airwaves?

    So… let’s look at ethernet. Wires are ugly and you have no way to run them between rooms? Wrong. In several apartments even I’ve run them under carpets, through walls, etc… Need to get through a wall? Drill a small hole as near the bottom of the baseboard in a corner an it’s practically invisible. Got cable jacks, telephone jacks, blank wallplates for old services that no longer exist? If they are back to back, servicing both sides of a wall just replace the covers with ones that also contain ethernet jacks. Then wire the two jacks back to back. If it only services one side of the wall… add a plate to the other side. So long as you use a real wall plate that looks like it belongs… I’ve never had a landlord notice. If I am doing this where a cable or telephone jack already existed on one side of the wall… I split it so it now exists on both sides. If anything it’s an upgrade to the room!

    Is ethernet wire expensive? Sure.. if you just walk into your favorite computer store and buy a roll! Skip that, watch the internet, go to hamfests, try Craigslist.. whatever it takes. Eventually you will find a big roll that keeps your stocked through a couple of moves for cheap! Worst case scenario… you can always try using cat3 or something like that. It may not work as well but often it works just fine even though it’s not supposed to.

    But I don’t know how to put the ends on the wires or have the tools… Seriously, if you enjoy browsing this site you will have little problem figuring it out. And.. today… with all the inexpensive stuff available on the internet… if you can afford internet access you can surely afford an inexpensive but usable crimper tool. Cable testers are not hard to come by either and are quite useful. I’ve been using a cheap, one-piece plastic tool for puch downs for years now. It’s not as pleasant to use as the professional quality snapping one that I once used in a shop I worked at but for home it does the job well enough.

    So.. anyway.. short version… WiFI SUCKS! and… you CAN use Ethernet. It’s just better!

    1. I second that. Cable is the way to go if you can.
      My son built a house so while the frame was up with no plaster board on it, we ran Ethernet cable from each room back to a shelf in a store room. In the children’s rooms, the cables were not terminated, but were folded back and taped to the power cable just as it went to the power point. He does not want his kids to have net access in their rooms yet, but the cable is there ready.
      If you are building a house, the cable itself is not very expensive, so run Ethernet from every power point back to a central point. You may not need it but retrofitting is a lot harder to do.
      Also, one to each door and to outside for security cameras.
      Likewise, at my son’s place, we put in the pipes and wires for a central vacuuming system, a bit against his wishes, and a year later, they were very pleased as they decided to install one and are very happy with it.
      Wifi is ok, and very handy, but Ethernet is way better if you can. And a POE switch frees you from needing seperate power supplies for a lot of devices.
      That said, I’m going to have a play with this ESP32 idea :)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.