The main idea is that you can drive the motor (attached to something) from "HOME" position to "END" position and back to "HOME"
Here I go with +12V, but of course it can be done with +5V allso
What you need is a "motor" ( of course)
A relay with "2" change ower function (COM, NO. NC)
2 microswitches (home & end)
Some LEDS (colour of your choice) 5+1pc's. I use a BI-colour LED for the indication of the running direction
Resistor's 5pc's (hmm... @12Volt appr. 680R)
Fuse +fuseholder (fuse depends on the load & what the relay can handle)
4 Flyback diods ( I use 1N4001 diods)
Step 1: The PCB
The function: Activate the relay via external SW / J1:1 with the required voltage to the relay
As long as the external SW / J1:1 is activated the relay is activated and the motor will run "FWD" till it gets to the "END" microswitch, it will stop
When external SW / J1:1 is not activated the relay will fall and the motor will run "REW" till it gets to "HOME" microswitch, it will stop
With them "SW1" and "SW2" you can choose either to "activate" with +12V or with 0V
(Note: You need to use them both switches "SW1" and "SW2" to change the activating polarity).
I'm using "double" flyback diods on both sides of the motor, WHY?
because.... the EMC kickback goes both positive and negative, and the motor runs in rwo directions, thats why, (I learned this double flyback from a DC-motor manufactorer ABB = ASEA BROWN BROWERY)
The PCB is double-sided. As you can notice: the board is designed a way that it's easy to separate them microswitches to be placed anywhere with a cable.
KISELIN made it!