this post was submitted on 07 Aug 2024
9 points (100.0% liked)
diyelectronics
360 readers
1 users here now
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Best way is probably to run power right to the pcb, connect your always on led to positive and ground, the rest of the LEDs to ground then run the positive to one side of the switch and the other side of the switch to the anode of the LEDs that you want the switch to turn on.
If you don't want the switch connected right to the PCB you could always add wires to extend it
Something like this?
Also, are there any glaring issues with doing it like this?
This circuit does work but the always on LED can just be connected right to positive it doesn't need to also be connected to the switch. It does depend on which switch type you're using, I'm assuming it's spdt like in your diagram which means that with your current circuit when the switch is in one position the main LEDs will be on and the indicator one is off and with it in the other position the indicator one will be on and the main ones off. Which also works fine if that's your intention.
Shouldn't see any issues, this is how it's usually done. The only thing to watch out for is the longer your wires to the switch the more resistance your adding but it should be negligible unless it's crazy long.
What the other poster said about running three wires up also works, and is essentially the same circuit but It depends how it's being set up, I assumed it was going in an enclosure of some kind with the switch on the outside of the enclosure. If the switch is going to be in-between and outlet and your LEDs it would make more sense to run 3 wires up instead of running wires back down for the switch.
I'm the middle of reading your comment I realized what I did wrong when making it in the breadboard.
So I got the switch and parallel LEDs working, but the single LED connected directly to positive wouldn't light. The resistor and LED made a loop back onto the same positive side of the breadboard, so the current had no reason to flow through them.