I am planning to try to use a shift register to multiply the input capability for binary inputs on a car dash project I'm developing for a hobby car project. I've got a couple of chips on order to do some bench testing, so while I wait for those I'm trying to figure out what the general circuit design should be. I'm going to run two registers in series to give me a total of 16 inputs via SPI.
I have two types of input coming from the rest of the car. Some switch low to ground, some switch hi with 12v (or whatever the car is currently producing).
I guess I will want to shield the IC from anything on the car side, so my plan would be to use opto-isolators to ensure a complete disconnection of the two sides of the circuit. The only trouble is that 8 of them will take up a fair bit of PCB space but I'm sure worth the trouble.
My understanding of how this would connect to the 74HC165 is as follows for the two configurations, does this look about right? The top one has a 12v input, the bottom one has a switch to ground input.
Both wrong I think. On the shift register side, 10K pull-up to 5V on the shift register pin and opto-isolator between the pin and ground. This is because the transistor in the opto is normally npn type
I hope you're not joining the grounds at the opto, though... emitter ground should return to vehicle ground, detector ground to Arduino ground. If they happen to meet somewhere else, it's less likely to inject noise into the Arduino via the ground connection.
I'm having trouble with this. So if the resistor is on the emitter, the "on" state would output 4.4V? Or would it be 5V? Or could it be some higher value?
The previous one I was using (PC817XXNNSZ1B) showed an input range of 2.5 to 30mA so a nice usable range. This one only states a single number of 50mA. Does this mean a maximum of 50mA, or am I targeting 50mA? My question mainly applies to the 12v circuits where the input voltage can vary from I guess 10ish volts to 15ish depending. In this case, how should I size my resistor? I previously went for a 2.7k resistor for the 12v circuits, and 800R for the 5v ones. This would give a fair bit less than 50mA so is that good or bad?
I'm pretty sure 50mA is the maximum allowed constant current allowed through the IR LED. It doesn't say in the column header, but it is in the Absolute Maximum section. Besides, 50mA, or less, would be the kind of number you would see as a maximum. The first graph down below confirms that.
I would think you would want to be well below that value. The 2.5mA might work fine. 5mA almost certainly would. There is probably a graph in the datasheet for that.
The detector base is floating, so there is no emitter-base junction drop at least not as you would normally see. Current carriers in the base emitter junction are produced by photons. So the output would be approximately 5.0V.
Ok. As a thought experiment, suppose nothing was connected to the collector. Can we say anything about the voltage that would appear at the top of the emitter resistor as the IR intensity varies? To those not formally trained, this opto stuff is strange. It seems to be all about current. We don't need no stinkin voltage.
When a (photo)transistor is on, fully saturated, the emitter-collector voltage is low perhaps 0.1V or so, giving 4.9V across the resistor if the supply is 5V. However it might not be fully saturated, the output voltage might be somewhat less.
The base-emitter voltage drop of 0.6V is irrelevant here, as the base is not connected (light is creating an internal photocurrent between base and emitter).