Dc Motor Position Switch Hook Up?


Hi all,

I have a DC motor that will be rotating a large heavy robot torso side to side. The torso will be sitting on a lazy Susan and a gear ring. I know I'll need an H bridge and have already bought one from the store here (2.5 Amp Motor Controller). I'm open to getting something else like a motor controller if needed. Any suggestions is welcomed.

Also, I'm trying to figure out the best way to read the location of the end of the rotation on each side and the center position. I want it to be controlled by a script and not RC for mow. I have read of rotation encoders like this: tiny.cc/u8iaiw but I'm more familiar with micro stitches. Seems like the rotation encoder would give me more control of the randomness of rotation. Kinda like a servo. It's important that the torso comes to center after the movement. Anyway, where on the Ez-b would I connect each of sensor devices? Also what control entry in the ez builder would I use?

Thanks in advance for the help, David Schulpius


Hi dschulpius,

I'm looking into trying this for my robot Magnus.



Thanks for the tip. I actually ran across this yesterday when I was searching. Seems like a good way to go. I would think it would hook up to one of the digital ports like a Servo.

Now, if I wanted to hook up a limit switch like a micro switch what port on the EZ-B would I use? Cant be the servo ports. The switch would just short out the board. I read a post by DJ that this could be done but he didn't say what port to use.

Thanks, Dave


Hi Dave,

Any of the Digital Ports can act as an digital input or digital output. Servo ports are considered digital ports. The digital ports are prefixed with the letter D, then a number (0 to 19). They can read input voltage in the range of 0v to a maximum of +5v DC.

See this thread for ideas....


See the Manual for reference info...



Thanks again for the help. Sorry for my ignorance. However I'm learning slowly!



Have you considered using a variable resistor POT (a Potentiometer): http://en.wikipedia.org/wiki/Potentiometer

It works like a volume control Smile So the idea is you put +5 in the center pin, and GND on the Left pin and an ADC EZ-B port on the Right pin.

When you rotate the potentiometer, the ADC will return a voltage varying from 0 to 5 volts depending on the position (0 volts turned left, +5 turned right)

If you attach that to your movement, the computer can know exactly what position the robot is in. And you can specify what position to move to. That will be far more accurate and flexible than switches.

Get a Potentiometer and connect it as i described to test. Once you've done that, i can help you with the coding part.


Thanks DJ. I'll give it a try and get back to you if I need the help. It's great to know there's help out there!