What is open collector or open drain?

An open collector or open drain are output pins that are made of a transistor with no connection on top. Without external circuitry they can't really be used. What you do with these is a add a pullup resistor. The resistor works by connecting to the top of the transistor, the collector or drain end, and the other terminal of the resistor connects to the plus power. Now it is a complete circuit. When you drive this output pin it will now work.

What happens is when the transistor is turned on, it puts ground on the output, which is 0. When the transistor is off, the resistor connects the pin to + power, and the output is a 1. Pretty cool huh?

The reason why these open collector and open drain output pins exist is because you can program to current somewhat and they are compatible with the communication protocol I2C. Usually you will pick a 10k resistor if your going to use the pin for GPIO. If it is the I2C protocol on the pin, you will pick a 2k resistor typically.

 

also …

Good Job explaining that.

Can it be thought of as a current source?  Like if you wanted to drive the base of an inverted PNP transistor as a switch to control a load (motor).

 

Interesting idea

Thats a circuit I haven’t thought about or tried. It sounds useful.

16f628

On a 16f628a or 16f84 pic, it is port a.4 wich is open collector.