Mini-Mapper 8: Photoencoder signals

As the motor encoder disk rotates past the optical aperture of the photointerrupter, a varying proportion of the optical beam between the infrared LED and the phototransistor in the photointerrupter is uncovered. Drawing the profile of the optical beam as a red rectangle and the holes in the encoder disk as circles, it looks like this, as the encoder disk rotates anti-clockwise from a position where a hole is at top dead centre:

Encoder disk motion

The current generated by the phototransistor is going to depend on how much of the radiation from the infrared LED reaches the phototransistor, and that's going to be proportional to the fraction of the cross-section of the optical beam that's allowed through by the hole in the encoder disk.

What does that current signal look like as the holes in the encoder disk move past the optical aperture? It's obviously not going to be a step change from "no current" to "full current", and it might be interesting to see exactly what the current pulses we're going to get from the phototransistor look like. If we can generate time series of the phototransistor current as the encoder disk turns, we can use those current time series to drive LTSpice simulations of whatever circuitry we design to convert the phototransistor current for further processing.

This calculation turns out to be a reasonably simple exercise in analytic geometry, and the final result looks like this graph, which shows the fraction of the optical aperture uncovered by an encoder disk hole as a function of the angle of rotation of the encoder disk from top dead centre:

Overlap area fraction as a function of encoder disk angle

I say "a reasonably simple exercise", but it turned out to be about ten pages of "reasonably simple"... If you're interested, you can see all the details in this document.

What this allows us to do is to create traces like this, which show simulated phototransistor current for a case where the motor starts from rest, accelerates smoothly to 50 mm/s, moves at a constant speed for a little while, then decelerates smoothly to rest again:

Simulated current