• Some more and accurate details about the 2 relays board and related schema attached as pic.

    The second pic with optocoupler only driven relays shows that there are actually 2 / 3 independent circuits involved I, II and III. 2, if the power is jumpered / shared (I+II are one), 3 if supplied individually. Interesting technologies to bridge the insulation gaps: (infrared) light between circuit I and II, and mechanical 'rod/lever' between II and III.

    Powering the input side of the optocoupler w/ 3.3 Volt may be critical, because the current limiting resistor R could turn out to be too high and not enough current is flowing to reliably switch the optocouplers output transistor, especially when also a on-indicator LED is in series in the input circuitry.

    A relays creates already a great separation between low voltage and household power voltage (100..240V). The optocoupler provides the protection from any back EMF and with the transistor (or built-in dual transistor as Darlington circuit) reduces the number of parts. The board in uses a simple optocoupler and for current the extra transistor externally, and the on-indicator LED in series with the optocoupler LED (personally, I would like the on-indicator LED parallel to the relays to show wether the relays is pulled, especially when powered separately).

    The cheapo version of relays connectivity uses just a simple npn-Transistor, a current limiting resistor, and a flyweel diode (against back EMF), as shown in the last picture. Since Espruino can have "output_pulldown", the 'swtich-off' resistor from transistor's base to Ground is not needed (crossed out) -pic taken from https://www.electronics-tutorials.ws/blo­g/relay-switch-circuit.html as provided by / thanks to @Robin. Note the positive logic! - What I like in this tutorial is the variations shown, even with different than bipolar transistors.


    3 Attachments

    • BoardAndSchema2Relays.png
    • optoOnlyDrivenRelays.png
    • cheapoRelaysDriving.png
  • Sat 2018.08.04

    Now you've done it @allObjects, you have successfully one-up'd yourself!! Another stellar overview.

    re: 'I would like the on-indicator LED parallel to the relays . . . '

    Agree with you on that observation. Or dual indicators, input - output



    re: 'Since Espruino can have "output_pulldown", the 'swtich-off'
    resistor from transistor's base to Ground is not needed (crossed out)'

    From a hardware design perspective, wouldn't it be smart to have the pull down resistor present on the base, as when the input signal is removed, the transistor could take on either state, which might be a terrible thing if say high voltage is used on the relay output and it stayed in an erroneous state, possibly causing injury?

    What would happen if the signal source, microprocessor driven, gets stuck in an endless loop forcing the input high, which engages the relay. Then in panic, the microprocessor is yanked out of the circuit. Relay stays stuck on, which might not be a desired outcome.

    For the cost of a penny, I'd rather err on the side of safety, and keep that pull down in place. At least we would know what state the transistor should be in, and therefore the same for the state of the relay, should the input signal be lost.

    My 0.02 worth. (okay, three pennies)

About

Avatar for allObjects @allObjects started