ESP8266 DIY Smart Socket (2017)
notenoughtech.com
notenoughtech.com
Don't toy around with mains voltage - especially when an off-the-shelf solution is widely available for less money. A Sonoff smart socket is only $15, and you can even flash your own firmware on its ESP8266. All of the benefits, none of the "accidentally setting the house on fire" or "giving yourself a fatal shock"!
Of course you should be, this is hacker news after all. But this guy shouldn't be because his soldering skills are atrocious.
At least he put a big fat warning on the article. I've built a 15 KW solar installation here and it's safer and better constructed than what your typical professional around here delivers. DIY electronics and working with mains are perfectly ok. I've been doing so since I was 12 or so and I really don't get this kind of alarmist attitude towards electricity, it isn't magic.
The problem is that random people on the internet see "guides" like these and treat them like an Arduino project: just something to mindlessly copy in a spare Saturday afternoon, and the worst that can happen is that it won't work. They will not do the research, and they will not take adequate safety precautions - they never had to do so before and they never had any issues, what's the big deal?
That's fine with most DIY projects. Heck, it's even fine with most DIY projects involving mains voltage - a guide for installing an outlet will always tell you to turn off the breaker first, at which point it really isn't all that dangerous. You're just plugging some pre-made and known-to-be-safe parts together, it's less complicated than building a computer. You have to actively try to screw that up.
This is a different beast. You're building a new thing which is handling mains voltage out of the cheapest parts you can find. You can totally do an Arduino-like project with that mentality - the average Arduino project going horribly wrong will result in a brief spark and some nasty smoke coming out, it's no big deal. But a project like this going wrong? It will set your house on fire.
Mains voltage is “low voltage” in an electrical industrial safety context.
> But a project like this going wrong? It will set your house on fire.
No, the most likely outcome is that it will either cause a breaker to trip or that it will simply stop working. 'it will set your house on fire' is only one of the three possible outcomes and the least likely one. It can happen though and that's why this guy should be doing his stuff for himself rather than broadcasting it to the world because the final product isn't 'good enough'.
Apropos Sonoff, the brand you advertise in your original comment: they had a pretty serious issue at some point where they had a fuse in a holder inside the devices that got excessively hot because it wasn't rated for the current of the socket. And that is a fire risk.
https://www.reddit.com/r/homeautomation/comments/as26oj/sono...
That's exactly the point I've been trying to make. Of course "it WILL set your house on fire" is an exaggeration and other failure modes are far more common, but the fact that it is even a remotely-possible-but-plausible outcome means projects like these shouldn't carelessly be shared with the general public.
The problem with mains voltage hobbyism is that it is really easy to build something that works fine in 99% of the situations until it encounters those 1% situations that the hobbyist couldn't plan for, doesn't have the knowledge of, doesn't has the tools for etc. The problem with that is, that if you're unlucky it can literally ruin multiple lifes at once.
Experimenting is one thing (know the risks and go ahead), but putting things out there in circulation is an entirely different can of worms. I had to learn all of the VdE rules and many of them have been written in catastrophic failures and house fires. And I thought I knew a lot when I started learning those rules, and oh boy was I wrong. All electrical appliances interact with your house wiring, and there can be very weird fault conditions between your appliance and your house wiring, that are very hard to predict (and even harder to test for) by a "electricity comes out of the wall"-hobbyist.
> DIY electronics and working with mains are perfectly ok
That's great to hear! Now let me connect this beefy microwave oven transformer to the mains and do some electrical wood burning, surely it will perfectly ok
Common sense?
> The professionals, in theory, have more experience and more knowledge in depth than an amateur; and if an amateur has greater knowledge than a professional, is he really an amateur still?
An amateur is someone who doesn't do what he does professionally, a professional is someone who makes a living with the thing they do. That doesn't say anything about their knowledge level. But when you're a professional and you claim that you are 'done' with the installation and I spot: a HV DC wire pinched between a panel and the mounting rail, a HV DC wire (the + terminal) run through the cooling ribs of the inverter (sharp af near the ends) and a mains cable whose connectors aren't torqued down to the point that I smell ozone then you have to wonder. Note that there is a distinguishing factor with solar installers: they are not afraid of heights. Electrical knowledge is apparently secondary.
> Of course, some things might be obvious to an amateur or a lay person (walls not straight, for example), while others might be more subtle and deadly at the same time (foundation issues).
The above are a mix between obvious and non-obvious but those guys probably did 400 installations last year and if my n=1 sample is any indication then I wouldn't be surprised if they left some latent problems behind them.
> Now let me connect this beefy microwave oven transformer to the mains and do some electrical wood burning, surely it will perfectly ok
If you insist on being stupid then I don't think that's a fair way of conversing here. You can use common sense, read the electrical code (though it's an expensive book, which is kind of weird, you'd expect it to be free) and you can get yourself some basic knowledge about electricity and electronics all the while doing nothing more 'scary' than using batteries or sitting on the far side of an insulation transformer.
If and when you feel ready for it you can switch to mains powered stuff.
The scariest stuff to work on: old fashioned tube based color TVs but I haven't seen any of those in a couple of decades. Other than that, I would be very careful with a microwave because it is probably easy to create a radiation leak and I don't have the proper gear to detect one. So I'd stay away from that. Again: common sense.
Unfortunately common sense isn't as common as you'd hope, and there are plenty of things which are "common sense" among amateurs which are simply untrue.
> An amateur is someone who doesn't do what he does professionally, a professional is someone who makes a living with the thing they do. That doesn't say anything about their knowledge level.
Professionals usually also have formal training, which means they are at least somewhat familiar with the theory behind what they are doing. PV installation is indeed a well-known cowboy industry right now, but I can assure you that an actual electrical engineer will be way more capable than a random hobbyist when it comes to actually designing electronics. Your one experience with a single PV installer does not scale to the entire industry of electronics.
A randomly chosen EE better than a randomly chosen hobbyist? Sure.
A randomly chosen EE better than all hobbyists who’d be inclined to take on such a project? I seriously doubt it.
An actual electrical engineer is unlikely to have the necessary certification to do electrical installation work for someone else. What you want is an electrician.
That's the point of all the scary warnings, caveats and reminders. They're there for not-engineer-minded folks, so that they don't hurt themselves or set their house on fire.
NEC is free (as in beer) online: https://www.nfpa.org/For-Professionals/Codes-and-Standards/L...
It’s a slightly cumbersome site, but functional.
BUT a lot of things are dangerous, and we can become proficient at it. Driving a car is helluva dangerous but we can learn it. You can learn about mains voltage, and you should learn about it properly first.
But to suggest that one not try to innovate like he does - then hackernews is not the right place for your nerves :)
https://protosupplies.com/inferior-counterfeit-fotek-ssr-25-...
https://www.eevblog.com/forum/reviews/warning-dont-buy-fotek...
Buy parts only from reputable sources, especially when safety is involved, which is the case with everything that is connected to mains voltage.
Unfortunately they tend to die prematurely for some LVDC regulator problem.
I've done a similar teardown on KaKu, Tuya and Shelly products and only the latter were - in my opinion - acceptable from a mechanical and electrical design perspective. The Tuya stuff was absolutely terrible (and required a server in China to have access to stuff in my home which will never happen), the KaKu ones are confusingly labelled (but if used at the lower of the two labelings probably safe) and much lighter in construction than the website suggested. The Shelly stuff is simply solid and comparable to the one in this video and doesn't require any cloud services. So that's what I went with. Bonus because it integrates seamlessly with HA.
As a compromise, I got a bunch of radio controlled plug-sockets, and started on hooking up a 433mhz transmitter to an esp8266, and....... well the transmitter stopped working once I soldered everything down and I then got distracted by other shiny things. Been meaning to go back to it ever since.
"The graveyard is full of people who knew what they're doing"
In this project, on the other hand, you are building something new which will handle mains voltage, using the cheapest parts you can find on AliExpress. It's not designed to be safe, and it's definitely not certified or even tested. That's not something you should do without doing a loooot of research first.
This seems like an invented argument.
Many relays you find on amazon and similar marketplaces are CE or likewise rated.
Add a quick blow fuse to the circuit if you are skeptical of the thresholds.
I would also say if you sat through a primary school science curriculum, it doesn't take a "loooot of research" to understand the basics of residential electricity. Fifteen year old students learn it in vocational technology courses.
The tutorial got them from AliExpress. The links are long-dead, but if they have any ratings they are almost certainly fake. Also, CE ratings apply to finished products - they don't make sense for individual parts.
> Add a quick blow fuse to the circuit if you are skeptical of the thresholds.
... which the tutorial didn't do.
> I would also say if you sat through a primary school science curriculum, it doesn't take a "loooot of research" to understand the basics of residential electricity. Fifteen year old students learn it in vocational technology courses.
That's the problem: this isn't basic residential electricity! You're building a new device, without all the mandatory safety precautions you'll find in off-the-shelf products. The most dangerous part is that at first glance it looks fine, while it's actually violating some quite basic design rules.
UL and CE guidelines definitely apply to things like relays, bulbs, wire, etc.
Mains electricity is ubiquitous so we tend to think it's safe. It really isn't, and electrocution and fire are both real hazards, only uncommon due to good safety standards.
That sounds like a raw deal, just off the top of my head:
Shelly, 12A - https://www.shelly.com/en/products/shop/shelly-plus-plug-s
Local Bytes, 13/16A - https://www.mylocalbytes.com/en-eu/products/smart-plug-pm
Sonoff, 10A - https://itead.cc/product/sonoff-s26-wifi-smart-plug/
Athom, 16A - https://www.athom.tech/blank-1/esp32-c3-eu-plug-for-esphome
(Most of these have US equivalents)
> this is from a brand with a reasonably good reputation
Please name them.
KlikAan/KlikUit aka 'Trust Smarthome', socket type ACC-250-LD, it's a 250 W remote control dimmer socket but on the front it is labelled 16/250 which for lay people would probably be highly confusing because it refers to the plug, not to the capacity of the device. The small print on the front of the plug part (so unreadable once it is plugged in...) is where the 1.136A rating is specified. Such small mistakes can have big consequences. A nice fat 250W MAX rating stamped on the socket side (black is fine, but red would be better) would go a long way towards dealing with my irritation about this stuff.
It has a 10-30v (and 120v)control coil so you can use a low voltage circuit to control it.
This one is more suitable for use with an ESP8266, it has a pair of dry contact inputs and switches 120v-277v that could be triggered with GPIO: https://www.functionaldevices.com/product/rib01bdc/
Thanks!
And to stick a thermistor on the distribution panel breaker just to be safe. Those things don't like to be slow cooked.
Touch remote control ESP32
The previous everything control was a bit crap when the keys fell apart. K-mart had nice chrome pins, from which I made a 21-key controller, where the keys are primarily read via the MC14067 analog mux.
This does not require an external server, as "urequests" seems to work quite reliably, but only in one direction.
There is also a 433 Megahertz transmitter here, so Lidl's 10 euro plugs can also be controlled, and Wi-Fi is not always needed.
PIR sensor added, it turns off unnecessary devices if no movement has been detected for an hour.