Is this 230v Relay circuit design good enough? [closed]

I’m designing and building a small pcb circuit and have come to the stage where it is almost done. But since this is my first time I would like some feedback before I actually order it, maybe some improvements or just something I clearly missed. Especially with the relay circuit.

It’s a relay circuit controlled by a ESP32-wroom also I’ve used a ACS723 current sensor in order to measure the current.

• The AC to DC converter is already bought circuit

The voltage regulator and the current sensors have wrong names since I could not find any libraries for them, but they have the right package for the pcb. The current signal is the signal from the current sensor and the relay signal is the signal which switch the relay on and off.

• hint for the future: use 90° angles only in your wiring, it's far less confusing to people that are used to reading schematics. So to speak: your schematic is bad in style, and if the question was "is my schematic good enough", then I'd personally say "no, it needs a lot of tidying up before it's clear and easy enough to analyze, understand and debug.". – Marcus Müller Jan 14 '18 at 10:46
• ah ok I will do that in the future, thanks. Though I'm wondering more if the cirucit it self is "good enough". – danhei Jan 14 '18 at 10:50
• I'm trying to figure that out at the moment, but it's really made hard by the form of the schematic, hence my early comment! – Marcus Müller Jan 14 '18 at 10:51
• Draw your circuit correctly and use the right symbols. Stop your bad habits. Who could tell if your circuit is good enough - good enough for what? – Andy aka Jan 14 '18 at 11:53
• Don't go ordering PCBs until you've done some prototyping. There will be mistakes in your design. You should find them at the prototyping stage. – Ian Bland Jan 14 '18 at 13:09

If we're talking about the circuit as construct that represents the connected elements, I'll have to go into more details below.

But first, I'd like to give a few comments on your schematic style, because it is not really good, which makes it hard to read, and easy to miss mistakes.

• use 90° angles only in your wiring, it's far less confusing to people that are used to reading schematics.
• Supply grid arrows (+5V and such) should always point up, GND ⟂ always down. You do it the opposite way around a lot, which confuses the hell out of me.
• rotating / mirroring ACS723 would have put +5V on top, GND on bottom, and not introduce a "twist" in your power line going through it. Clean that stuff up!
• It's very common to use a "signal goes in from the left, leaves the schematic to the right" convention. Or at least, be consistent, with inputs on one side, and outputs on the opposite site. You don't do that: I was very confused by that.
• Your 3.3V regulator is not related to anything in the schematic. I presume it's to power the ESP, but you never tell us. So, omit anything from the schematic that you don't mean to discuss, or add whatever is connected to the 3.3V regulator.

Now to the circuit, as opposed to the circuit diagram:

• If you're in Europe, chances are that your power outlets do not have a defined neutral and live pin, but these might be any of the two. In that case, having a relay that just cuts either of those is not save, because you might be cutting the neutral wire. This is easy to remedy: us a dual pole relay, which can connect and disconnect both at the same time.
• D3 looks like you meant to connect it, but didn't actually connect it. Wires always go to the end of your contacts. If this is eagle, there's really a solid chance that D3 isn't connected in this schematic, and if you do a layout, you'll be missing these traces!
• Diode is not the same as diode (this is a Germanism). You'll need to pick the right type for D3!
• Exactly the same applies to T1.
• I don't know why you've got LED2 on the NPN's base, but unless your controlling circuitry produces a very high voltage, it's going to break the functionality of that transistor stage: An LED has a voltage drop of at least 2V, and that means your transistor won't turn on.
• Avoid using electrolytic caps for 100nF in signal lines (C3). That's lower-ESR, cheaper, more reliable and commonly availably done with ceramic caps.
• Um, I have no idea why you have R3-C4 in your schematic. But it will probably start a fire, or kill someone who touches the output grid voltage, thinking the device is turned of. That's actually more of a high-pass current filter, and 50 Hz AC will, to a certain degree, pass. Also, fast turn on currents (like someone with a wet finger touching the turned-of output) will flow through that very easily. This applies to an even larger amount to rapidly current-changing devices. You'll get in trouble if the load is a switch-mode supply! (might never turn off, even with the relay open).
• If you meant R3-C4 as a snubber, then that means your load is not ohmic. In that case: be careful with your relay! It might not witstand the voltages that happen e.g. when you disconnect an inductive load, or the currents that happen when you connect a capacitive load. We can't tell you that, because, again, not all info necessary given in the schematic!
• C4: An polar capacitor (probably means electrolytic) with a > 250V voltage rating? Yowza!
• R4-LED1: Um, you do know what an LED does, and how to calculate the series resistor for one, right? Assuming this is a low-forward voltage red LED ($V_F=2\,\text V$), then the current through that LED will be 3 mA. I'd expect you wanted something more in the range of 10 to 20 mA. Component values aren't chosen by fair dice roll!
• For potentially lethal voltages, a schematic never is good enough on its own. There's isolation distances to be respected, you can't just use any capacitor, etc.
• Your current sensor type name is incomplete. If this is a <16A variant, you're missing fuses.
• The sensor specifies a zero output current voltage as the sensor output. You must not route that far! It will be subject to noise if you don't draw significant current from the sensor, but that would subject it to voltage drop. So, there's a voltage buffer missing.

So, no, this schematic is not good enough.

Generally:

You want a switch relay, controlled by wifi, it seems. So buy a ready-made device in an enclosure. Grid voltage is no joke, and it kills people.

There's also ready-made relay boxes with well-isolated input pins, and you could use one of these.

Regarding your current sensing: if you, for some reason, really need to build this yourself, put it in a box of its own, with one inlet and one outlet connector. Add the ESP inside that box.

• R3-C4 is a snubber circuit. The C4 capacitor is not a electrolytic capacitor. it is this one <jackcon.com.tw/admin/uploads/…> and as I understood it is good for snubber circuits/ “spark killer circuits” (If the relay is turning off a inductive load). The rated voltage on this one is 275VAC. I will look in to all your comments, thank you! – danhei Jan 14 '18 at 13:50
• Then, you used the wrong circuit symbol. And: why do you need a snubber? – Marcus Müller Jan 14 '18 at 13:53
• Ok sorry for that. What I understood is that the relay can be damaged if it swiches off and inductive load, like a vacuum cleaner. So the snubber circuit reduces the voltage spikes and "protects" the relay. Or is it not necessary to have it? – danhei Jan 14 '18 at 14:04
• as I said in my answer: you've never told us what you were planning on switching! – Marcus Müller Jan 14 '18 at 14:06
• Labelling the power supply output pins, and relay coil pins as "+5V" and "-5V" implies to me that you have a bipolar power supply, and expect 10 volts between the "+5V" and "-5V" pins. – Peter Bennett Jan 14 '18 at 17:21