??? 07/13/09 04:44 Read: times |
#167159 - Similar to how you let an 8051 output sink to ground Responding to: ???'s previous message |
An open collector will always be low, unless there is something that tries to hold it high. It needs a pull-up circuit - normally a resistor to VCC. Could be a resistor + a LED in series. Could be a relay winding in parallel with a free-wheel diode. Could be a loudspeaker. The important thing is that a open collector or open drain signal does not work, unless you externally connect a positive voltage so that there will be any current to sink.
If you want to connect the signal to your processor, then you will have to also have a 10k resistor to +5V. When the open-collector output is inactive, then the resistor will hold the signal high. When the open-collector output is active, it will sink way harder than the 10k resistor, so the signal will be low. The external 10k resistor will be similar to the high-impedance pull-up resistor in a traditional 8051 input/output pin. If you on the other hand wants the alarm output to control a LED, then you connect something like a 470 ohm resistor to +5V and the other side to your diode. But instead of connecting the other side of the diode to ground, you should connect it to the alarm output of the PIR. When the alarm output is inactive, it will not sink any current. The LED will get +5V on both anode and cathode, so it will not light. When the alarm output is active, it will short to ground, so the current will go from +5V through the resistor and then through the LED and into ground through the alarm output. To use an open collector output to light a LED, you use it like you would normally let a 8051 pin handle a LED, i.e. by letting the pin sink the current to ground. |