1
\$\begingroup\$

I have one relay and two power sources. The first is a cellphone charger and the second is the HIGH signal from a GPIO on a Raspberry Pi.

  • If any one of them supplies power the relay is on.
  • If both supplies power the relay is on.
  • If the cellphone charger is disconnected and the GPIO is LOW, the relay is off.

I have tried to isolate the schematics in the image below.

enter image description here

Will this work? Do I need the 2 diodes? Why/why not?

The following is a complete schema of my assassin solution. As you can see there is a Adafruit Powerboost 1000c. The EN pin is relevant to this question.

According to documentation:

EN - this is the 'enable' pin. By default it is pulled 'high' to VS. To turn off the booster, connect this pin to ground. The switch can be as small as you like, it is just a signal. Contrast this to an inline power switch which would have to be able to handle up to 2 A of current! When the chip is disabled the output is completely disconnected from the input.

The pink parts are the parts relevant to this question. The photo on the far right is a little box that controls the radiators in my cabin. Just added it so you get the full picture.

enter image description here

\$\endgroup\$
12
  • \$\begingroup\$ What is R2 doing? What current does your relay need? What current can your sources supply? I'm guessing you need to eliminate R2 and boost the current from that GPIO. \$\endgroup\$
    – user16324
    Commented Sep 22, 2020 at 17:24
  • \$\begingroup\$ Do you really need a relay here? Why can't you just control the EN pin directly? \$\endgroup\$
    – user20574
    Commented Sep 22, 2020 at 17:25
  • \$\begingroup\$ Nobody is going to call you any names! \$\endgroup\$ Commented Sep 22, 2020 at 17:39
  • \$\begingroup\$ GPIO is not a power source ... it is a signal source \$\endgroup\$
    – jsotola
    Commented Sep 22, 2020 at 17:46
  • 1
    \$\begingroup\$ @user253751 I'll try the direct GPIO and cellphone charger w. transistor on a breadboard. Thanks. \$\endgroup\$ Commented Sep 22, 2020 at 19:20

1 Answer 1

0
\$\begingroup\$

For relay controls, you generally associate ORs with parallel wiring and ANDS with series wiring. So can you simply wire the GPIO and the USB power supply in parallel to the relay coil?

Probably not. They are separate voltage sources and mingling them will have unpredictable unintended results. With relay controls, a simple answer is to add interposing relays:

  • The USB power supply to the coil of one interposing relay
  • The GPIO to the coil of another interposing relay
  • The contacts of the two interposing relays in parallel between a power source and the control relay coil

Now you can select the interposing relay for the USB power with a coil suitable for USB power, and the interposing relay for the GPIO with a coil suitable for logic-level power, likely a solid state relay, and it may require a power supply separate from the contacts and coil.

The NO contacts of the control relay will then close when either the USB power supply is on OR the GPIO is high.

You'll need a power supply suitable for the coil of the control relay, and the contacts of the interposing relays must be rated so they're compatible with the coil of the control relay and that power supply.

This is a bit convoluted, which is typical with relay controls. It may be better to achieve the control by wiring the power supply to another GPIO and using the RPi's logic to do the OR, and switch another GPIO that operates the coil of the control relay. But there is a trade-off, you have to have access to the RPi's code, the ability to modify and maintain that code, and have the IOs available to do what you need to do.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.