Author Topic: Long wires to transistor base a problem?  (Read 1547 times)

0 Members and 1 Guest are viewing this topic.

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Long wires to transistor base a problem?
« on: April 22, 2021, 02:49:39 pm »
I have breadboard a simple IR obstacle detector circuit using photodiode to NPN transistor base. Collector has 22k to pos rail and drives Schmitt CMOS inverter low which in turn drives second inverter with RC net as pulse stretcher. The 24AWG unshielded wire length between photodiode and transistor is 3 meters. Operating voltage is 5v. It seems to work very well. I need 60 such detectors. Before replicating 60 times is there any reason I should be concerned about the diode to base wire length?

Thank you in advance.
 

Offline fourfathom

  • Frequent Contributor
  • **
  • Posts: 625
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #1 on: April 22, 2021, 04:22:52 pm »
I have breadboard a simple IR obstacle detector circuit using photodiode to NPN transistor base. Collector has 22k to pos rail and drives Schmitt CMOS inverter low which in turn drives second inverter with RC net as pulse stretcher. The 24AWG unshielded wire length between photodiode and transistor is 3 meters. Operating voltage is 5v. It seems to work very well. I need 60 such detectors. Before replicating 60 times is there any reason I should be concerned about the diode to base wire length?

Thank you in advance.

Yes, you need to be concerned with RF interference and transient spikes.  These can cause false detection and damage to your transistor.

Use bypass capacitors at the photodiode and transistor base (sized to not reduce the response time below your application's requirements).  Add a series resistor between the transistor base and the external wire, and some sort of diode clamping to protect the transistor base junctions.
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 4915
  • Country: 00
Re: Long wires to transistor base a problem?
« Reply #2 on: April 22, 2021, 05:39:35 pm »

Is it possible to design it so the transistor sits out by the photodiode, so you aren't running low level signals over a long distance?
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #3 on: April 22, 2021, 09:01:21 pm »
I have breadboard a simple IR obstacle detector circuit using photodiode to NPN transistor base. Collector has 22k to pos rail and drives Schmitt CMOS inverter low which in turn drives second inverter with RC net as pulse stretcher. The 24AWG unshielded wire length between photodiode and transistor is 3 meters. Operating voltage is 5v. It seems to work very well. I need 60 such detectors. Before replicating 60 times is there any reason I should be concerned about the diode to base wire length?

Thank you in advance.

Yes, you need to be concerned with RF interference and transient spikes.  These can cause false detection and damage to your transistor.

Use bypass capacitors at the photodiode and transistor base (sized to not reduce the response time below your application's requirements).  Add a series resistor between the transistor base and the external wire, and some sort of diode clamping to protect the transistor base junctions.

  • I added 100nF at photodiode and at Q base. No detrimental effect on response time.
  • 2.2K was max I could add at Q base before response to low reflectivity object dropped too much. Is 2.2K sufficient?
  • The only zeners I have on hand are 15v. Is it correct to assume I need 5v or 6v zener for the clamp?
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #4 on: April 22, 2021, 09:05:15 pm »

Is it possible to design it so the transistor sits out by the photodiode, so you aren't running low level signals over a long distance?

Yes, however I would then have a long wire input to a CMOS input. Isn't that worse? Projects I have made in the past that had long wires on CMOS inputs always seemed problematic. Although with my limited electronics understanding there are any number of reasons my projects are problematic.
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 4915
  • Country: 00
Re: Long wires to transistor base a problem?
« Reply #5 on: April 22, 2021, 10:52:11 pm »

How small stuff are you comfortable working with?  You can probably get the whole circuit into the sensor end, on a tiny board, and let it pass back the output as a current pulse of a few mA instead of as a voltage pulse.  The difference between the two approaches is essentially that the receiver has a suitably low input resistance, while the transmitter is "beefy" enough to drive that resistance to e.g. 5V at 2mA when the pulse is "ON".  That kind of approach would make the setup pretty much immune to almost any interference.
 

Offline radiolistener

  • Super Contributor
  • ***
  • Posts: 1665
  • Country: ua
Re: Long wires to transistor base a problem?
« Reply #6 on: April 22, 2021, 10:58:53 pm »
Yes, however I would then have a long wire input to a CMOS input. Isn't that worse? Projects I have made in the past that had long wires on CMOS inputs always seemed problematic.

Weak analog signal (like photodiode) through long wire is much more worse than CMOS.

For comparison. If we imagine long wire for CMOS as a tea in the cup which stays in a moving train, then photodiode through a long wire will be like attempt to keep your tea in the cup at the tip of a working jackhammer.  :)
« Last Edit: April 22, 2021, 11:06:40 pm by radiolistener »
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #7 on: April 22, 2021, 11:59:59 pm »

Weak analog signal (like photodiode) through long wire is much more worse than CMOS.

For comparison. If we imagine long wire for CMOS as a tea in the cup which stays in a moving train, then photodiode through a long wire will be like attempt to keep your tea in the cup at the tip of a working jackhammer.  :)

Excellent analogy. I understand.


How small stuff are you comfortable working with?  You can probably get the whole circuit into the sensor end, on a tiny board, and let it pass back the output as a current pulse of a few mA instead of as a voltage pulse.  The difference between the two approaches is essentially that the receiver has a suitably low input resistance, while the transmitter is "beefy" enough to drive that resistance to e.g. 5V at 2mA when the pulse is "ON".  That kind of approach would make the setup pretty much immune to almost any interference.


The off board diode was an attempt to keep all the electronics in one central place. Sounds like not such a good idea now. I have area for larger sensor circuit. I think I should go that direction.

I am also attempting to work from my parts bins. I have a bunch of CD4584 and hundreds of IR pairs. If I put everything at the sensor end then I can tie the four extra gates on the signal out for the beef.
 

Offline fourfathom

  • Frequent Contributor
  • **
  • Posts: 625
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #8 on: April 23, 2021, 12:25:47 am »
  • I added 100nF at photodiode and at Q base. No detrimental effect on response time.
  • 2.2K was max I could add at Q base before response to low reflectivity object dropped too much. Is 2.2K sufficient?
  • The only zeners I have on hand are 15v. Is it correct to assume I need 5v or 6v zener for the clamp?
Can you post a schematic?  This will make it easier for us to recommend any modifications and show you where to place any protection components.

As far as sending a small analog signal over a few meters of wire, and high vs low impedance circuits, your application probably doesn't require anything fancy.  If you can rearrange things so you have a logic-level signal to send, that's probably the better option.  Protecting digital CMOS inputs is actually pretty simple.  Otherwise, your analog signal can probably be filtered and protected easily enough.
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #9 on: April 23, 2021, 12:38:42 pm »
[attach=2]
« Last Edit: April 23, 2021, 12:59:48 pm by LKO Railroad »
 

Offline fourfathom

  • Frequent Contributor
  • **
  • Posts: 625
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #10 on: April 23, 2021, 02:37:26 pm »
What is the part number (or specs) for the photodiodes?  We need to know how much current they will pass when illuminated.  And how are they illuminated?
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #11 on: April 23, 2021, 04:02:58 pm »
I don't have part numbers for the photodiodes or the IR emitters. Both are unlabeled and have been in my parts bin for decades.

They are illuminated by the reflection off an object from the emitters shown in the schematic. Previous measurement shows the voltage at Q collector is ~4V when dark (ambient) and ~100-300mV when illuminated although varies depending upon object color, shape, and surface area. The least reflective object (very thin cross section, satin black color) shows 1.9V at Q collector.

I'll attempt to measure the photodiode current.
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #12 on: April 23, 2021, 04:32:04 pm »
The photodiode current is below my meter's range. With the most reflective object I measure 0.003mA. Typical reflective object measures 0.001mA. The sensor works correctly on low reflectivity objects even though 0.000mA shown on meter.

Is that close enough to help you?
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #13 on: April 23, 2021, 05:09:01 pm »
The photodiode current is below my meter's range. With the most reflective object I measure 0.003mA. Typical reflective object measures 0.001mA. The sensor works correctly on low reflectivity objects even though 0.000mA shown on meter.

Now I REALLY understand tea in a cup.
 
The following users thanked this post: SilverSolder

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 4915
  • Country: 00
Re: Long wires to transistor base a problem?
« Reply #14 on: April 23, 2021, 05:16:03 pm »

I'd try the 3m cable on the output side of that circuit, feeding as low an impedance as you can to keep the noise down.

 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 4264
  • Country: ca
Re: Long wires to transistor base a problem?
« Reply #15 on: April 23, 2021, 06:53:32 pm »
Some observations- you don't want a long run of wire between the phototransistor and the amplifier transistor. Field wiring acts as an antenna and will pick up AM radio, cell phone, cordless phone, DCC or brushes arcing on track over top, a non-grounded 5V PSU etc. The current is so low.

Your detect delay circuit acts only on one edge, 3 seconds once blocked but almost nothing once cleared. So any noise picked up that turns on the amplifier transistor will not be filtered out. I would move the 1MEG to where the diode is. Remove the diode and 1MEG to GND. This gives a delay (noise filtering) both ways. If the phototransistor can pick up room lighting there will be flicker there.

Better to have the transistor nearby the phototransistor, and add a resistor to lower sensitivity a bit as leakage currents from three photodiodes might make the circuit moody.
I'd use a 47k E-B with 10nF in case the photodiode wiring picks up RF noise (brushes arcing).

But that moves a problem to the Schmitt trigger, that gate now has a long wire coming into it and will certainly get ESD hits during installation. CMOS gates don't last with long wires connecting directly to their inputs. Some parts at the gates' input would be needed, but I'm not sure if you are moving the IC near the amplifier transistor.
You are making a small PCB? I would for so many being built.
 

Offline fourfathom

  • Frequent Contributor
  • **
  • Posts: 625
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #16 on: April 23, 2021, 08:06:38 pm »
First, as has been suggested, you might want to use a phototransistor instead of the photodiode.  The phototransistor will conduct more current for a given light intensity, reducing system noise sensitivity.

Since you are directly driving the base of your 2N3904 transistor with the photodiode anode, the cathode connected to +5V, we need to look at the current gain of the transistor.  When the transistor is saturated, the collector pulls about 0.22 mA through that 22K resistor.  The current gain of that transistor is about 70 (minimum), so the required base current is about 3 uA.  This is less than your typical reflective object current, so the transistor's gain is apparently around 200 -- slightly better than the typical value (which is pretty variable).  To allow for transistor gain variation, we would like to see a safety factor of ten, and this is obviously not the case here.  You need a higher-gain circuit, either a phototransistor detector, or perhaps a two-transistor circuit.  A Darlington pair could work, or better yet a "Sziklai Pair" which would give you more voltage across your photodiode (a good thing).  Either of these configurations will have a higher "on" voltage (saturation voltage) but with your 5V CMOS stage this shouldn't be a problem.

You will also want to have a high-value resistor from base to ground to keep any base leakage current or detector dark current from turning the transistor on.  Obviously this also reduces the circuit's sensitivity.  In the absense of any specs I would try 1 Megohm, but I see that floobydust suggests 47k and he may be right.
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #17 on: April 23, 2021, 08:14:39 pm »
Your detect delay circuit acts only on one edge, 3 seconds once blocked but almost nothing once cleared. So any noise picked up that turns on the amplifier transistor will not be filtered out. I would move the 1MEG to where the diode is. Remove the diode and 1MEG to GND. This gives a delay (noise filtering) both ways. If the phototransistor can pick up room lighting there will be flicker there.

The breadboard circuit goes low as soon as reflection occurs. It holds low for 3 seconds when cleared. This is the desired operation. The confusion may lie in that the system receives IR to detect, no IR means cleared. Although I do understand about noise being picked up by the transistor and how replacing the diode with a resistor would minimize that but wouldn't it also introduce delay on the trigger as well as the clear? I don't need, or necessarily want, delay on the trigger edge.

Fortunately the sensors cannot pickup room lighting due to their location.

Better to have the transistor nearby the phototransistor, and add a resistor to lower sensitivity a bit as leakage currents from three photodiodes might make the circuit moody.
I'd use a 47k E-B with 10nF in case the photodiode wiring picks up RF noise (brushes arcing).

But that moves a problem to the Schmitt trigger, that gate now has a long wire coming into it and will certainly get ESD hits during installation. CMOS gates don't last with long wires connecting directly to their inputs. Some parts at the gates' input would be needed, but I'm not sure if you are moving the IC near the amplifier transistor.
You are making a small PCB? I would for so many being built.

The discussion here has convinced me I should put the entire circuit at the sensing location with the 3m wire run being the output. Yes, I will make PCB.
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #18 on: April 23, 2021, 08:28:03 pm »
First, as has been suggested, you might want to use a phototransistor instead of the photodiode.  The phototransistor will conduct more current for a given light intensity, reducing system noise sensitivity.

Since you are directly driving the base of your 2N3904 transistor with the photodiode anode, the cathode connected to +5V, we need to look at the current gain of the transistor.  When the transistor is saturated, the collector pulls about 0.22 mA through that 22K resistor.  The current gain of that transistor is about 70 (minimum), so the required base current is about 3 uA.  This is less than your typical reflective object current, so the transistor's gain is apparently around 200 -- slightly better than the typical value (which is pretty variable).  To allow for transistor gain variation, we would like to see a safety factor of ten, and this is obviously not the case here.  You need a higher-gain circuit, either a phototransistor detector, or perhaps a two-transistor circuit.  A Darlington pair could work, or better yet a "Sziklai Pair" which would give you more voltage across your photodiode (a good thing).  Either of these configurations will have a higher "on" voltage (saturation voltage) but with your 5V CMOS stage this shouldn't be a problem.

You will also want to have a high-value resistor from base to ground to keep any base leakage current or detector dark current from turning the transistor on.  Obviously this also reduces the circuit's sensitivity.  In the absense of any specs I would try 1 Megohm, but I see that floobydust suggests 47k and he may be right.

Understood. I will breadboard a two transistor solution. Only have a couple phototransistors and I am trying to get this entire project built from parts on hand. I have plenty 2n3904. Will also experiment with different base resistors and cap as you and floobydust mention.

I'll let you know my results.
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #19 on: April 25, 2021, 12:44:43 am »
Placement has reduced the lead length between diode and Q to 20cm.

Before I breadboard I wanted to check with you that I have the suggestions incorporated correctly.

[attachimg=1]
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 4915
  • Country: 00
Re: Long wires to transistor base a problem?
« Reply #20 on: April 25, 2021, 01:37:34 am »

Will the 20cm run inside a shielded cable or something like that?
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #21 on: April 25, 2021, 01:44:27 am »

Will the 20cm run inside a shielded cable or something like that?

Yes, it could. I have a roll of 18/2C riser security cable around here somewhere.
 

Offline SilverSolder

  • Super Contributor
  • ***
  • Posts: 4915
  • Country: 00
Re: Long wires to transistor base a problem?
« Reply #22 on: April 25, 2021, 01:48:57 am »

I don't see any reason not to breadboard your idea,  but that is purely a hobbyist perspective...  it seems pretty good use of standard components.  You are unlikely to be hit by chip shortages, LOL!  :D
 

Offline floobydust

  • Super Contributor
  • ***
  • Posts: 4264
  • Country: ca
Re: Long wires to transistor base a problem?
« Reply #23 on: April 25, 2021, 10:08:59 pm »
The circuit looks much better. I would move the 47k to the other side of the 1k for a bit less loss, and the 47k might be the wrong value. I'm not sure when it was changed to a Darlington?
This might give you less sensitivity actually, because a Darlington needs around 1.4V input to begin conducting.
So the photo-current needs to be 1.4V/47k = 30uA and you measured at most 3uA so sensitivity will drop a lot.
I would experiment comparing just one transistor (vs two) and going to 1MEG.

The CMOS gate input I usually put a pullup or pulldown there (if a long wire run) so an open wire/connection does not cause problems.

Your three IR LED's might be running at low intensity because they are all in series and some IR leds are 1.5V each. I would measure the voltage drop across the 220R resistor to see what current they are getting. I would go with 5mA minimum (~100R) but I have no idea of their part # or configuration. Current drain can get big with 60 units.
 

Offline LKO Railroad

  • Contributor
  • Posts: 32
  • Country: us
Re: Long wires to transistor base a problem?
« Reply #24 on: April 26, 2021, 12:47:53 am »
The circuit looks much better. I would move the 47k to the other side of the 1k for a bit less loss, and the 47k might be the wrong value. I'm not sure when it was changed to a Darlington?
This might give you less sensitivity actually, because a Darlington needs around 1.4V input to begin conducting.
So the photo-current needs to be 1.4V/47k = 30uA and you measured at most 3uA so sensitivity will drop a lot.
I would experiment comparing just one transistor (vs two) and going to 1MEG.

I'll move and vary the resistor. The darlington was added per the suggestion of fourfathom.

The CMOS gate input I usually put a pullup or pulldown there (if a long wire run) so an open wire/connection does not cause problems.

Does the 22K not already act as a pull up? The transistor and CMOS are on the same side of the wire run presently. If the transistor is moved to the E/D board then I understand.

Your three IR LED's might be running at low intensity because they are all in series and some IR leds are 1.5V each. I would measure the voltage drop across the 220R resistor to see what current they are getting. I would go with 5mA minimum (~100R) but I have no idea of their part # or configuration.

Referring back to the original circuit, there is a matte black sheet of poster board 80mm across from the emitter detector pairs. It seems to adsorb IR reasonably well. The sensing range is 10 to 30mm. By trial and err I adjusted the LED current and the Q collector resistor such that there was >4v at the CMOS with no object and <2v with the least reflective object at 30mm. Most objects are well below 1v. Manually adjusted bias I guess you would call it. The measured LED current is 6mA. They must be 1.2v forward?

Current drain can get big with 60 units.

Agreed. Dedicated 7805.

Haven't yet been back to the bench to board any of these ideas. Grand kids this weekend. Way more fun than chips and wires.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf