2
\$\begingroup\$

I'm new to electronics so any helpful advice or resources would be greatly appreciated. I built a USB switch to connect my keyboard to two PCs using a 4PDT switch and it works great. Now I'm trying to add LEDs to indicate which PC is connected. I added LEDs in the manner this diagram illustrates only using the switch above instead of a rotary as shown.

My problem is both LEDs are powered in both switch positions (A/B). Why would this be the case when the LEDs are connected to power from separate USB connections and only share the ground? What can I do to correct this behavior and illuminate only one LED based on which switch position is selected?

Here are some images of the circuit. Helpful comments welcome, but I know it's an ugly prototype. You will note the resistor through hole N07 is purposefully disconnected until I can wrap my head around the issue. USB switch circuit top USB switch circuit top

\$\endgroup\$
  • \$\begingroup\$ Most likely you have an error in your wiring. Only one LED should light up as only one LED should get ground via the switch. Impossible to suggest anything as there is no info like photo of your device, or PCB layout if you made one. \$\endgroup\$ – Justme Jun 1 at 5:34
  • \$\begingroup\$ IF your switch & LEDs are connected as shown It is "impossible" for both LEDs to light at once. ie the connections or switch must be different than you believe. Leakage across the switch contacts could cause LEDs to light. As a test, place a say 1k resistor across an LED and see if it alters what happens. | A voltmeter test of various points with the switch in various positions should show you what is happening. \$\endgroup\$ – Russell McMahon Jun 1 at 7:35
  • 1
    \$\begingroup\$ That doesn't look to me like you built the circuit in the diagram (where is the 5th wire?). Try drawing the circuit you built. I bet it'll be obvious what the mistake is once you compare the drawing to the diagram. \$\endgroup\$ – user1850479 Jun 2 at 0:33
  • \$\begingroup\$ Please show us the actual schematic of your device, not the (different) diagram in your link. \$\endgroup\$ – Bruce Abbott Jun 2 at 0:34
  • \$\begingroup\$ @Bruce based on their pictures that is the actual schematic, what makes you think it's not? \$\endgroup\$ – Passerby Jun 2 at 4:08
2
\$\begingroup\$

It looks like the LEDs are powered from the computers - the +5 V terminals on the computer USB ports supply power to whatever device you plug in, so the LEDs will have power regardless of the switch position.

You would need another pole (or two) on the switch to control the LEDs.

| improve this answer | |
\$\endgroup\$
  • \$\begingroup\$ Exactly. The leds aren't switched, they got hardwired to power and ground so it's a wiring error. \$\endgroup\$ – Passerby Jun 2 at 4:16
0
\$\begingroup\$

You haven't wired it as the schematic requires. From the looks of it, the LEDs are hardwired to power and the resistor to ground. And that's why both LEDs would light up.

Secondly you seem to be switching the ground from the USBs instead. That's not what the schematic calls for. It wants you to switch the LEDs instead. The grounds should just be tied together on the board and not taken to the switch.

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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