
In the
first article, I compiled and tested a prototype switch on the Arduino Nano V.7. The Arduino controller used as a convenient device for debugging the circuit and the code, but for the finished Arduino device it is redundant and expensive. Therefore, I present the scheme of the end device on the Atmega328 controller.
Why Atmega328, not Tiny or Atmega48? Because sound effects occupy approximately 28kB of flash memory of the controller's programs, and the Atmega328 controller has a total memory capacity of 32kB. In addition, for Tiny, the control code of the program would have to be rewritten and the debugging performed again.
I will not describe the work of the circuit breaker here, since his work is
described in the
previous article , so I will go straight to the description of the device circuit.

The optocoupler MOC3061 and the triac BTA140 are used to control the load. The optocoupler provides galvanic isolation from the controller. I also use an optocoupler with a zero detector, to reduce interference in the electrical network at the time of switching on. The triac is selected with a high operating current of 25A to ensure maximum reliability of operation, it can withstand a current of 190A in a pulse. In addition, the price of this triac is almost the same as on the BTA136. IR LED BL-L314IRCB, you can use the same or from any remote control. Phototransistor LTR-3208E or any of its analogs.
')
The diagram provides a connector for programming the ICSP chip.
Hex file for controller firmware can be downloaded
here.I plan to power the device from a mobile phone charger adapter. Slightly modifying it for higher reliability.
Why do adapters fail?
In most of the network adapter circuits, a low-power transistor in the TO-92 package is functioning - KSP44, MPSA44, 13001 and other similar transistors. These are quite low-voltage transistors, breakdown voltage 400V, BF420 - up to 300V, they work practically at the limit of their capabilities, including in terms of temperature conditions (the temperature of their body at the rated load current reaches 70 ° C). Therefore, they often fail (usually when the adapter is turned on in the network or in the incorrect operation mode, this is when the mobile phone is connected to the output of the adapter already connected to the network).
Typical diagrams of two adapters


For the reliability of the adapter, you need to replace the transistor 13001 to 13002.
Considering the fact that the circuit breaker in standby mode consumes no more than 50mA, and the power adapter is designed for 500mA and the circuit is powered continuously, it can be said that no extreme loads for the adapter will work and it will work for a long time and stably.
If anyone has any questions on the scheme, ask, I will answer with pleasure.