# LED in a circuit with alternating polarities

I am building a project that simplifies a dolly moving on a track. When the dolly reaches the end of the track, it triggers a microswitch that cuts the power to the motor, and redirects the power to a LED to light up to indicate that the switch has been triggered.

My problem is that since the motor controller I am using changes the polarity of the motor to make it go left or right, I am getting positive and negative voltage every other time. (depending on if the dolly is moving right or left). I have tried to use a 12V relay to trigger and light the LED, but the problem is relay needs at least 6 volts to latch, and when the motor is running slow, the motor controller only provides 3-4 volts.

Is there anyone that has a solution on how I can make this work? I am just starting to fiddle with electronics, and I am on a budget with this build, so therefore: Is there a relatively easy fix for this problem? Are there relays out there that has a latch range from 3V to 12V?

1. Schematics of the circuit with the LED (and resistor) connected directly to the microswitch. The problem here is that every other time the positive and negative switches.

2. Schematics of the circuit with a relay attached to the 2nd output of the microswitch. The problem here is that the relay need 6 volts to latch, and the motor controller doesnt provide that at slow speeds.

• The real problem is how do you reverse the dolly motor if the SPDT switch is open to the motor? also the dolly will,coast past the stop with open circuit. A short to motor stops it faster. And TTL logic or 74HCT74 CMOs latches trigger at 1.5V on a regulated 5V supply. With a complete design block diagram, you can get better answers with a dual full bridge to go left, right, back, front and end.stop May 28 '17 at 20:31
• I have a push button that I use to bypass the SPDT switch when it is open. (I didnt add that to my schematics). The dolly stops instantly when the power cuts (friction from the drive belt, pulleys and low speed makes sure of that). But thanx! May 28 '17 at 20:46
• then improve the details in question pls. microwsitches are old school solutions. May 28 '17 at 20:55
• As a side note, general good practice holds that you should have a separate limit switch at each end of travel, which still allows the motor to move in the other direction. Otherwise, someone will eventually push the override without reversing the direction. May 29 '17 at 7:02

Take your first schematic. Place another led and resistor in parallel across the first pair, but in opposite direction. You could make it a different color to indicate which direction it was going.

simulate this circuit – Schematic created using CircuitLab

The second version has some better reverse protection.

• Well, there is that easy sollution I was looking for :D Thank you a lot! May 28 '17 at 20:52
• Instead, I'd strongly suggest just putting in two LEDs on a single resistor. At 12V there are LEDs in existence that will break down at reverse. Having two back to back will prevent the "blocking" LED to fall above forward voltage as guaranteed by the other LED. May 28 '17 at 21:44
• You're missing the point here: in (2), D3 conducts before D4 can be reverse-biased more than about 1.6 V, protecting it. And D4 conducts before D3 can be reverse-biased more than about 1.6 V, protecting it. So in (2), D3 and D4 are protected. There is no further protection to offer them. So why does circuit (3) even exist? May 28 '17 at 23:00
• I think (2) is the best solution, then the colour of the LED alerts the OP to the present voltage state when he hits the hidden bypass switch to activate the motor in reverse (hopefully) and not forward,onto the floor or into endstop (j/k). That MAY need to be a DPDT switch May 28 '17 at 23:42
• Aren't there 2-pin, two-colour LEDs, that light different colours depending on polarity? May 29 '17 at 0:52

I understand then that you need a circuit that lights an LED from a supply and that supply can be of either polarity.

You can use a bridge rectifier to do this. You can either make one out of four diodes or buy a single component containing the four diodes.

simulate this circuit – Schematic created using CircuitLab

D1 is your LED, as before, but R1 needs to be of a lower value to what you had. This is because you have an extra 1.4-ish V drop caused by the bridge rectifier so have a lower voltage across the resistor to push the LED current through it. You can calculate your new resistor value using Ohm's Law or go for trial and error if you'd personally find it quicker.

• Thank you! So you are saying that the bridge rectifier will output positive at the top if either Vs1 or Vs2 are positive or negative DC power? May 28 '17 at 20:51
• Yes, it rectifies the power through the use of diodes. While it's meant for AC lines, it works just as well with DC. But it's overkill. A single led plus maybe a resistor will do the same for you. See my answer. May 28 '17 at 20:53
• @Passerby, saw it: I use one cheap part, you put in two and one needs panel mounting. Underkill, sunshine, not overkill. Diodes in rectifiers aren't 'meant for' things, they just do a function. A second LED won't 'do the same', it's now two LEDs. Can't try to get all smug by cooking the books :-) May 28 '17 at 21:10

The simplest solution is to replace the LED with a BI-colour LED.

No other changes required to the circuit.

Added benefit you will have the colour of the indicator change as polarity of the signal changes.

https://www.digikey.com/products/en?mpart=LTL-293SJW&v=160