Controlling DC motor with reverse polarity module

Thread Starter

Lord Drek

Joined Jul 18, 2021
I am trying to control both the direction and limits of a small DC motor with threaded shaft using components and modules readily available online.

I have a very small DC 6v motor with gear reduction (500rpm) and a 2” threaded shaft. Upon receiving signal (LED on)I need this motor to turn until the threaded object nears the end of shaft then have motor stop until a second signal (LED off) then it will reverse and threaded object on shaft goes all the way back to start position ready to repeat the cycle again.

The first trigger event is a 5v LED turning on and the second is it turning off. I am having a problem translating that into a usable signal for a reverse polarity module I am using.

I have a NO switch I am using to test and every click triggers the module to reverse direction as intended but I need my signal to be activated by both the presence of voltage and then the absence of it.

Then I also need power to motor to be cut off when the threaded object reaches the limits of the shaft in both directions. I had intended to use micro switches but if I do this then motor has no power when module reverses.

For the signal could I use a relay module hooking both up both NO and NC to the trigger side of polarity module? Would that end up making a signal (switch on) during both states? If so that would solve the trigger signal problem.

Then I have the limit switches. If a switch cuts off power to motor at end of travel how can I get it to reverse direction when it is time to do so?

It seems like such an easy problem and with all these modules readily available I just have such limited knowledge at this point. I do however suspect that will change…

This is the module I am using for this but am not married to it if a better solution surfaces.


Joined Feb 20, 2016
This is a quick circuit I drew for another post, but it basically will do what you want with a little modification.

Have the relay operated by the LED signal, maybe using a FET or transistor to drive the relay.
When the relay operates, the motor runs until the open limit switch stops it.
When power to the relay is off, the motor runs to the closed position.
The reversed diodes across the limit switches allow the motor to run in the other direction.
Fir future reference, the normal way of controlling motors and door locks is to use two SPDT relays where common is connected to the motor. In the NC position, the contact is connected to ground.

This shorts the motor when both relays are off. When both relays are off, the motor can act as a generator into a short circuist, so the motor stops really fast,

the NO side of the relays get +12.

So you get
00 brake
01 fwd
10 rev
11 brake

The limit switches can be fitted into the coil circuit.

You can use two other relays to get the conventional DIR and enable signals.

In an H-bridge arrangement the enable signal could e PWM for speed control.


Joined Nov 6, 2012
I still don't understand your desired sequence of events.
My Circuit may not do what You want.

It is set up so that it will always return to the "Park" position.

Pushing the Button is the same as shining a light on the Photo-Cell.

When the Photo-Cell receives a short flash of light,
or a short push of the Button,
the Relay will "Latch" and stay on,
and the Motor will run until it hits the "Open" position Limit-Switch,
then it will automatically return to "Park" position.

( The Picture was originally from a different project,
and I didn't change the position names because I really still don't know
exactly what You are trying to accomplish )

Thread Starter

Lord Drek

Joined Jul 18, 2021
I am trying to make an activated device for a pinball machine. Originally I figured I could pull 5v from the LED to activate the sequence but I learned these boards are notoriously fragile so a photo optic trigger is best.

Think of the device as a clam shell that is closed until the trigger LED lights up. Shell opens and stops. Shell stays open until LED turns off. This triggers shell to close and stays this way until the next LED trigger event to repeat cycle.

I found this on Amazon. Perhaps this would work?


Joined Nov 6, 2012
The Mechanical half of this problem is more of a challenge than the Electrical part.

How big is this "Clam-Shell" ? ( Pictures would be good )
What does the Motor, Screw, and any associated linkages look like ?

Do you have the Mechanical-Space for standard "Micro-Switch" Limit-Switches ?,
if not, an Optical-Limit-Switch Solution may be necessary.
Using a Current-Sensor is also possible,
but probably more complexity than You really want.

How long does the LED come on for, and how does that relate to the actions of the Clam-Shell ?
Your description sounds like ............
the LED flashes once, for lets say, ~0.25 Seconds,
You then want the Clam-Shell to Open and Stop, which may take more than one Second,
then when the LED Flashes a second time,
You then want the Clam-Shell to Close and Stop, which may take more than one Second.
Is this correct ???
OR ........
The LED comes on, and stays on, for several Seconds at a time,
and You want the Clam-Shell to Open, and remain Open, for as long as the LED is on,
then after the LED goes out, the Clam-Shell would then close.

The "Module" You linked to will be very useful if it has a decent Current-Rating on the Contacts,
unfortunately, and as per usual, there's no Specifications given for the Contacts,
so there's no telling how long it might last under "DC-Motor-Service",
which is particularly rough on Contact-Life, and especially fast, short-cycling Service,
which BTW, is easily handled, permanently, with the use of MOSFETs for switching,
but I'm guessing you're not really up to that level yet.

Do You know how much Current your Motor draws ?
( You need a cheap-Analog-Multi-Meter, with a moving Needle, to measure it ).

Thread Starter

Lord Drek

Joined Jul 18, 2021
Thank you for bearing with me as I stumble thru the explanation of this and again change the design requirements. Thankfully I feel quite confident tackling the mechanical side of this so no worry there.

I use the term clamshell but this the size and shape I am working with. Motor draws .16 amps as per specs. Shell is 3 1/4” closed and 5” open.

The reverse polarity module works great with just a switch as a trigger it reverses direction with each click. The Photo sensor module only sends a signal when sensing light obviously so I need another trigger signal to get it to close.

The switching relay I linked in prior post will probably work too. Adding diodes to control reversed current bypassing the limit switches will be used in either case.

As in the photo above only those parts need to be in the shell. All relays, modules, sensors will be located remotely under the pinball playfield.

Let me explain the trigger event a little better before I toss an added complication into the mix. The Trigger LED lights continuously when a game condition is met. At this point shell opens and stays open during the period that may be just a few seconds (rare) or up to several minutes. When pinball shot is made LED goes off and shell would then need to close and return to start position.

Two problems with this could occur: First is the shell opening process takes several seconds and on the rare chance LED goes off before a full open state it needs to close. I think that would naturally occur using polarity module. Second problem is more complex. When a pinball machine is not being played it goes into “attraction mode” where all the playfield LEDs blink and light up in various patterns but do not stay lit. Having the shell get triggered constantly and briefly would not be healthy for unit. I need to be able to set a timed threshold to be met before trigger signal occurs. I do not own this game but will be seeing it tonight and will study the LED behaviors closely for a better description.

I may have to go with some programmable chip driven relay to accomplish all this and will do so if necessary. I am learning much from this and have always wanted to be able to add circuits and electronics to my skill set. Thanks for teaching me some new tricks!


Joined Nov 6, 2012
A Microprocessor is not necessary, and they can be a total pain in the butt to program.
Analog Circuits will do amazing things in the right combinations.

Can You Solder well enough to create a small Breadboard Circuit with maybe ~10-parts ?
at a cost of say, less than ~$20.oo ?
Let me know if you're up to it, or you'd rather not.

What is the Voltage-Rating of your Motor ?

What various Voltages do You have available inside the machine, and are they AC or DC.
( Modern Machines are almost always completely DC )

Do You have access to the 2-Wires going to the LED that needs to control this widget ?,
directly accessing those wires could make control much more precise and predictable.
It's difficult to isolate all the various light-sources down to
just one LED without physically sealing them together.

Right now I gotta get some sleep, see ya in ~10-hours or so.


Joined Apr 11, 2010
A Microprocessor is not necessary, and they can be a total pain in the butt to program.
They are a pain in the butt to program, especially if you refuse to teach yourself to code on a microprocessor. If you can code, have spent some time learning that particular technique, then micros are a piece of cake, and can replace learning about many analog parts and techniques.

Analog Circuits will do amazing things in the right combinations.
But if you are a noobie to electronics, analog circuits are a pain in the butt to design. And they may be harder to learn as compared to coding. YMMV

I’ve been coding for 50+ years. For me, I can code a solution far faster than design an analog solution. A few hours for a software/micro solution versus a few days for a discrete component solution.

But that’s me.


Joined Nov 6, 2012
Computers are certainly important,
and many things wouldn't be feasible without them,
but on this particular problem,
once you've established all the required Analog Interfaces,
which has to be done whether a Computer is going to be used, or just a simple Relay,
then you're already 95% done, the rest is very simple.

Then the only thing left is to do everything possible to make the setup extremely reliable,
which, in this case,
adding a Computer would be a detriment.
A Pin-Ball-Machine would come under the heading of a harsh electrical environment.