5 ms·
ESP8266 DIY Smart Socket (2017)
- muragekibicho 3y agoI thought this was a web socket. Then I clicked the link and saw it's a wall plug! Lol
- exe34 3y agonpm install burn-down-the-house
- crote 3y agoI like the enthusiasm, but you REALLY shouldn't be DIYing this. This project is almost certainly violating half a dozen safety standards which exist for a very good reason. 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"!
- aulin 3y agoI'd be more worried about the 2A solid state relay, seems way underspecced for a typical 10/16A plug.
- deleted 3y ago[deleted]
- jacquesm 3y agoHave a look at what is inside a typical blister packaged smart socket and you'll never use one again.
- aulin 3y agoI've used tasmota pre-flashed Athom 16A smart plugs with discrete success. According to this video https://www.youtube.com/watch?app=desktop&v=FWQe4RFgY1s https://www.youtube.com/watch?app=desktop&v=FWQe4RFgY1s at least the relay is the proper one and wires seem beefy enough. Unfortunately they tend to die prematurely for some LVDC regulator problem.
- jacquesm 3y agoBoth the relay and the wiring in that particular smart plug looks to be up to spec, going by the markings on the relay and the apparent wire thickness. At the end of the video he does an insulation test as well and it passes with room to spare. There even is a basic surge protection in there (the big blue disc). I would have liked to see the circuit board airgapped between the HV lines to reduce the chance of creep if it ever gets humid, but for dry applications indoors this should be ok. I didn't see a fuse and I would have liked to see a small inductor to separate the HV from the LV section but that's expensive so many brands choose this kind of directly coupled system. R1 (the high wattage resistor next to the relay) and the two 400V caps are doing the heavy lifting there and even though that works I just don't like having electronics directly coupled to mains voltage. The 'Sonoff' devices do this better. 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.
- deleted 3y ago[deleted]
- squarefoot 3y agoTrue, especially if bought from Aliexpress, Amazon, Ebay or similarly unreliable source: most solid state relays sold there are relabeled fakes claiming higher specs than their actual one. https://protosupplies.com/inferior-counterfeit-fotek-ssr-25-solid-state-relays-on-the-market/ https://protosupplies.com/inferior-counterfeit-fotek-ssr-25-... https://www.eevblog.com/forum/reviews/warning-dont-buy-fotek-solid-state-relays/ 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.
- jacquesm 3y ago> I like the enthusiasm, but you REALLY shouldn't be DIYing this. 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.
- GeoAtreides 3y agoBut how would you know if your work is better (and safer) than what a professional delivers? 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? 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). > 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
- jacquesm 3y ago> But how would you know if your work is better (and safer) than what a professional delivers? 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.
- newzisforsukas 3y agobeh. these aren't high voltage transformers or anything. you can buy diy "mains voltage" equipment at any hardware store. no one is shouting from the rafters "you REALLY shouldn't buy that!"
- crote 3y agoCorrect, but those are pre-built parts which have been certified. They are designed to be safe, even when mildly mishandled. Plugging in a toaster or installing a wall socket is indeed pretty safe. 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.
- newzisforsukas 3y ago> you are building something new which will handle mains voltage, using the cheapest parts you can find on AliExpress 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.
- crote 3y ago> Many relays you find on amazon and similar marketplaces are CE or likewise rated. 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.
- mytailorisrich 3y ago@jacquesm nailed it. I will just add that a competent DIY enthusiast will be able to design a better and safer switch than those cheap ones you find online, not least because they are probably not trying to cheap out on everything.
- exe34 3y agoI had the same plans, and then came to the same revelation that not only would I be violating a bunch of rules, but I might void insurance and take on liability for a whole bunch of houses in case of fire, even if my shoddy work didn't start it. 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.
- shswkna 3y agoI disagree strongly. Safety should be adhered to and reminding him/her even once too many times is the right thing to do. 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 :)
- yonatan8070 3y agoI recently had a conversation about this, and someone said this: "The graveyard is full of people who knew what they're doing"
- djaychela 3y ago2a relay does not look like a good idea unless the socket is marked appropriately and fused to suit as well. 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.
- jacquesm 3y agoTypical store bought smart sockets are 1.5A and have a lighter relay in them than what this guy used, note how his goal was to be able to remotely switch chargers on and off. They are also 'marked appropriately' in type that I need a magnifying glass for to read. I've seen people control way heavier loads with them without being aware of what the ratings on those things are because the labeling is nothing short of confusing. I just took one off the shelf here to check and indeed it says 16/250 on the front but on the back in tiny type it says max 250W and 1.136 Amp. With a prominent CE mark between the prongs (this is from a brand with a reasonably good reputation).
- dns_snek 3y ago> Typical store bought smart sockets are 1.5A 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 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 https://www.mylocalbytes.com/en-eu/products/smart-plug-pm Sonoff, 10A - https://itead.cc/product/sonoff-s26-wifi-smart-plug/ https://itead.cc/product/sonoff-s26-wifi-smart-plug/ Athom, 16A - https://www.athom.tech/blank-1/esp32-c3-eu-plug-for-esphome 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.
- jacquesm 3y ago> 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.
- timonoko 3y agoMaintaining 40+ smart sockets was getting truly messy. Mostly I needed master switch to turn them all off. So eventually this evolved into this here touch-button master switch, with PIR-sensor for detecting sleep or absence (or death). https://github.com/timonoko/Hipaisunappaimisto https://github.com/timonoko/Hipaisunappaimisto
- timonoko 3y agoEdited Google-Translation: 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.
- timonoko 3y agoApropos. I repaired the micropython "urequests". So it now works both ways. Somebody was not happy with this fix, but did not suggest better solution. https://github.com/timonoko/t-watch-2020-micropython-hacks/blob/main/src/urequests_noko.py https://github.com/timonoko/t-watch-2020-micropython-hacks/b...
- Liftyee 3y agoIf the pins of the relay were insulated with heat-shrink and everything soldered + mounted nicely, this project would be more passable. In its current state it honestly seems like a fire hazard.
- tapatio 3y agoNo pull down resistor on the relay? Hmm.
- BenjiWiebe 3y agoWhat would you use a pulldown resistor for in this case? That SSR has a must-release current of 1mA. It isn't a FET that can charge up with micro/nanoamps until it turns on.