I have a linear peristaltic pump (salvaged from medical equip. - likely used for dosing, etc). It uses a stepper motor and an optical shaft encoder. I have the motor working but I am confused about getting the wiring for the encoder sorted out. I've already done a search on the number appearing on the part and got no hits.

This is probably very simple - there are 4 wires: red, black, green and white. I don't want to blow the encoder out so I thought I would ask here. Can I assume that:

  • red Vcc 5v
  • black: gnd
  • green: channel A
  • white: channel B

I'll be using this with an arduino - so would I need pull up (or down) resistors on the signal lines? And if I can't assume the above, is there a way I can determine how to wire this up?

And finally, the encoder wheel has two slots in it - and I am trying to figure out what they mean in terms of pump state. Finding initial position at start? Or pump compression state.

enter image description here

enter image description here

  • \$\begingroup\$ It is odd that some of the fingers are missing, is this by design? If it is by design it may be to allow you to stop the pump in a position to open the line and let it purge under gravity. At least one slot is needed to check that the Stepper is turning a full revolution so the dosing is accurate, not sure of the reason for the second slot unless it is to avoid the line remaining open while it steps over that problem area.. \$\endgroup\$ – KalleMP May 2 '17 at 20:30

This is a simple optointerruptor. One side is an IR LED and the other side is a single photodiode or phototransistor. It will detect the presence or absence of an object in the slot. In this case, it will detect the slots in the wheel. You'll need to figure out which side is which. I presume the side with the red wire is the LED. You'll need to power it through a decent current limiting resistor, try 330 ohms if you want to use 5 volts. The detector on the other side is probably a phototransistor. One lead should be grounded and the other one connected to power with a pull up resistor, 1k to 10k. You may have to experiment with the polarity.


The best option is to try to find a datasheet for the pump and/or the photointerrupter. It would include pinouts, safe operating regions, and possibly a diagram of an application circuit. Barring that...

It's not safe to assume that you can just hook up the photointerrupter to +5V. While it's likely that the red and black wires go to the LED side of the photointerrupter, it could just as easily be the green and white wires. The LED may or may not have a built-in limiting resistor. Most likely it doesn't have one. If it does have a resistor, it may be designed for a different voltage and thus be the wrong value for 5V. You can figure out if there is a resistor, it's value, and the forward voltage of the LED by powering it with different resistances and measuring the voltage drop. When doing this test, make sure that you always have enough resistance inline to limit the short circuit current to something unlikely to damage either the LED or phototransistor. 1 mA probably will be safe for both.

The other pair of wires is most likely two sides (emitter and collector) of a phototransistor, and it's not easy to tell which is which. The gain will be greater when biased correctly, but it may still work backwards (reverse-active mode of the phototransistor). Once you have worked out the LED side, you can find the correct polarity for the transistor by measuring the current transfer ratio: \$ \frac{\text{current passed by transistor}}{\text{current through LED}} \$. Whichever way around gives the highest CTR is the right way. Keep in mind that enough light from the LED, or stray light in the environment, may saturate the transistor so that it is no longer limiting the current. Once again, make sure that you limit the short circuit current through the transistor.


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.