I would like to know if relay will work normally when I supply electric power for the 5V relay with the same source (classical 5V USB charger) as the source for a water pump (3.3~5V) connected to the relay.

I want to control the relay with a GPIO pin, but not supply power from the microcontroller, so I will remove the VCC jumper from the relay to not bake my 3.3V microcontroller.

Simplified picture:

enter image description here

  • \$\begingroup\$ Depends. How much current does the relay coil consume? Can your GPIO port supply it? You will also need a flyback diode. Please draw a schematic using the built in schematic editor here. Click on edit and the schematic symbol. \$\endgroup\$
    – winny
    Sep 27, 2021 at 7:09
  • \$\begingroup\$ Unless it's an SSR most probably a GPIO wouldn't have enough power to drive it. I'd suggest using a logic level mosfet since your pump is small \$\endgroup\$ Sep 27, 2021 at 9:39
  • \$\begingroup\$ He sayd he Don't want supply power from GPIO \$\endgroup\$
    – gino
    Sep 27, 2021 at 16:09

1 Answer 1


Build the circuit and use a switch (manual) instead of the GPIO, see if it works, if the relay stays on.

Measure the current you need for implement the transistor switch to switch the relay using the GPIO only as a control signal.

In the worst scenario your pump will draw too much current (sure it will be more than the relay) and if your power source is not providing all the current (relay coil current + pump current) I think that the relay will turn off.

This is an easy circuit (few components) better make a prototype than think too much.

  • \$\begingroup\$ thanks for the comment! My expression was wrong I already have relay module not just a bare relay. Anyways I will try it the way you said \$\endgroup\$ Sep 28, 2021 at 0:12
  • 1
    \$\begingroup\$ @MarcelKopera ok if you have a relay module you are ok for the GPIO relay interface. \$\endgroup\$
    – gino
    Sep 28, 2021 at 7:19

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.