For a project where I am interfacing with an old control panel for a ventilation system, I have come across the circuit in the attached schematics. This is part of a larger circuit and sits on the Tx line of a PIC16F873 (at _Tx) and goes to a main unit (at Tx) through a 15-20m long cable (standard soft .75mm2).
The communication over the line is standard UART at 9600 bauds/s.
It looks like the first transistor is inverting the signal, but I cannot figure out the purpose of the second transistor or if they have some special functionality when combined in this manner.
Can anyone help me figuring out what this part of the circuit does?
Looks like a level shifter made from a pair of BJTs (as opposed to the more common modern technique using a single low Vgs(on) MOSFET and 2 resistors)
The circuit is probably for boosting the current and/or voltage. The 2nd transistor would re-invert the signal and it could potentially further-increase the current capability. But, I’m guessing it’s just to keep the signal from being inverted.
It looks like the first transistor is inverting the signal,
And that is what the second transistor does as well so that the signal emerges the right way up. The second transistor also provides what is called an open collector output. That means all it does is pull down the line not drive it high. The diode protects the transistor in the event of connecting the collector to a negitave voltage.
Open collector outputs are common on long runs when you need to boost the signal to 12V in order that the signal gets to the far end. And it also prevents the 5V of your control signal traveling the length of the run and picking up interference.
This setup is good for about half a kilometre distance. When I worked in the access control industry all serial communications was done with open collector outputs like this.
Thank you very much for your replies.
Double inversion of the signal makes sense only if something else is going on.
What Grumpy_mike suggests seems very likely given the potentially very long line between the control panel and the main unit of the ventilation system.
I have recreated the circuit on a breadboard and when feeding it 5v on _Tx I can measure about .67v on Tx when not connected to anything, which I suppose fits well with the open collector output.
Would it be correct to assume Tx to rise to about 5v when connected to the other unit, which has a pullup resistor to 5v?
Would it be correct to assume Tx to rise to about 5v when connected to the other unit, which has a pullup resistor to 5v
Yes. Or to what ever voltage it pulls up through.
Excellent, then I understand how it works. I have never worked with open collector outputs nor serial communication over long distances.
You have been a great help. Thank you very much!