An ESP32 Home Automation Swiss Army Knife

Thanks to the ESP8266 and the ESP32, we’ve seen an explosion in DIY home automation projects recently. When it only takes $3 and a few lines of code to bring your gadgets onto the network, that’s hardly a surprise. But hacking bare ESP modules onto devices will only get you so far. Eventually you’ll probably want to put together a slightly more mature home automation system, and that’s where things can get a little tricky.

Which is why [Alfredo] created the Maisken Homelay. This device is a one-stop-shop for your home automation needs that leverages the power of the ESP32. With the microcontroller slotted into this compact PCB, you’ll be able to trigger four relays for your high current or AC loads, and still have 8 GPIOs and the I2C bus for expansion. All while retaining compatibility with existing open source projects like Home Assistant and ESPHome.

What really sets this project apart is the attention to detail. [Alfredo] has included a HLK-PM01 power supply on the board which takes mains voltage and brings it down to 5 VDC for the ESP32, so won’t need a separate power cable. He’s also taken the time to add isolation slots to separate the potential high-voltage connected to the relays from the rest of the board, added current and thermal fuses for protection, and peppered the board with screw terminals so you can easily connect everything up.

Sure you could get a simple relay board shipped to your door for a few bucks from the usual suspects. But it’s not going to offer the kind of quality of life and safety features that the Maisken Homelay has. There’s even a 3D printed enclosure available to help tidy things up.

With some of the blatantly anti-consumer decisions big-name home automation companies have been making recently, there’s more reason than ever to roll your own smart home using open source hardware and software. It still takes more effort than buying a bunch of modules from the Big Box retailer, but projects like this one are certainly starting to blur the line between consumer and DIY.

37 thoughts on “An ESP32 Home Automation Swiss Army Knife

  1. The project is interesting for a tiny house, or a studio. Òtherwise, it negates all the advantages of a Wifi based home automation, with many remote stations, each one triggering one relay. If you concentrate all your relays in one box, you need to draw cables to that box.

    1. Just running the cable would be a problem. Better would be to have each appliance plug into an individual unit capable of controlling/monitoring one or two appliances and connect all of those to a home server. Then decide per appliance whether you want to control or just monitor.

      1. Power Line Communications may be a good option for some too.

        Several hubs can talk to devices via cable or wireless (Bluetooth, WiFi or radio) and talk to the home server via the power line.

    2. You don’t have to populate all the relays and connectors etc, if you know the place won’t need them all. So it’s a bit bigger than an ESP32 + power circuit + 1 relay, but you know, for a house.
      Most likely if you ever need 5 or even 10 of these, does it really make sense to order different size boards? Or one can just get those ready made devices for the places where you need only one relay, if you trust them.
      For example garage, you got maybe garage door stuff with couple relays, some outside lights and you have already burned through the 4 relays.

  2. Man, I don’t like the idea of a mains-powered homebrew device for this application. I’d sooner use a UL-approved wall wart to provide DC to the board. I don’t see any need to be messing around with mains for this application.

        1. This answer needs to be much higher up.

          Your home insurance company will eat you alive if they find this device in the burned down house. Saving a few bucks will cost you dearly

    1. Nahhhh it’s fine. I think there’s way too much skittishness about the mains around here. A little fear is healthy, but one should avoid getting into a reddit moral panic mode about it or whatever. It’s not a commercial product and it’s pretty well designed.

      Also dunno how you plan to make it have no mains power on it, since its whole job is to switch the mains as TSDR said.

          1. Same old nonsense again. No way 5 volt is able to push enough current through your body to even make you flinch, simply because of Ohm’s law.
            “It’s the bullet that kills you” Sure, but you still need the appropriate gun to fire it. A cap gun won’t fire a .45

          2. Re: E
            Our Op Amp instructor told us of the computer tech who slid his fingers between the 5 volt bus bars of a mainframe. His wedding ring shorted the supply, which in turn melted the wedding ring and burned off the finger.

          1. I wonder what might determine just how many amps will flow through typical skin-wire contact… there’s gotta be a formula… or a law… something lying around here somewhere, amirite?

        1. I never got more than a very good tingle from either 110 or 220 having grown up in the US, but currently living in Germany. I will not go near either with both hands but admit to being dumb enough to not to always kill mains before working on mains voltage one handed… I believe that the pop is a bit brighter/louder when accidently shorting a tool across 220V and Imagine that probably carries over to when the “tool” being shorted across is the guy trying to fix or install something on live mains. That i have survived to be 52 may be that my one hand rule works or may be dumb luck. Either way, kill the power first before working with mains circuitry if for no other reason that that tingle is unpleasant and you don’t want your tools to have the unsightly pock marks a mains incident creates. I would advise the inexperienced to never work on mains at all, but then no one would ever become experienced.

          An alternative for those bemoaning UL, CE…. Certification or afraid of working with mains voltage is buying the 433 Mhz remote controlled Sockets which I can get a 4 pack of, with remote control, for cheap and replace the remote with a ESP-01 or ESP-32 and 433 Mhz transmitter. Waalaa instant Iot controlled lights/Appliances. With this setup the homebrew side of the equation never need touch mains voltage. Believe that there are other Hackaday posts that address this method but if not a quick google of 433Mhz and ESP-01 and a few dollars worth of parts will get you on the way.

          Downside to this approach is that you cannot read the current state of the switch in this setup.

          One big upside is that you still have the old remote control to fall back on when you inevitably upload “improved” code to the ESP… which results in it being in a non functioning state. Family will cut you a lot more slack on time to get it working properly again when the remote still works.

    2. The HiLink power supplies (AC to 5v) are allegedly CE and UL approved. I have a few.

      It’s a nice package, but i don’t know how useful it would be for the average-homeowner, unless they’re doing some drastic rewiring. And I don’t know how acceptable it would be to most electrical authorities when they come to inspect a proper electrical install. Ditto for insurers.

      For now, I’m using smart outlets reflashed with Tasmota, and a few Sonoffs. And waiting on affordable, reflashable CE/UL/CSA smart outlets and switches that fit in regular boxes. I expect I’ll be waiting a long time…

    3. I think the primary issue is not a mains powered device in and of itself. A proper PCB design (which this seems to have), implementing isolation slots, fusing, and proper trace width and isolation leaves little concern.

      The main thing I’d have some level of concern about is that power module itself. Those imported SMPS modules often lack robust design and safety components. As was pointed out, the lack of UL ratings is concerning for a device that will be running 24×7. The world is full of crappy SMPS units that are fires waiting to happen. Those import modules might even say UL on them but I’d be suspicious that this is stamped on the device fraudulently.

      I love those little modules, they are great for a very compact source of a small amount of DC power. But I would suggest sourcing these components from a reputable supplier (in the US, Mouser or Digikey, for example), where you can trust the attestations and certification labels. Recom makes reputable, reliable, and safe modules for only a few dollars more than what these import modules cost.

  3. Excellent solution for things like a ceiling fan that has high, medium, low and light or for an window air conditioner with high fan, low fan and compressor. The board looks very nice and has all of the necessary AC protection components. It looks like there are extra i/o maybe available for a user interface? Nice Job A+ :)

    1. Exactly …there’s tons of product UL /CSA / ETL listed for domotic controls. Don’t skim on product design just to save dollars. Don’t reinvent the wheel!

    2. Why don’t you read it!? The target user is a skilled user. With the design safeguards used this is 100% safe and compliant. If you are an idiot, aka ordinary user who has no knowledge of how to handle mains level power, stay away.

      1. Wrong. This is absolutely NOT 100% safe and compliant. Your first clue should be the lack of compliance on the power supply. Duh. Your second clue should be the thermal fuse next to the power supply and away from the MOV. Your third clue should be the way the isolation slots were carried out.

        There are many reasons why such electronics should not be pushed by amateurs. Google “IRM-01-5” from Mean Well for an actually compliant power supply.

        Tim, speaking as somebody who has actually designed and manufactured compliant products, the irony I see in your last sentence is palpable. What you don’t seem to understand is that you are an ordinary user of that dubious PCB.

  4. Very cool device and I can definitely see many uses for it such as controlling equipment such a lawn sprinklers, pool pump, air handling equipment, and I am sure there are many many that I am not thinking of. I’ve often thought about buying an old camper and remodeling it. This would be a really cool way to make use of low voltage for lighting and controls. The developer should be proud and thanks to the author. I as weiI am also dissapiontent that the parents of som of the posters didn’t show them Bambi where Thumper says it best, “If you can’t some something nice,…..”.

Leave a Reply to BrianCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

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