Have a close look at the circuit near the text âreset buttonâ.
First, PB2 is always connected to GND, regardless of the use of SW1 or placing R6 on the PCB.
And apparently the reset pin of U1 is PB3 and not PB2.
I totally agree with the first remark made by hmk. Especially for beginners keeping mains voltage far away from the PCB is a good idea. The simplest way to do that is to put your RAC03-05SK module in a plastic box and then only route the +5 to your PCB. Do this at least until your PCB has been fully debugged and working. Adding a generous amount of hot glue over the 230Vac connections are also a way to make working on this project a bit safer.
Fuses are also always mandatory for mains voltage related stuff, but your module apparently has a built in fusible resistor.
I do not see mounting holes. Adding these to the schematic is an easy way to never forget them on the PCB during updates. Designing the PCB is an iterative process and adding those holes to the schematic is the most robust way.
Labels are good, but overuse of labels makes schematics less readable. Itâs always a bit of a tradeoff between readability and flexibility. In general, if stuff can be drawn with wires without labels, this is preferable, because if you see a wire without labels, you know instantly itâs just a wire. A label may appear on multiple places in the schematic. Usually itâs better to draw the âsimple stuffâ directly to the microcontroller, such as R5, R7 and D1.
Sometimes redundancy is good, but adding text to the schematic that a led is a led is not useful.
Why have you added the text ânorm closedâ to the relay? Iâve also interpreted the NC text as âNot connectedâ on the first read. Where are FLAG_ON and FLAG_OFF connected to? I only see them once. If you had drawn the three optocouplers with wires to the connector instead of with labels, there would also be a lot less labels to hunt around. The net highlight function does not work on your screenshot. (PDF output is searchable though).
Why use the HPLC3700? A quick peek suggests it costs over EUR5 each, while there are plenty of opto couplers starting form 50ct or so in small quantities. (Iâm not sure about AC input versions.) I did not read the whole datasheet, but it seems that the HCPL3700 also needs a resistor on itâs input like any regular optocoupler. Maybe this is offboard somewhere? Datasheet of the HCPL3700 shows both some internal current limiting and a resistor (Rx) on the outside. Whatâs up with that?
50kOhm for R7 is quite high. Your BC337 may have not enough base current. When power consumption is important, use a mosfet here, (although the relay current swamps it).
With a regular optocoupler and an âanti-parallelâ diode on the input these can also be used with AC. The led will blink @ your input voltage frequency, but your uC can usually easily compensate for that in software (Unless a quick response is needed).
What is the input voltage to your opto couplers? Is this also mains voltage? Mains voltage needs extra clearance on PCBâs, and PCB layout is important.
I always add a programming connector to PCBâs with a microcontroller.
Also:
I would remove the rectangular boxes around sub circuits. They only add distraction, and they are hard to maintain. Any change to the schematic is likely to force you to remove & redraw those boxes. Using the big bold text near schematic sections is a good practice though.