0

I'm building a fairly complex Raspberry Pi project that includes several sensors and driver motors for a garden automation system.

Ideally, I'd like to have LED's that indicate the status of sensors/switches as well as an indication that the Motor's are running. Motors run through a relay.

Question is;

  • Is it better to power LED's in series with the Motor's and/switches OR
  • Is it better to power the LED's on their on GPIO pins.

I can see benefits of doing in both directions, however I'm wondering if there is a best practice hardware approach?

e.g. Is it bad to power a LED in series with a switch/sensor to show its active? It would definitely use less GPIO pins with this approach.

1
  • some relay driver modules have indicator lights included
    – jsotola
    Sep 7, 2021 at 15:22

2 Answers 2

1

You run a very real risk of destroying your LED by wiring it in series with the motor (and many other loads). The current through an LED must be maintained in its "Safe Operating Area"; this is typically done through a series resistor.

So yes - "best practice" (and the only good practice) is to wire it in parallel, and to use a resistor in series with the LED sized to maintain the forward current well below the absolute limit. It's usually not necessary to use a second GPIO pin to control the LED.

You can improve your question (and perhaps the answers) if you'll edit your question to add a schematic.

2
  • Thanks, Seamus - does this also stand true for wiring switches? I think you've made it clear with some good points that monitors are a no-go. I don't have a schematic at the moment unfortunately.
    – GlennB
    Sep 6, 2021 at 14:54
  • @GlennB: I'm not sure at all I understand your question re switches, and I'm therefore reluctant to answer because I would have to base my answer on assumptions for which you've provided no basis. If you don't have a schematic, this would really be a good time to start one - the schematic tool is not hard to use.
    – Seamus
    Sep 6, 2021 at 20:44
0

I don't know what best practice would be.

There are at least two reasons to be wary of having in series LEDs.

  1. The LED needs to be current limited to prevent burn-out.
  2. The LED will drop some voltage (0.7 volts say). That might make the difference between the GPIO level being seen as high or low (i.e. you might not be able to set the output high).

Your Answer

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

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