Encoder Sensor Analysis
The goal of this analysis is to make a decision on buying the Lynxmotion SingleLine Detector (SLD) or the Hamamatsu Photoreflector (HAMP) to use in detecting the encoder pattern. Even from a qualitative point a view the decision is still not easy. The SLD is $14.95 and the HAMP is $2.20. If I go with the HAMP, I can purchase 2 more IR distance rangers. However, minimal external circuitry is needed to interface with the brainstem. While the SLD comes with three convenient wires that can be directly plugged into the brainstem. As far as mounting issues, the HAMP will be a little more difficult, since its pins are small and may need to be first mounted on a PCB.
The quantitative analysis will focus on the frequency response of the 2 sensors because I have mounted the encoder disk onto the high RPM shaft of the motor. I do not know the RPM of this shaft, but it is fast! First take a look at the 2 datasheets, HAMP datasheet and the SLD datasheet. Note that what I call the SLD datasheet is the datasheet for the IR sensor and not the User's Guide given here. After all the circuit will not be faster than the IR sensor.
Looking at the rise and fall times shown in the graphs of the datasheets, the worst cases are 1 milliseconds for the SLD and 4 microseconds for the HAMP. Figure 1 depicts the relationship between the pulses and the encoder.

figure 1
The quantitative analysis will focus on the frequency response of the 2 sensors because I have mounted the encoder disk onto the high RPM shaft of the motor. I do not know the RPM of this shaft, but it is fast! First take a look at the 2 datasheets, HAMP datasheet and the SLD datasheet. Note that what I call the SLD datasheet is the datasheet for the IR sensor and not the User's Guide given here. After all the circuit will not be faster than the IR sensor.
Looking at the rise and fall times shown in the graphs of the datasheets, the worst cases are 1 milliseconds for the SLD and 4 microseconds for the HAMP. Figure 1 depicts the relationship between the pulses and the encoder.

figure 1
At the 'start' where the red arrows are and going in a counter clockwise direction, the voltage will be 0 corresponding to the reflectance of the white. There are 2 quantities of interest here. One is the rise and fall time of the pulse and the other is the length of the pulse. Since the SLD could take 1 ms to 'rise' to 5 volts when it goes into the black area and then 1 ms to fall back down to 0 volts, there could clearly be issues if our pulse was 2 ms wide. This could create either a triangle with an analog input or a missed pulse for a digital input. So without caring about the pulse width, I'll call this 2 ms for the rise and fall the theoretical limit. It should not be attempted to use the SLD sensor for anything near this speed or faster. The HAMP sensor had a rise and fall time of 4 microseconds, so each pulse will have a limit of 8 microseconds.
Next, we are concerned with what this translates into the fasted RPM that the sensor can deal with no regard on how the microcontroller will sample the signal (this will come later). For my case (and this will change based on encoder disk), I have 4 pulses per revolution as you can see in figure 1. This means the limit for the SLD will be 8 ms per revolution and for the HAMP it will be 16 microseconds. There are 2 rises and 2 falls for 1 revolution so multiply the rise/fall time by 4.
Finally, to get the RPM limit we need to convert microseconds and ms to minutes. Essentially, think that there are 8 ms per revolution so how many revolution can be done in a minute. First convert to seconds so this is 8 x 10^-3 seconds. Then convert to minutes so divide by 60 to get 1.33 x 10^-4 minutes per revolution, but we want revolutions per minute so take the inverse, which yields a theoretical limit of 7500 RPM. Doing a similar calculation for the HAMP, yields a limit of 3,750,000 RPM. Clearly, we want to stay away from this limit so choosing a 50% 'safety' margin gives a max of 3750 RPM for SLD and 1,875,000 RPM for HAMP. If I choose HAMP, the limiting factor will be sampling the sensor and not the sensor itself. However, the SLD is too close to risk so I'll be ordering the HAMP. Look forward to an article on interfacing this to the brainstem in the coming weeks.
Next, we are concerned with what this translates into the fasted RPM that the sensor can deal with no regard on how the microcontroller will sample the signal (this will come later). For my case (and this will change based on encoder disk), I have 4 pulses per revolution as you can see in figure 1. This means the limit for the SLD will be 8 ms per revolution and for the HAMP it will be 16 microseconds. There are 2 rises and 2 falls for 1 revolution so multiply the rise/fall time by 4.
Finally, to get the RPM limit we need to convert microseconds and ms to minutes. Essentially, think that there are 8 ms per revolution so how many revolution can be done in a minute. First convert to seconds so this is 8 x 10^-3 seconds. Then convert to minutes so divide by 60 to get 1.33 x 10^-4 minutes per revolution, but we want revolutions per minute so take the inverse, which yields a theoretical limit of 7500 RPM. Doing a similar calculation for the HAMP, yields a limit of 3,750,000 RPM. Clearly, we want to stay away from this limit so choosing a 50% 'safety' margin gives a max of 3750 RPM for SLD and 1,875,000 RPM for HAMP. If I choose HAMP, the limiting factor will be sampling the sensor and not the sensor itself. However, the SLD is too close to risk so I'll be ordering the HAMP. Look forward to an article on interfacing this to the brainstem in the coming weeks.








