Author Topic: Understanding transistors  (Read 17681 times)

0 Members and 1 Guest are viewing this topic.

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Understanding transistors
« on: May 17, 2017, 10:54:02 pm »
Another newbie question.  I'm running in circles, having tried several different approaches. I have a 12v line that I want a "high" from an arduino to turn on. Simple right? Well, every time I attempt anything with the few transistors I have (getting a better collection by the weekend) I don't see anything remotely as I thought I would.  In particular, as I tried this option https://electronics.stackexchange.com/questions/17581/best-way-to-get-5v-or-12v-or-0v-from-arduino-pin/17584 in particular this circuit:
nothing works.

So I've simplified things things, and I have a single 2N3906 PNP transistor (I know, not the one mentioned in the drawing - it's all I have). I apply 12v to the emitter. NOTHING to the base. And I measure 12v on the Collector. Base isn't even pulled to ground (if I do it short circuits so there's definitely something I don't get). If I measure the base I get about 6v on it? When I build the circuit referred here with a 2222 and 3906 all I get is a constant voltage regardless of applying a voltage to the base of the 2N2222a.

I've read and followed quite a few talks (youtube etc) and well, I thought I understood transistors. Granted, it's much easier for me to understand the NPN than PNP, but still I thought I had the basics down.  Even with 5 volts on the collector on an NPN I don't seem to be able to fully turn off the power. Not sure why - in particular I'm not sure why I see a voltage on the 2N3906 when I have nothing connected to the base, just the emitter (and the collector is going through a 2Kohm resistor to ground to simulate a small load).

My question is very simple. I obviously need a "dummies guide" here. What's a good source to get what's going on here? ALL I really wanted to learn was creating a switch using a transistor that turned on/off a higher voltage. And there in lies one of my issues I think. I'm focused on voltage, not current here. Is that the issue?
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #1 on: May 17, 2017, 11:30:30 pm »
A PNP transistor is exactly the wrong device.  The proper way to interface with voltage limited devices like uC IO pins is to use an NPN transistor - 2N3904

Here is more info but note that down under "gotcha's", you can't have a voltage higher than the uC Vcc.  In general, this is true.  There are exceptions but I won't go down that path.

http://www.w9xt.com/page_microdesign_pt8_pnp_switching.html

You can Google for 'Arduino PNP relay driver' to see what you can find.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Understanding transistors
« Reply #2 on: May 17, 2017, 11:38:59 pm »
First off, there is no black magic.  The electrons always know what they are doing.  The problem is when we think we have done everything right.  One or more of your transistors is damaged or not hooked up correctly.  Start with the 3906, with a 10K or so resistor connected to common it should be able to turn on and off.  Always have some load on it as just some noise in the air can turn it on somewhat.  Meters can be very sensitive.  Any drawings found on the internet are questionable.  The designs are often not suitable for you application.  Some transistors of relatively the same number can have different pin outs. So start with this simple test first.
 

Offline sokoloff

  • Super Contributor
  • ***
  • Posts: 1799
  • Country: us
Re: Understanding transistors
« Reply #3 on: May 17, 2017, 11:42:02 pm »
You have a 2N2222A in your hand. That's an NPN BJT, exactly what you want for this application, assuming you can "sink" the current from the load through the transistor (rather than "source" the current out of the circuit). If you can switch the low-side, it's a fairly trivial and standard circuit. Try to get that to work first, IMO.

Follow any of the various tutorials, using the 2N2222, and then tell us where/if you get stuck.
Here's one, semi-randomly chosen: https://teachmetomake.wordpress.com/how-to-use-a-transistor-as-a-switch/
« Last Edit: May 17, 2017, 11:44:19 pm by sokoloff »
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Understanding transistors
« Reply #4 on: May 18, 2017, 12:16:45 am »
You may have blown some of your transistors. Particularly if you connected the base of the PNP transistor to 0v while the emitter is at 12V. If you did put the full current of the 12V supply through the transistor base, and you may have turned it into a lump of shorted metal internally.

Here is how to test the transistors:
https://www.electronics-notes.com/articles/test-methods/meters/multimeter-diode-transistor-test.php
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #5 on: May 18, 2017, 01:05:13 am »
in particular this circuit:
nothing works.

That circuit should work with a 2N2222A substituted for the 2N4401.
Check your pinout...

You will need to be certain that your uC output can get up to 5V or so.  I would put a 330 Ohm resistor in series with the 2N4401 base to limit the current from the uC.

Don't count on this circuit working with a 3.3V uC.  With the 12V and resistors shown, the base needs to get to 4.5V in order to get the transistor to turn on.  It will need more to get the transistor fully saturated (which may not be terribly important).

« Last Edit: May 18, 2017, 01:06:52 am by rstofer »
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #6 on: May 18, 2017, 01:11:04 am »
You may have blown some of your transistors. Particularly if you connected the base of the PNP transistor to 0v while the emitter is at 12V. If you did put the full current of the 12V supply through the transistor base, and you may have turned it into a lump of shorted metal internally.

I made myself a little gadget a long time ago that I've used to measure transistors, diodes etc. I'm color blind, so I have to measure everything that uses colors - makes me slow as snails doing anything but it's fun none-the-less.  I'm attaching two pictures here showing me testing both the PNP and NPN transistors in the circuit, and they both come up "working". I definitely made them go hot for a few seconds. But I use a current limiting PSU so the through-put is maxed out at 300 mA for this setup. That said, I've tried to replace the NPNs before and found no difference, knowing it came down to how I was using it and not something broken.

I'll check your link out, but so far I don't think that's the issue here.
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #7 on: May 18, 2017, 02:19:52 am »
Thanks for the advice - I went even further back to basic, recreated stuff I've done before and that worked. I still didn't see 0 volt (more about that in a moment) but I did see the LED go on/off on the collector side when the base got +5v (using 2n222a). So far so good.

Back to the not seeing 0 volts. I think I'm confusing potential with actual voltage. If I put the meter gnd on gnd, and place the plus on the collector pin, there's a voltage potential between that point and ground through the resistor and LED/Diode. However, if I place the meter on the emitter I get the voltage potential of +5v because the emitter is connected straight to ground. So I'm back to a question I've posted about before, on how to actually measure what voltage is being "turned on".  That said, when the transistor is "on", I get a full potential of 5v as there's now a straight line to ground. So I see a difference. I just didn't see 0 volt - again getting the current confused with voltage (potential). At least that's my working theory.

So what's the right way to measure? I took a picture of my setup on a bread board. I added back my booster to so I could get the 12v. I then connected the boosters + to the collector through a load resistor of about 1MOhm. I added a few comments on the picture indicating where I did the measurements, but you probably have to zoom in to see them. I'm absolutely NOT seeing 0v anywhere but that probably is how it should be. So that leads me to the question on how to determine if a basic 2222a transistor is turned on or off? I guess I have to find a way to measure current, and forget all about measuring voltage (potential)?
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Understanding transistors
« Reply #8 on: May 18, 2017, 02:38:19 am »
Haven't you got the transistor around the wrong way? Looks like you have the emitter connected to the load resistor.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #9 on: May 18, 2017, 02:58:04 am »
There's no chance of figuring out what that breadboard circuit should do without the corresponding schematic.

That said, why such a high value load resistor?  How about something reasonable like 1k or so?

You meter should probably have the black lead connected to ground or the negative output of the power supply.  Every measurement in a circuit like this is relative to common ground.
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #10 on: May 18, 2017, 03:46:05 am »
Haven't you got the transistor around the wrong way? Looks like you have the emitter connected to the load resistor.

The flat side is going away from the camera. When I look at the datasheet for the 2222A it seems it's "reverse" order from others I've used, so you have to turn it around from what you expect. At least what I would expect from the transistors I've dealt with in the past. So no, the resister is connected to the collector side. And there's another resistor on the base.
 

Offline amspire

  • Super Contributor
  • ***
  • Posts: 3802
  • Country: au
Re: Understanding transistors
« Reply #11 on: May 18, 2017, 06:00:21 am »
http://www.onsemi.com/pub/Collateral/P2N2222A-D.PDF
http://s680.photobucket.com/user/sorgil613/media/Elelctronics%20Components/Transistors/PN22222-h.jpg.html

Here are two datasheets of variants from the same manufacturer with the opposite pinout. It comes down to the exact manufacturer and part number. The 2N2222A is actually a metal can transistor. Many manufacturers called the plastic TO92 variant PN2222A with the emitter on pin1 or in the case of Onsemi (Motorola in the old days) P2N2222A for the version with the collector on pin1.

One way of checking is to check the emitter-base and  collector-base diode junctions with a diode mode on a multimeter. The emitter-base junction will have a lower voltage because it is more heavily doped.

If you reverse the emitter and the collector, you will end up with a much lower gain transistor and also the emitter-base junction when used as a collector-base junction breaks down like a zener at 5V to 9V.


« Last Edit: May 18, 2017, 06:04:24 am by amspire »
 
The following users thanked this post: bitman

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Understanding transistors
« Reply #12 on: May 18, 2017, 09:55:08 am »
I wanted to start with first steps, but I probably should have said not to use that circuit. That circuit is too clever for you or most anyone.  It is a very fast way to blow up a micro should anything go wrong.  Modify it so the base of Q1 has the 4.7K going to your signal source.  The emitter resistor is eliminated and connected directly to common.  This will define how much current goes through the base. That multiplied by the gain of the transistor how much current the collector is capable of.

The direct connection of the collector to the base of the other transistor is really bad. Use a 2.2K to 4.7K resistor between the two.  That will define how much current the base will see. Multiplying the gain will give the current  Q2 is capable of driving. All very straightforward.

The circuit you posted will destroy things quickly if anything is no connected correctly.

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #13 on: May 18, 2017, 12:16:29 pm »
I wanted to start with first steps, but I probably should have said not to use that circuit. That circuit is too clever for you or most anyone.  It is a very fast way to blow up a micro should anything go wrong.

What this circuit?


What's wrong with it? I'd probably reduce the value of R3 for faster switching but otherwise it's a good circuit. I've used it before with no problems.
 

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Understanding transistors
« Reply #14 on: May 18, 2017, 01:15:44 pm »
"It is a very fast way to blow up a micro should anything go wrong."

I think that is self explanatory.  I didn't say it didn't work.  The OP has not managed to hook up two transistors without destroying them. It is harder for a beginner to understand the principles of operation. I have a problem with R1.  I don't think you are helping this person with these diversions. Focus on trying to help him instead of trying to show how smart you are.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #15 on: May 18, 2017, 02:28:52 pm »
"It is a very fast way to blow up a micro should anything go wrong."

I think that is self explanatory.  I didn't say it didn't work.  The OP has not managed to hook up two transistors without destroying them. It is harder for a beginner to understand the principles of operation. I have a problem with R1.  I don't think you are helping this person with these diversions. Focus on trying to help him instead of trying to show how smart you are.
It isn't self explanatory to me, and possibly the original poster too, how that circuit can blow an MCU output. By explaining what you may consider to be obvious, you'll help both the original poster and me.
 
The following users thanked this post: tooki

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Understanding transistors
« Reply #16 on: May 18, 2017, 03:53:49 pm »
If the OP uses good parts and connects it as it is supposed to, it will work.  Then why are we here?  He didn't. If it had been connected to a NANO, the conversation may have been about cheap Chinese stuff that never works. The "base" input could output a lot of current if it isn't the base or the transistor magically shorts. Of course, it could have just barely worked because, being a high side driver, he is likely trying to power something that needs a lot more current and R1 is a little high for that. 

This thread will descend into that other thread, equivalent to how to connect a light bulb, that is 8 pages and 99% of the posts don't even relate to the OP's problem. That poster hasn't returned. Did he really get any help?  I will only respond to any future posts of the OP. Your last post was a waste of good bandwidth. Good Day.
 

Online mikerj

  • Super Contributor
  • ***
  • Posts: 3237
  • Country: gb
Re: Understanding transistors
« Reply #17 on: May 18, 2017, 04:21:13 pm »
You have created unnecessary confusion by stating this circuit is "too clever for you or most anyone" when there's nothing actually wrong with it.  The OP could blow up the ports on his micro with a myriad of different circuits if he doesn't assemble them correctly, there's nothing particularly risky about this circuit.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #18 on: May 18, 2017, 04:52:21 pm »
One of the risks in this project is applying 12V to a uC output pin, with or without a series base resistor.  That the schematic doesn't even show a base resistor causes me an issue.  The only reason the circuit works is that 4.3k resistor that raises the emitter voltage which raises the base voltage to a point where the current flow doesn't harm the uC.  I would still put a 330 Ohm resistor in series with the NPN base.  I pretty much use 330 Ohm in series with all inputs and outputs just to protect the uC or FPGA.

I ran an LTSpice simulation with no base resistor and the base current is just 10 uA but I only had a 1k load on the output.

The thing about transistor circuits is that you must start with the output current and work backwards.  I don't recall a load being given for the PNP transistor.  First we get that current, then we guess at the required base current based on some estimate of hFE then we figure out how much collector current the NPN (base current of PNP plus 10k resistor current) will have and with another estimate of hFE for the NPN, we get a required base current.

That 4.3k resistor limits the PNP base current and needs to be reconsidered.  The simulation works with a 1k load, it does not work with a 10 Ohm load.

 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #19 on: May 18, 2017, 05:48:12 pm »
One of the risks in this project is applying 12V to a uC output pin, with or without a series base resistor.  That the schematic doesn't even show a base resistor causes me an issue.  The only reason the circuit works is that 4.3k resistor that raises the emitter voltage which raises the base voltage to a point where the current flow doesn't harm the uC.  I would still put a 330 Ohm resistor in series with the NPN base.  I pretty much use 330 Ohm in series with all inputs and outputs just to protect the uC or FPGA.

I ran an LTSpice simulation with no base resistor and the base current is just 10 uA but I only had a 1k load on the output.

The thing about transistor circuits is that you must start with the output current and work backwards.  I don't recall a load being given for the PNP transistor.  First we get that current, then we guess at the required base current based on some estimate of hFE then we figure out how much collector current the NPN (base current of PNP plus 10k resistor current) will have and with another estimate of hFE for the NPN, we get a required base current.

That 4.3k resistor limits the PNP base current and needs to be reconsidered.  The simulation works with a 1k load, it does not work with a 10 Ohm load.



The base current is independent of the load current and is set by R3, so there's no need for any base resistor which will do nothing.  I agree, the load current needs to be considered. As drawn, the circuit will be able to supply loads of up to 50mA or so before the saturation voltage becomes unacceptable (>1V or so).

Another newbie question.  I'm running in circles, having tried several different approaches. I have a 12v line that I want a "high" from an arduino to turn on. Simple right? Well, every time I attempt anything with the few transistors I have (getting a better collection by the weekend) I don't see anything remotely as I thought I would.  In particular, as I tried this option https://electronics.stackexchange.com/questions/17581/best-way-to-get-5v-or-12v-or-0v-from-arduino-pin/17584 in particular this circuit:
nothing works.

So I've simplified things things, and I have a single 2N3906 PNP transistor (I know, not the one mentioned in the drawing - it's all I have). I apply 12v to the emitter. NOTHING to the base. And I measure 12v on the Collector. Base isn't even pulled to ground (if I do it short circuits so there's definitely something I don't get). If I measure the base I get about 6v on it? When I build the circuit referred here with a 2222 and 3906 all I get is a constant voltage regardless of applying a voltage to the base of the 2N2222a.

I've read and followed quite a few talks (youtube etc) and well, I thought I understood transistors. Granted, it's much easier for me to understand the NPN than PNP, but still I thought I had the basics down.  Even with 5 volts on the collector on an NPN I don't seem to be able to fully turn off the power. Not sure why - in particular I'm not sure why I see a voltage on the 2N3906 when I have nothing connected to the base, just the emitter (and the collector is going through a 2Kohm resistor to ground to simulate a small load).

My question is very simple. I obviously need a "dummies guide" here. What's a good source to get what's going on here? ALL I really wanted to learn was creating a switch using a transistor that turned on/off a higher voltage. And there in lies one of my issues I think. I'm focused on voltage, not current here. Is that the issue?
You haven't said how much current your load draws?

Try assembling the circuit as per the attached picture. If your transistor tester is working, the pins on the transistor pictures will be correct. For a test load, use something which doesn't draw much current, such as an LED in series with a 330R resistor or a small (<50mA) piezo buzzer.

« Last Edit: May 18, 2017, 05:50:03 pm by Hero999 »
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Understanding transistors
« Reply #20 on: May 18, 2017, 06:56:33 pm »
Something I remember confusing me early on which may be going on here. The Emitter is always the one with the arrow on it, even though with a PNP connection the arrow is pointing toward the junction rather than away from the transistor. Without going into the reasoning of why that is, or getting into the conventional theory vs electron theory debate it's important to remember that current is assumed to flow in the direction of the arrow.

With NPN, you need to lift the base up relative to the emitter which is typically grounded in a switching circuit. With a PNP you need to pull the base down relative to the emitter which is typically connected to the V+ source. In both cases the base needs to be protected with a current limiting resistor as transistors are current-driven devices. Trying to drive a constant voltage through the B-E junction will burn it out.
« Last Edit: May 18, 2017, 06:58:43 pm by james_s »
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #21 on: May 18, 2017, 08:26:10 pm »

The base current is independent of the load current and is set by R3, so there's no need for any base resistor which will do nothing.  I agree, the load current needs to be considered. As drawn, the circuit will be able to supply loads of up to 50mA or so before the saturation voltage becomes unacceptable (>1V or so).


Yes, the base current is the independent variable.  We can put as little or as much through the base as we wish, subject to not melting the base-emitter junction.  The collector current, the thing we really want, is determined primarily by the base current.  If we only have a few microamps of base current and a gain of, say, 100, we will only get a few hundred microamps of collector current.

So, that 4.3k resistor needs to be sized to provide enough collector current and in this case, the maximum base current is approximately 1 mA.  So, for an fFE on the PNP of, say, 100, the maximum collector current will be 100 mA.  So a load resistance of 120 Ohms is about the maximum.

The simulation shows the output just starting to fall off 12V when RL is 150 Ohms.  I just used generic transistors so I'm not sure what value of hFE is being used.  Somewhere around 85 mA is the maximum load current.   According to the simulation, using a 150 Ohm load, the PNP base current is just about 890 uA so with a gain of 100, somewhere near that 85 mA is possible.

Clearly, this isn't much of a driver using the values given.

But, we still don't know the load requirement (or at least I don't).
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #22 on: May 18, 2017, 10:02:09 pm »

The base current is independent of the load current and is set by R3, so there's no need for any base resistor which will do nothing.  I agree, the load current needs to be considered. As drawn, the circuit will be able to supply loads of up to 50mA or so before the saturation voltage becomes unacceptable (>1V or so).


Yes, the base current is the independent variable.  We can put as little or as much through the base as we wish, subject to not melting the base-emitter junction.  The collector current, the thing we really want, is determined primarily by the base current.  If we only have a few microamps of base current and a gain of, say, 100, we will only get a few hundred microamps of collector current.

So, that 4.3k resistor needs to be sized to provide enough collector current and in this case, the maximum base current is approximately 1 mA.  So, for an fFE on the PNP of, say, 100, the maximum collector current will be 100 mA.  So a load resistance of 120 Ohms is about the maximum.
Be careful when going by Hfe figures listed on data sheets. They're often given when the transistor is not in saturation and there will be a high voltage loss, if you just about give the transistor enough base drive for the required collector current. To get the transistor into full saturation the base current needs to be an order of magnitude higher. Fortunately the 2N3906 specifies the Hfe of 60, at a VCE = 1V which is probably acceptable for a 12V circuit.

https://www.onsemi.com/pub/Collateral/2N3903-D.PDF
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #23 on: May 18, 2017, 11:05:16 pm »

Be careful when going by Hfe figures listed on data sheets. They're often given when the transistor is not in saturation and there will be a high voltage loss, if you just about give the transistor enough base drive for the required collector current. To get the transistor into full saturation the base current needs to be an order of magnitude higher. Fortunately the 2N3906 specifies the Hfe of 60, at a VCE = 1V which is probably acceptable for a 12V circuit.

https://www.onsemi.com/pub/Collateral/2N3903-D.PDF

I usually assume a MUCH lower value of hFE, perhaps as low as 10 unless it is a power transistor and then definitely 10 or less (2N3055).  From the On Semi datasheet for the 2N3904, we can see the truly grim gain characteristics for the On condition of Vce about 1V.

https://www.onsemi.com/pub/Collateral/2N3903-D.PDF - page 2

Using an hFE of 10 isn't unreasonable.  If the output stage has a load of 100 mA then the PNP will need at least 10 mA of base current so the NPN will need at least 1 mA of base current.

But regardless of the value of gain, the process begins at the output.  First we need the load current.  Then the datasheets...
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #24 on: May 19, 2017, 12:49:38 am »
Wow - thanks for all the replies here. Note, I only have a few hours at night spread over the week to do this, so I'm a bit slow with replies and followups.

I took the initial posts realizing I needed to make a small test circuit to "prove" I could get the transistor working. As it's been pointed out there, I've had the transistors turned the wrong ways at times - looks like there's no consistency on the pin connections even using the model number - well, another newbie lesson learned. And yes, it is really confusing when most data sheets just shows the metal cap and others are bad photo-copies scanned in.  That said, I managed to get a very simple 5v setup working. When I applied current through a resistor on the base, rgw LED turned on. I even got it to reverse so the LED turned off when I applied a current to base. Happy camper, it works as I hoped it would. So that got me thinking that all I needed was ONE transistor so I created this small circuit  This is part of a slightly larger of my EEPROM writer/reader thing - I've left out a lot details that doesn't deal with the transistor side.

In essence I'm getting outputs from a 74-595. Only ONE line is going to be active at a time (software controlled). When the A line is high, I want to apply 14v, when the B line is active, I want 12v and when the C line, I want the lined grounded. This goes into a W27C512's OE line needed to indicate the state of the operation (read, write, erase). I combine the emitter output through a diode so there's no feedback current/voltage.  Now, I wouldn't be writing this if this worked.

So I started out with the two transistor option, as that is what searching around seemed to indicate I needed. Since I'm not able to fully explain WHY I need 2, I have attempted what I thought was a more straight forward solution. Since I got a bunch of 3906 and 2222As for a few dollars on Ebay I have plenty to experiment with, to destroy so if that happens it's not a big deal. Perhaps they're not the best ones for this, but my simple reading of the data sheet seems to indicate they're safe up to 20v and since my current need/input is low I didn't think I needed "specialized" transistors for a small proof of concept.

Of everything written so far by everyone, it's clear "I don't get it". The simple math stuff being used to explain the resistor sizes is foreign to me. Not the math itself, but why it's used. So I definitely need to go back to basis. I'm slowly going through the book "Practical Electronics for inventors, fourth edition" when I have time. But so far it's been great at putting me to sleep - talking quantum physics when all I want to do is figure out how to do simple logic based circuits is a bit too much for me. I've not yet gotten to the transistor section yet so I probably should give my experiments a rest and do some reading (I learn best by doing). I definitely need to get a better understanding of hFE and similar concepts so I can measure/plan out what will work. A lot of what I've done so far is simply trying things out with low voltage and limiting the current to 200mA (or use a battery).

So if the original layout/schema is the way to go,  I'll setup another separate circuit and give it a try. I did try with 14V on the collector and that seemed to work. Only problem is that I always get the potential voltage when I measure the C/E of the transistor - so I'm not really sure it's actually working with 14v. It didn't get hot etc. so it looked like it was working.

So now that I've showed a rough diagram of what I now thought was the better solution, I'm sure the feedback will be even heavier on what not to do. Anyway, my problem is that when I measure on the voltage where pin 14 will be, I do even remotely see the voltages I see on the collector. And the emitter currents are MUCH SMALLER (50% or so) than what's coming in on the collector (voltage potential) so well, I'm not sure why that is.

Thanks again for the feedback. Amazing forum and people here.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #25 on: May 19, 2017, 01:10:06 am »
Well, you're right, there will be comments...

There is no way this circuit is going to work.

The outputs of the 74LS595 can, at most, get to 5V and the transistor emitters can only get to 0.7 volts less or 4.3 volts.  The rest of the supply voltage will be dropped across the transistor.

It looks like Q3 just sends the emitter directly to ground which is ok but I don't see where that does much with the diode.  ETA:  If the idea is to send 5V to the diode, get rid of the ground connection.

It would have helped enormously if you had told us the application earlier.

Your original 2 transistor circuit is much better because the PNP will deliver the proper voltage while the NPN will interface with the logic.

You need to account for the diode voltage drop (0.7V) so you won't get 14V, you will get 13.3V or, actually about 0.2V less if you can somehow get the transistor into saturation, which you can't when driving the base to just 5V.

ETA:  It might help to know which EEPROMs you plan to program so we can see if the dropping resistors will provide enough current.
« Last Edit: May 19, 2017, 01:16:50 am by rstofer »
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #26 on: May 19, 2017, 01:36:05 am »
http://www.onsemi.com/pub/Collateral/P2N2222A-D.PDF
http://s680.photobucket.com/user/sorgil613/media/Elelctronics%20Components/Transistors/PN22222-h.jpg.html

Here are two datasheets of variants from the same manufacturer with the opposite pinout. It comes down to the exact manufacturer and part number. The 2N2222A is actually a metal can transistor. Many manufacturers called the plastic TO92 variant PN2222A with the emitter on pin1 or in the case of Onsemi (Motorola in the old days) P2N2222A for the version with the collector on pin1.
Thanks - it was pretty clear that the model number by itself wasn't enough. If it helps, here's a closeup of my 2222As.  My very basic test circuit that works is the second image. As you can see, from the bewel side of the transistor, the collector is on the right, and the emitter is on the left.

Quote
One way of checking is to check the emitter-base and  collector-base diode junctions with a diode mode on a multimeter. The emitter-base junction will have a lower voltage because it is more heavily doped.
Thanks - I'll keep that in mind and do some measurements.

Quote
If you reverse the emitter and the collector, you will end up with a much lower gain transistor and also the emitter-base junction when used as a collector-base junction breaks down like a zener at 5V to 9V.
And that's when you lost me - not sure what the gain in this context is. I know there's an amplification part of the transistor on the current side. Is that what you mean by gain?
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #27 on: May 19, 2017, 01:55:43 am »
Well, you're right, there will be comments...
Figured - the positive result I'm hoping for is more knowledge. In the end, the circuit isn't that important (it will help in a bigger project I want to deal with later).  And given this is by far over my head (should be pretty clear by now) I think I found an EEPROM that just works off 5v that I can fully control from the Arduino (AT28C640).

Quote
There is no way this circuit is going to work.

The outputs of the 74LS595 can, at most, get to 5V and the transistor emitters can only get to 0.7 volts less or 4.3 volts.  The rest of the supply voltage will be dropped across the transistor.

It looks like Q3 just sends the emitter directly to ground which is ok but I don't see where that does much with the diode.  ETA:  If the idea is to send 5V to the diode, get rid of the ground connection.
Thanks - what I need to figure out is how to read that into the diagram. I picked large resistors since I didn't want to push any extra current along the way. The Q3 is a small circuit I have showing I can pull to ground and turn off things by applying voltage to the base. Since I need to drop to 0v for READ, I thought I could use the diode in the same manner allowing the ground to be exposed to the output pin.

Quote
It would have helped enormously if you had told us the application earlier.

Your original 2 transistor circuit is much better because the PNP will deliver the proper voltage while the NPN will interface with the logic.
Sorry about that. I thought just explaining the actual issue without going into a long writeup about "unrelated" stuff would be helpful. I think I finally got KiCAD to do at least something useful, so I can at least produce better diagrams now explaining/visualizing what I'm doing.  In the end, I'm just playing with logic circuits and controllers. I thought my need for "fancy" stuff for a few well placed caps, a few resistors and at worst a transistor or two. Nothing beyond that, albeit learning about inductors and other components is mighty interesting but so far I don't have any applications I can use that for. Maybe that will come one day.

Unfortunately I got a hold of of a W27C512 (as I put on the diagram) for EEPROM and it uses multiple voltages to signal operation so I found myself having to do more than just the single/dual component thing.

Quote
You need to account for the diode voltage drop (0.7V) so you won't get 14V, you will get 13.3V or, actually about 0.2V less if you can somehow get the transistor into saturation, which you can't when driving the base to just 5V.

ETA:  It might help to know which EEPROMs you plan to program so we can see if the dropping resistors will provide enough current.
The EEPROM model was in the sheet but why KiCAD puts it on the side like that and not in the middle, I don't know.  Thanks for giving me a lot to think about. Yeah, I totally missed that the diodes drops the voltage too. Still not sure I get the transistor drop, but given they're related that sorta makes sense.

I think the next stop for me is reading a book :)
Thanks again.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #28 on: May 19, 2017, 03:58:37 am »
If you want to switch from the high side (like delivering a specific voltage to a pin), use a PNP transistor.
If you want to switch from the low side (like turning on an LED in the collector circuit), use an NPN transistor.

But, even though the PNP will work as a switch, a uC (or whatever) can't stand the required base voltage to turn it off.  That's why your original circuit would work well.  The NPN was controlling the base of a high side switch.  When the NPN was off, the 10k resistor held the PNP base high so no current would flow.

There are a couple of transistor relationships that are worth knowing:  There must be about 0.7V difference between the base and emitter to get the device into saturation.  For the NPN case, the base needs to be higher than the emitter.  For the PNP case, the base needs to be lower than the emitter.

The other relationship is that, at best, you can get VCE Sat down to 0.2V - that is, the voltage between the collector and emitter when the transistor is saturated will be about 0.2V.  You may not be able to get that far into saturation.  The 2N3904 datasheeet suggests it may be difficult to get below 1.0V.

I suppose we can add one more relationship:  The base current needs to be 1/10th of the collector current to get the transistor into saturation.  If you need 100 mA of collector current, you need to design in about 10 mA of base current.  This is just a 'rule of thumb' and varies considerably by device.  But it's a good place to start!

In your original circuit, the 4.3k resistor set the PNP base current.  LTSpice shows the output, given a 390 Ohm load as 11.8V at around 30 mA.  The PNP has only 0.2V between the collector and emitter which is deeply saturated.  That's a good thing.

Notice how the 390 Ohm load resistor and the 4.3k Ohm base resistor have a nearly 10:1 relationship.

So, you original circuit, with the real transistors simulates pretty well.  LTSpice .asc file attached


« Last Edit: May 19, 2017, 04:06:56 am by rstofer »
 
The following users thanked this post: bitman

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #29 on: May 19, 2017, 08:19:25 am »
Using discrete components is a very good learning experience but if you just want to get this done, why not use a logic level shifting IC specifically designed for the purpose?

Check out the CD40109B and CD4504B. Links to data sheets below:
http://www.ti.com/lit/ds/symlink/cd40109b-q1.pdf
http://www.ti.com/lit/ds/symlink/cd4504b-ep.pdf
« Last Edit: May 19, 2017, 09:37:23 am by Hero999 »
 

Offline NottheDan

  • Frequent Contributor
  • **
  • Posts: 281
  • Country: gb
Re: Understanding transistors
« Reply #30 on: May 19, 2017, 11:16:05 am »
Am I missing something or do you have high chance of junking the data in your eeprom via software bug there? Should the software fail to turn off one pin before turning on another for any reason you'll possibly be overwriting your eeprom instead of reading.
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #31 on: May 19, 2017, 01:01:46 pm »
Using discrete components is a very good learning experience but if you just want to get this done, why not use a logic level shifting IC specifically designed for the purpose?

Check out the CD40109B and CD4504B. Links to data sheets below:
http://www.ti.com/lit/ds/symlink/cd40109b-q1.pdf
http://www.ti.com/lit/ds/symlink/cd4504b-ep.pdf

So I looked into 4504B and it only seems to support two voltages. I need at least 3 if not 4 of which one of them is ground. I couldn't see how that would work with that circuit. I didn't know about 40109B but reading it seems to have the same issue and the 4504, it's only two voltages. Since they all have to go to the same pin, it didn't look like it was providing me what I needed?

You're right though - the learning side of this is probably worth the experience by itself. But I did look into it. I even have a few 4504s lying around but couldn't find a way to use them in my example.
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #32 on: May 19, 2017, 01:03:30 pm »
Am I missing something or do you have high chance of junking the data in your eeprom via software bug there? Should the software fail to turn off one pin before turning on another for any reason you'll possibly be overwriting your eeprom instead of reading.

The way I have the 595 setup, it turns on all the bits at once on a clock pulse. I actually have 3 of them in series (the other two is the address). So while OE is always low (enabled) the new values do not leave the storage until the whole byte is ready. So that should not happen.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #33 on: May 19, 2017, 05:57:16 pm »
Using discrete components is a very good learning experience but if you just want to get this done, why not use a logic level shifting IC specifically designed for the purpose?

Check out the CD40109B and CD4504B. Links to data sheets below:
http://www.ti.com/lit/ds/symlink/cd40109b-q1.pdf
http://www.ti.com/lit/ds/symlink/cd4504b-ep.pdf

So I looked into 4504B and it only seems to support two voltages. I need at least 3 if not 4 of which one of them is ground. I couldn't see how that would work with that circuit. I didn't know about 40109B but reading it seems to have the same issue and the 4504, it's only two voltages. Since they all have to go to the same pin, it didn't look like it was providing me what I needed?

You're right though - the learning side of this is probably worth the experience by itself. But I did look into it. I even have a few 4504s lying around but couldn't find a way to use them in my example.
Looking at your schematic again. I can see what you're trying to do. The CD40109 and 4504 only shift from one voltage to another. There is a way to disable the output which , with the addition of a longic inverter, would allow you to set the output to 0V, or 12V but that's not what you want here.

You certainly do need two transistors. One will not do.

Use the circuit posted at the start of the thread, with the PNP transistors with the emitters connected to different voltages and the collectors connected together via Schottky diodes.

 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #34 on: May 19, 2017, 06:50:50 pm »
Looking at your schematic again. I can see what you're trying to do. The CD40109 and 4504 only shift from one voltage to another. There is a way to disable the output which , with the addition of a longic inverter, would allow you to set the output to 0V, or 12V but that's not what you want here.
Hmmm - I do need to be able to set "ground". If that could be the default when there's no signal, it would probably be a better solution than having a signal come in (what if there's no signal etc).  When I read the specs of the CMOS and TTL chips it doesn't look like they can handle more than 5v, so I definitely don't think an inverter or similar would be the solution - unless I can isolate them from the higher voltages.

Quote
You certainly do need two transistors. One will not do.
So when I initially searched for solutions, I definitely saw a lot that used more than one transistor (and lots of discussions for/against and about details). My (most likely faulty) understanding of using two was because one alone couldn't handle the power (ie. isolating the current from the base). Anyway, as I wrote earlier I definitely need to work on my understanding here a bit better. I can see why they would work, but not WHY they're better than just one.

Quote
Use the circuit posted at the start of the thread, with the PNP transistors with the emitters connected to different voltages and the collectors connected together via Schottky diodes.
Thanks for the diagram! Very helpful indeed. Just in time for my weekend projects :) I just got a "bunch" of basic transistors including the 3904 (I just had 3906) so I don't think your timing could have been better. I'll grab a blank board and give this a try.  Also, based on other feedback it's clear I need to look at the voltage consumed by the diode and transistor so the end voltage will be what I need it to be.

One question - what does RL mean on the transistor before ground?  Ok, TWO questions - since 5v is connected directly, it means there's always going to be 5v? I'm not seeing how I can use this to switch the lead to "0v" or close to that.

Thanks again!
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #35 on: May 19, 2017, 08:21:25 pm »

Hmmm - I do need to be able to set "ground". If that could be the default when there's no signal, it would probably be a better solution than having a signal come in (what if there's no signal etc).  When I read the specs of the CMOS and TTL chips it doesn't look like they can handle more than 5v, so I definitely don't think an inverter or similar would be the solution - unless I can isolate them from the higher voltages.

The 7406 Hex Inverter is open collector and can handle up to 30V on the output.  It would have to sink whatever current you plan on having available at the output when it tries to hold the output at 0V.  Remember, the open collector is either 'open' or conducting to ground.  Input logic '0' and the output is whatever it is from the power supply and limiting resistor.  Input logic '1' and the output goes to zero with the gate sinking all the current from the power source through the limiting resistor.

http://www.ti.com/lit/ds/symlink/sn7416.pdf
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #36 on: May 19, 2017, 09:38:11 pm »
The 7406 Hex Inverter is open collector and can handle up to 30V on the output.  It would have to sink whatever current you plan on having available at the output when it tries to hold the output at 0V.  Remember, the open collector is either 'open' or conducting to ground.  Input logic '0' and the output is whatever it is from the power supply and limiting resistor.  Input logic '1' and the output goes to zero with the gate sinking all the current from the power source through the limiting resistor.

http://www.ti.com/lit/ds/symlink/sn7416.pdf
What's the difference between the 7405 and the 7406 ?  I have some 7405's around.  I've got no problems reversing the logic if that's what it takes.

Btw. I'm using a voltage divider to step from 14 to 12. Does that make a difference?
 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: Understanding transistors
« Reply #37 on: May 19, 2017, 10:00:22 pm »
The 7406 Hex Inverter is open collector and can handle up to 30V on the output.  It would have to sink whatever current you plan on having available at the output when it tries to hold the output at 0V.  Remember, the open collector is either 'open' or conducting to ground.  Input logic '0' and the output is whatever it is from the power supply and limiting resistor.  Input logic '1' and the output goes to zero with the gate sinking all the current from the power source through the limiting resistor.

http://www.ti.com/lit/ds/symlink/sn7416.pdf
What's the difference between the 7405 and the 7406 ?  I have some 7405's around.  I've got no problems reversing the logic if that's what it takes.

Btw. I'm using a voltage divider to step from 14 to 12. Does that make a difference?

You are stretching my memory a long way back but ISTR it's the max open collector voltage that makes the difference. All are still 5V logic, but on 5V buses back in the 70s it was still common to use OC with pullups rather than tristate as it was cheaper. Higher voltage OC, I bow to those in the know, but I assume it was to drive stuff that needed it like incandescant bulbs etc.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #38 on: May 19, 2017, 10:14:25 pm »

What's the difference between the 7405 and the 7406 ?  I have some 7405's around.  I've got no problems reversing the logic if that's what it takes.

Btw. I'm using a voltage divider to step from 14 to 12. Does that make a difference?

Check the datasheet...  The 7405 can't handle voltages higher than 5V

You need to think about the impedance of the voltage divider and how the voltage changes as a function of load.  I saw that resistor to get the 14V down to 12V and it may, or may not, work.  Voltage dividers composed of resistors are always load dependent.

You could try a zener diode to drop the voltage by 2 volts and probably get less sensitivity to varying loads.  Or, if the voltage isn't terribly sensitive, take 3 voltage drops from a string of diodes.  That would drop 14V to about 11.9V

 

Offline Howardlong

  • Super Contributor
  • ***
  • Posts: 5317
  • Country: gb
Re: Understanding transistors
« Reply #39 on: May 19, 2017, 10:21:58 pm »
This thread needs a good, slow, video all by itself, it so takes me back to when I was learning this stuff 40 plus years ago. I empathise with the OP, it's deja vu.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #40 on: May 19, 2017, 10:27:14 pm »
Looking at your schematic again. I can see what you're trying to do. The CD40109 and 4504 only shift from one voltage to another. There is a way to disable the output which , with the addition of a longic inverter, would allow you to set the output to 0V, or 12V but that's not what you want here.
Hmmm - I do need to be able to set "ground". If that could be the default when there's no signal, it would probably be a better solution than having a signal come in (what if there's no signal etc).  When I read the specs of the CMOS and TTL chips it doesn't look like they can handle more than 5v, so I definitely don't think an inverter or similar would be the solution - unless I can isolate them from the higher voltages.

Quote
You certainly do need two transistors. One will not do.
So when I initially searched for solutions, I definitely saw a lot that used more than one transistor (and lots of discussions for/against and about details). My (most likely faulty) understanding of using two was because one alone couldn't handle the power (ie. isolating the current from the base). Anyway, as I wrote earlier I definitely need to work on my understanding here a bit better. I can see why they would work, but not WHY they're better than just one.

Quote
Use the circuit posted at the start of the thread, with the PNP transistors with the emitters connected to different voltages and the collectors connected together via Schottky diodes.
Thanks for the diagram! Very helpful indeed. Just in time for my weekend projects :) I just got a "bunch" of basic transistors including the 3904 (I just had 3906) so I don't think your timing could have been better. I'll grab a blank board and give this a try.  Also, based on other feedback it's clear I need to look at the voltage consumed by the diode and transistor so the end voltage will be what I need it to be.

One question - what does RL mean on the transistor before ground?  Ok, TWO questions - since 5v is connected directly, it means there's always going to be 5v? I'm not seeing how I can use this to switch the lead to "0v" or close to that.

Thanks again!
1) I had a quick flick through the data sheet for the EEPROM and I don't see any reason why you'd want to set it to 0V

2) It's pretty easy, just replace the permanent 5V with an MCU output pin and add a pull-down resistor (1k to 100k) to hold it at 0V.

Btw. I'm using a voltage divider to step from 14 to 12. Does that make a difference?
As mentioned above the output impedance of the voltage divider might cause a problem. The output impedance of a potential divider is equal to the value of both of the resistors in parallel. If you know how much current is drawn from the potential divider, then you can work out how much the voltage will drop, when the load is connected.

Where are you getting the 14V from?

Perhaps you could use your MCU to control a voltage regulator, rather than switching the supply rail to different voltages?
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #41 on: May 19, 2017, 10:31:52 pm »

What's the difference between the 7405 and the 7406 ?  I have some 7405's around.  I've got no problems reversing the logic if that's what it takes.

Btw. I'm using a voltage divider to step from 14 to 12. Does that make a difference?

Check the datasheet...  The 7405 can't handle voltages higher than 5V
I did - and did again, and sorry I read 20 in the same table I saw voltage, not realizing it specified mA for THAT value. Sorry, I should have read it more careful.

Quote
You need to think about the impedance of the voltage divider and how the voltage changes as a function of load.  I saw that resistor to get the 14V down to 12V and it may, or may not, work.  Voltage dividers composed of resistors are always load dependent.

You could try a zener diode to drop the voltage by 2 volts and probably get less sensitivity to varying loads.  Or, if the voltage isn't terribly sensitive, take 3 voltage drops from a string of diodes.  That would drop 14V to about 11.9V

It's not even close right now. I only see a few volts on the emitter when it's on (it works for the 14v). When there's no connection it goes to about 6v. If I remove the 10K resistor I see 12V through the 8K resistor. I understand that it will change once there's a load on.  I'll try to build a simulation to see what's going on.
Thanks!
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #43 on: May 20, 2017, 12:35:03 am »
1) I had a quick flick through the data sheet for the EEPROM and I don't see any reason why you'd want to set it to 0V
Of course I could be reading this wrong. https://media.digikey.com/pdf/Data%20Sheets/Winbond%20PDFs/W27C512.pdf
The OE is inversed. Ie. you have to set it LOW to read (enable) it (page 7). On the waveform on page 13, OE goes low to enable the output.  Granted, "low" can be betwen -0.3 and 0.8 volts - I've seen that as 0v because my simple electronics mind works that way. Am I reading this wrong?

Quote
2) It's pretty easy, just replace the permanent 5V with an MCU output pin and add a pull-down resistor (1k to 100k) to hold it at 0V.

But that will draw the other lines to 0? I need all 4 signals (14, 12, 5 and 0 volts to go to the same pin. This is why I tried with the diodes, but they don't seem to help with the 0v/grounding issue?

Quote
Btw. I'm using a voltage divider to step from 14 to 12. Does that make a difference?
As mentioned above the output impedance of the voltage divider might cause a problem. The output impedance of a potential divider is equal to the value of both of the resistors in parallel. If you know how much current is drawn from the potential divider, then you can work out how much the voltage will drop, when the load is connected.
Ouch - I just posted a simulation that shows the issue I'm seeing. I'm still not sure why I'm seeing different voltages if the transistor is closed or not, when measuring the potential voltage (I presume that's what the simulator is showing). But I'll read it more careful and knowing there's a parallel circuit will definitely help. The way I was thinking was that since only one line was active at a time, I didn't have to be concerned about additional power/amps being drawn elsewhere. But of course I now have a load on - this "easy" thing is turning out a lot more complicated.

Quote
Where are you getting the 14V from?
Booster (step up converter). I'm trying to use the voltage I would be supplying otherwise. So I got a simple buck-boost converter that I connect the 5 to, and I adjusted the potentiometer so I got 14v out (now 15 since there's a small voltage drop).  Of course doing so has shown me, that the penalty is a constant amp waste even when I don't use the 14v. I thought it was an easy/cheap solution since I suck at creating step-up even when I have a inductor and zener in a basic circuit. Reading up on that made it clear I wasn't ready to make those myself yet, so I got a cheap chinese thing from ebay (I've used similar on my 3D printer).  I was going to look into lowering the amperage once I had things working.

Quote
Perhaps you could use your MCU to control a voltage regulator, rather than switching the supply rail to different voltages?
You mean from the analog output have some kind of variable resistor controlled? Not sure how to do that. I'm pretty sure PWM is out of the question here :)
« Last Edit: May 20, 2017, 12:38:12 am by bitman »
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Understanding transistors
« Reply #44 on: May 20, 2017, 02:11:24 am »

Quote
..... and add a pull-down resistor (1k to 100k) to hold it at 0V.

But that will draw the other lines to 0? I need all 4 signals (14, 12, 5 and 0 volts to go to the same pin. This is why I tried with the diodes, but they don't seem to help with the 0v/grounding issue?

When you mentioned wanting one of several voltages applied to the same point which included 0V, I, too, thought of using a pull-down resistor.  The mechanism works like this:

When all of your 14V, 12V, 5V, etc. sources are switched off, the target pin has, essentially, no voltage applied to it, so you connect a resistor between that pin and ground to "pull down" any stray voltage on that pin to ground potential - 0V.  The value of this pull down resistor needs to be low enough to ensure it does this effectively (Rule 1).

When you then activate one of the higher voltage supplies, the voltage is applied to that pin - and the resistor.  The pin gets its voltage - which is what you want - and the resistor gets real current passing through it - which you would want to be as little as possible.  For this to happen, value of this pull down resistor needs to be as high as possible (Rule 2).  You should consider the biggest voltage it will be subjected to when doing this.

Here is where you need to work out a value for this pull down resistor which satisfies Rule 1 and Rule 2.

It is quite common for the range of resistor values for an effective pull-down to be pretty broad.  A suggestion has been made for this to be somewhere between 1K and 100K, which sounds reasonable to me.
 

Offline james_s

  • Super Contributor
  • ***
  • Posts: 21611
  • Country: us
Re: Understanding transistors
« Reply #45 on: May 20, 2017, 02:59:43 am »
You mean from the analog output have some kind of variable resistor controlled? Not sure how to do that. I'm pretty sure PWM is out of the question here :)


That actually does work. A low pass filter will convert PWM into a steady DC voltage, you can have a crude form of DAC with only a resistor and capacitor.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12297
  • Country: au
Re: Understanding transistors
« Reply #46 on: May 20, 2017, 03:12:45 am »
You mean from the analog output have some kind of variable resistor controlled? Not sure how to do that. I'm pretty sure PWM is out of the question here :)


That actually does work. A low pass filter will convert PWM into a steady DC voltage, you can have a crude form of DAC with only a resistor and capacitor.

It may work - but questions to ask are: how smooth does the voltage need to be and how quickly do the voltage levels need to change?

The answer to this will affect your PWM frequency of operation and RC time constant ... and whether it will perform properly.
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #47 on: May 20, 2017, 01:43:55 pm »
1) I had a quick flick through the data sheet for the EEPROM and I don't see any reason why you'd want to set it to 0V
Of course I could be reading this wrong. https://media.digikey.com/pdf/Data%20Sheets/Winbond%20PDFs/W27C512.pdf
The OE is inversed. Ie. you have to set it LOW to read (enable) it (page 7). On the waveform on page 13, OE goes low to enable the output.  Granted, "low" can be betwen -0.3 and 0.8 volts - I've seen that as 0v because my simple electronics mind works that way. Am I reading this wrong?

Quote
2) It's pretty easy, just replace the permanent 5V with an MCU output pin and add a pull-down resistor (1k to 100k) to hold it at 0V.

But that will draw the other lines to 0? I need all 4 signals (14, 12, 5 and 0 volts to go to the same pin. This is why I tried with the diodes, but they don't seem to help with the 0v/grounding issue?
I didn't read the whole data sheet in great detail.

If you want all the voltage many pins, just connect the pins together.

If you need different voltages on different pins, then you'll need to build multiple copies of the circuit.

Quote
Quote
Perhaps you could use your MCU to control a voltage regulator, rather than switching the supply rail to different voltages?
You mean from the analog output have some kind of variable resistor controlled? Not sure how to do that. I'm pretty sure PWM is out of the question here :)
That's one possibility or you could replace the variable resistor with a potential divider, say for 12V, then use a transistor to connect another resistor in parallel with the lower resistor to bump the voltage up to 14V. Then you should be able to simplify things by using the CD40109 and CD4096.



Please post a schematic of the boost converter you're using.
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #48 on: May 20, 2017, 04:01:49 pm »
Please post a schematic of the boost converter you're using.
http://www.electroschematics.com/wp-content/uploads/2014/07/xl6009-module-circuit.png
It's a very typical, cheap and often used XL6009.
 

Offline bitmanTopic starter

  • Supporter
  • ****
  • Posts: 299
  • Country: us
  • Open Source Guy jabbing with Electronics
Re: Understanding transistors
« Reply #49 on: May 20, 2017, 04:07:53 pm »
That's one possibility or you could replace the variable resistor with a potential divider, say for 12V, then use a transistor to connect another resistor in parallel with the lower resistor to bump the voltage up to 14V. Then you should be able to simplify things by using the CD40109 and CD4096.



Ouch - this is quite a bit above my current capabilities to understand/use.  Btw. speaking of quickly skimming the data sheet, I just realized that deep in the datasheet of the AT28C64B there's a 12V requirement for erase ... *sigh*
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9889
  • Country: us
Re: Understanding transistors
« Reply #50 on: May 20, 2017, 04:25:26 pm »
The reason your simulation doesn't work is that 8k resistor.  Even with only 1 mA flowing, that resistor drops 8V.  Then a drop for the diode, the transistor, etc, and you're down to just 1V on the output.

The 14V output doesn't have a dropping resistor and it seems to work.  You need to substitute 2 or 3 diodes in series in place of the 8k resistor.

ETA: the 47k resistor is also redundant.
« Last Edit: May 20, 2017, 04:42:09 pm by rstofer »
 

Online Zero999

  • Super Contributor
  • ***
  • Posts: 19491
  • Country: gb
  • 0999
Re: Understanding transistors
« Reply #51 on: May 20, 2017, 04:33:45 pm »
That's one possibility or you could replace the variable resistor with a potential divider, say for 12V, then use a transistor to connect another resistor in parallel with the lower resistor to bump the voltage up to 14V. Then you should be able to simplify things by using the CD40109 and CD4096.



Ouch - this is quite a bit above my current capabilities to understand/use.  Btw. speaking of quickly skimming the data sheet, I just realized that deep in the datasheet of the AT28C64B there's a 12V requirement for erase ... *sigh*
Don't worry, it won't work anyway. I forgot that you need to be able to draw 30mA from the 14V rail and the CD40109 can only source a few mA.

Apart from that, it's not complicated. The CD40109 is just a level shifter. It converts a voltage between 0V and VCC to 0V and VDD. It has another enable input, which turns both output transistors off when connected to 0V, or to VDD or GND (depending on the input) when it's at VCC. It's known as a tri-state buffer and when the enable pin is low (0V), the output is a high impedance, like it's disconnected from the IC (open circuit), when the enable input is high (VCC) the buffer works as usual.

In the previous circuit diagram, the L input goes to the level shifter's input and the M input goes to the level shifter's enable, via a logic inverter, and is connected to the output via a diode. When M is 0V, the inverter causes the enable pin, on the level shifter, to be high. The output will then change between 0V and HV, depending on the voltage on L. When M is connected to 5V, the enable pin on the level shifter will be low, causing it to be disabled, its output disconnected from the circuit and 5V, from the M input flows to the output, via the diode.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf