Smart home - cheap and cheerful, part 2

    In the life of every smart home, a logical question arises - how can a small tender microcontroller switch 220 volts of alternating current with its five volts?

    The easiest option is a relay. Here you have a galvanic isolation, and you close what you want, even permanent, even variable, few, many. But the disadvantages of the relay are very unpleasant.

    The first - clicks. Annoying. Yes, man is such a thing, it will adapt to everything, and you can get used to it, but why get used to the bad?

    The second - when switching a large current, at the time of switching on, and even with long wires from the relay to the switched device, a rather big obstacle passes. Agree, when you turn on the light in the toilet at night and the computer turns on at the same time and the light in the bedroom is unpleasant.

    Therefore, I want to share with you the best, in my opinion, way to switch 220 volts of alternating current - an alternating current semiconductor switch.

    There was already an excellent theoretical article on this subject on the subject, describing in detail both the triac and the optocoupler.

    I’ll try to tell how it turned out for me.
    So, the triac itself is already an AC key. But for control from the foot of the microcontroller, galvanic isolation is mandatory. By controlling the triac directly - the controller may die. Really can. They were dying with me. He has already killed dozens of AVR MKs in various ways, but this topic deserves a separate post. To make galvanic isolation, we use the MOC3063 optocoupler.

    Using it, we will kill two birds with one stone, because it is with a detector for switching the switched voltage through zero, that is, the triac will open only at the moment of transition, and the voltage will increase smoothly, which will not only get rid of interference, but also extend the life of, for example, lamps ( which die in most cases just at the time of inclusion).

    Schematic diagram:

    Divorced board:

    Issue price:
    • Triac - 30 rubles
    • Optron - 30 rubles
    • Everything else - 30 rubles

    As a result, the cost of the key is about 100 rubles, which is equal to the cost of a similar relyushka.

    Pros:
    • Silent
    • Galvanic isolation
    • Does not cause as much interference as a normal relay.
    • Useful for dial-up devices

    Minuses:
    • AC only

    Links:
    wiring
    schematic diagram

    PS And finally, an excellent backup power supply circuit

    Also popular now: