-
Notifications
You must be signed in to change notification settings - Fork 4
CNY70
The Vishay CNY70 is a "reflective optical sensor with transistor output".
https://www.vishay.com/docs/83751/cny70.pdf
It is a small epoxy-potted device containing an infrared LED, and an infrared sensitive phototransistor. A string of the LEDs can be powered together with a constant current source, ideally linear to eliminate noise. The phototransistor's signal can be read as part of a current loop, reducing stray noise.
The exterior dimensions are available in the data sheet, but how about the interior dimensions?
The IR LED is ~0.845mm beneath the surface of the sensor. The phototransistor is ~0.69mm beneath the surface. Both measurements were taking with an optical inspection scope, by bringing the surface into focus, and then bringing the target into focus and measuring the movement of the optical stage. The depth of field is extremely shallow, so this makes a passable nondestructive measurement technique. In both cases the "surface" is the large flat area in the middle, not the raised lip around the case, nor the front of the optical window enclosing the semiconductors.
The optical windows are, as specified in the data sheet, 1.8mm wide.
The LED portion is relatively straightforward. Ideally we want to ensure constant optical power output, but we'll settle for extremely stable constant current supply and cross our fingers.
The phototransistor is somewhat more subtle. We apply a voltage across the collector and emitter, and get our signal out as current on the collector pin. If you take a look at the I_c vs V_ce chart in the datasheet (figure 6) you'll notice that V_ce affects the current (along with the incoming infrared light which we actually want to measure). If we do the simple thing, and put a resistor above (or below) the phototransistor, and measure the voltage between the two, our signal becomes more complicated. As the current through the resistor rises, the voltage increases, which eats into V_ce. If our total voltage across the pair is V, then V - I_c(V_ce)*R = V_ce. That's a complication we might not want. We should really use a transimpedance amplifier, so that we can hold V_ce fixed. Since our current only ever flows in one direction, we can set the positive terminal of the amplifier to our V_Ref (2.00V), power the amp with V_DDA (3.3V), and we'll have plenty of headroom for even a non-rail-to-rail opamp to convert 0mA to V_ref.
See the Analog Stage Theory of Operation for more details, and how this fits in to things.
The phototransistor demonstrated a sensitive to my white LED bench light. 120Hz ripple was present on the output when my light was on, and was eliminated when the sensor was covered by something opaque.
CyberGene has also demonstrated that his piano is sensitive to sunlight, which does has an infrared component.
Care should be taken when designing mechanisms/enclosures to reduce the stray light that the sensors are subjected to.
Per fig 4 of the data sheet, our current transfer ratio varies with temperature. Calibration should be performed after the system has had time to reach a equilibrium temperature. The power we're dropping in the LEDs (~30mW) will act to warm them all slightly. The variation is small enough that the system will probably be reasonable to use immediately after power on, without any sort of temperature adjustment.
0.22637569176151295, 1.0695948671942328
0.5630155581079679, 1.0262241065431217
0.897775921478543, 0.8716171773930375
1.268038007726846, 0.7402433987410841
1.5499634541088025, 0.6460626229520914
1.9206432076850795, 0.5637514544346671
2.379241933799728, 0.46589186534544463
2.97922105043333, 0.369570172576421
3.914795865093453, 0.2628577941123127
4.267933590894852, 0.2325056275974688
4.8501618460895894, 0.1844432036732441
5.433016602276286, 0.1523836211456392
5.9630364414743635, 0.12936906134138113
6.245588388848281, 0.11759177468821687
7.11120392607288, 0.08951199637579196
7.835647906442517, 0.07195373742412231
8.242247050224494, 0.06450537537518118
8.949566670147226, 0.05400473856532373
9.639344262295081, 0.04583184918858765
10.08248929727472, 0.043962852689460555
Dropping the first point and fitting to an exponential gets us: 0.035686123552186075 + 1.251476838129401 * exp(-0.4453148725450985 * x)
. Which appears to fit nicely, and makes sense considering the fairly straight line in a graph with a log Y axis.