Optical switch with sound effect on Arduino. Continuation

    image
    In the first article, I assembled and tested a prototype switch on an Arduino Nano V.7. The Arduino controller was used as a convenient device for debugging the circuit and code, but for the finished Arduino device it is redundant and expensive. Therefore, I quote the circuit of the end device on the Atmega328 controller.
    Why Atmega328 and not Tiny or Atmega48? Because sound effects occupy approximately 28kB of Flash memory of the controller programs, and the Atmega328 controller has a total memory capacity of 32kB. In addition, Tiny would have to rewrite the control code of the program and debug again.

    I will not describe the operation of the switch here, since its operation is described in the previous article , so I will go straight to the description of the device circuit.
    image

    To control the load, the MOC3061 optocoupler and the BTA140 triac are used. The optron provides galvanic isolation with the controller. I also use an optocoupler with a zero detector to reduce interference in the mains when it is turned on. The triac is selected with a large operating current of 25A to ensure maximum reliability, it can withstand a current of 190A in a pulse. In addition, the price for this triac is almost the same as for the BTA136. IR LED BL-L314IRCB, you can apply the same or from any remote control. Phototransistor LTR-3208E or any equivalent.

    The diagram provides a connector for programming the ICSP chip
    Hex file for firmware controller can be downloaded here

    I plan to power the device from a mobile phone charger adapter. Modifying it a little for higher reliability.

    Why do adapters fail?
    In most network adapter circuits, a low-power transistor operates in the TO-92 package - KSP44, MPSA44, 13001 and other similar transistors. These are rather low-voltage transistors, breakdown voltage of 400V, BF420 - up to 300V, they work almost at the limit of their capabilities, including in terms of temperature conditions (the temperature of their case at the rated load current reaches 70 ° C). Therefore, they often fail (usually at the moment the adapter is connected to the network or in the mode of incorrect operation, this is when the mobile phone is connected to the output of an adapter already connected to the network).

    Typical schemes for two adapters
    image

    image

    For the reliability of the adapter, it is necessary to replace the transistor 13001 with 13002.

    Given the fact that the circuit breaker in standby mode consumes no more than 50 mA, and the power adapter is designed for 500 mA and the power is supplied continuously, then we can say that there are no extreme loads for the adapter It will work and it will be long and stable.

    If anyone has any questions about the scheme, ask, I will answer with pleasure.

    Also popular now: