PNP transistor as current detector

Thread Starter

srFelipes

Joined Jul 3, 2020
7
Hello, I'm currently working with a private protocol which uses only 2 wires and I have to replicate. The master device alternates the polarity of a 24v potential between the wires so it is sometimes +24v and others -24v (measured from one of the cables). The slaves answer by connecting and disconnecting an internal resistor to this potential and thus generating a current. In order to replicate the +24v/-24v master part I'm using a transistor based H-bridge circuit, and to detect the slave answer I made a circuit in which the current passes trough a PNP transistor base to emitter, this generates a 24V potential in the collector and then I get the needed 3.3V logical 1 via a voltage divider. I simulated this circuit in falstads circuitjs (http://tinyurl.com/y7rf8v62) and it works like a charm, but when I made the circuit in the protoboard the collector of the PNP transistor is always at 24V, I used smaller values for the resistor divider and the collector voltage dropped but I cannot fully understand whats going on. Later connecting and disconnecting parts of the circuit I noted that this voltage in the collector only occurs when the 1K resistor is connected to the base but its other end disconnected as if there was an small current flowing though the air(?) Does somebody understand what's going on, what causes this small current and collector voltage?

TLDR: I detect 24V in the collector of a PNP transistor when the emitter is connected to 24V and the base is connected to a 1K resistor whose other end is disconnected.pregunta_aac.png
 
Last edited:

Irving

Joined Jan 30, 2016
3,845
All transistors have a small leakage current, akin to the reverse bias current in diode. Also with that base resistor disconnected any ambient pickup wil be amplified and will result in a small collector current.

Since your multimeter has at least a 1Mohm input impedance it only needs a microamp to give you a voltage reading...
 

Thread Starter

srFelipes

Joined Jul 3, 2020
7
Thanks for the answer, I thought it could be something like that. What could I do in order to reduce this voltage generated by the leakage current? other than reducing the resistance of the voltage divider, I thought about using a low gain pnp transistor but I'm struggling to find one, do you know any transistor models of low gain and that is available in sot-23 package? Or do you have any idea of how could I achieve the current detection with another circuit?
Thanks for your help!
 

Irving

Joined Jan 30, 2016
3,845
There's several ways. How is your receiver circuit powered? And how is the transmitting h-bridge connected?
Is the 2-wire line balanced about ground?
how do the slaves connect their resistors?
is the polarity of the line always the same when the slaves signal?
 
Last edited:

Thread Starter

srFelipes

Joined Jul 3, 2020
7
How is your receiver circuit powered? With 2 lab bench power supply, one for the 24V and other for the 3.3V, both share ground.
And how is the transmitting h-bridge connected? Check the schematic in https://tinyurl.com/y7rf8v62 , basically the current detector is in the inner side of the H bridge, initially I thought that maybe the H bridge was generating a current of some sort but the current detection circuit behaves the same if it is powered by the H bridge or directly from the 24V
Is the 2-wire line balanced about ground? Not necessarily all I care is that the voltage drop between the H bridge output is +-24V
how do the slaves connect their resistors? I have no info about this, I'm currently simulating this behavior with a switch and that's why I have the resistor with an unconnected pin
is the polarity of the line always the same when the slaves signal? No, some slaves will answer when the voltage is 24V and others when is -24V, that's why the circuit is mirroed and has diodes in their connections so it works both ways. I also thought that the diodes might cause this problem but removing them didn't help or change anything.

Here it is a picture of the circuit in case that you couldn't see the link above

Inner current detection circuit:
Screenshot from 2020-07-03 19-11-32.pngOuter H bridge circuit:
Screenshot from 2020-07-03 19-10-55.png
 

Irving

Joined Jan 30, 2016
3,845
Ah, I see... and the switched 1k resistor in the simulation is at the slave end. The simulation doesn't work well on my phone!

Is the current detection done that way in the existing setup - I understood you're replicating something already done?

How does the slave detect the +/- 24v without loading the line? How is the 1k switched in/out?
 

Irving

Joined Jan 30, 2016
3,845
I've had a play on your simulator. To prevent detection when the switch is opened you need a resistor from base to emitter. In your setup the 1k resistor at the slave end would pull 22mA through the e-b junction, that's not good for the transistor. When the slave signals sufficient current should flow through the emitter-base resistor to generate a 0.7v differential. most current signalling systems use 4 - 20mA, but i would go low, so lets say 5mA which means 0.7/0.005 =~ 150ohm. That guarantees holding the transistor off when the base is floating. Then the signalling resistor can be bigger, say 3k3. The slave input impedance for sampling master/slave signalling can be, in total, as low as 7k between the lines without triggering the current detection. This looks pretty robust to me. Circuitjs file below...

How many slaves are there in total?
 

Attachments

Last edited:

Irving

Joined Jan 30, 2016
3,845
Yes, I did consider putting in an opamp but once I saw what the problem was it was an unnecessary complication. What the OP had proposed was fine, it just needed finessing. The transistor wasn't introducing error, it was just biased incorrectly, the concept was good.

A dedicated current sense device like the LT6100 would have been expensive overkill.

Sometimes old school is better...
 

Thread Starter

srFelipes

Joined Jul 3, 2020
7
I've had a play on your simulator. To prevent detection when the switch is opened you need a resistor from base to emitter. In your setup the 1k resistor at the slave end would pull 22mA through the e-b junction, that's not good for the transistor. When the slave signals sufficient current should flow through the emitter-base resistor to generate a 0.7v differential. most current signalling systems use 4 - 20mA, but i would go low, so lets say 5mA which means 0.7/0.005 =~ 150ohm. That guarantees holding the transistor off when the base is floating. Then the signalling resistor can be bigger, say 3k3. The slave input impedance for sampling master/slave signalling can be, in total, as low as 7k between the lines without triggering the current detection. This looks pretty robust to me. Circuitjs file below...

How many slaves are there in total?
This is just what I need, I tested it and it works, thanks a lot.
About the high current in the base I also thought this could cause some problems, I read in some forums that as long as the total heat dissipation of the transistor is below its limit there should be no problem but, is this the case, I would love to hear your opinion about this. In the real application the device I'm working on it is thought to be used only once so I don't care too much about its lifespan, but I think that it is clever to use the transistor in this manner to work as a cheap current detector or even measurer.
I can't change the slave resistor value as this is the protocol especification. I understand that in this protocol up to 200 slaves can be connected and they all answer in different time slots so the minimum slave resistor will be 1k all the time.
Thanks again!
 

Thread Starter

srFelipes

Joined Jul 3, 2020
7
Yes, I did consider putting in an opamp but once I saw what the problem was it was an unnecessary complication. What the OP had proposed was fine, it just needed finessing. The transistor wasn't introducing error, it was just biased incorrectly, the concept was good.

A dedicated current sense device like the LT6100 would have been expensive overkill.

Sometimes old school is better...
Exactly, this device should be as cheap as possible so I preffer to use a transistor instead of an opamp but this is indeed a good solution, thanks for the suggestion.
 
Top