# Basic problem with transistors

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by giftiger_wunsch, Jul 25, 2009.

1. ### audioguruWell-Known MemberMost Helpful Member

Joined:
Mar 16, 2004
Messages:
32,577
Likes:
950
Location:
ONLINE
No.
The max allowed output current is 20mA. Texas Instruments show graphs of the minimum and typical output current from a 74HCxxx gate (same contruction as a microcontroller) and the output current can be more than 60mA which will destroy them. Driving the base of an NPN transistor the graphs show a typical current of 68mA when the supply is 6V. The typical output current is 42mA when the supply is 4.5V. It does not show the output current when the supply is only 3V.

2. ### marcbarkerNew Member

Joined:
Jul 5, 2009
Messages:
727
Likes:
7
Location:
London, UK
Where does it say that in the uC Datasheet?

3. ### Hero999Banned

Joined:
Apr 6, 2006
Messages:
14,902
Likes:
79
Location:
England
I thought the maximum current for the HC series is 25mA per output with a maximum supply current of 50mA.

Joined:
Jan 12, 1997
Messages:
-
Likes:
0

5. ### audioguruWell-Known MemberMost Helpful Member

Joined:
Mar 16, 2004
Messages:
32,577
Likes:
950
Location:
ONLINE

I know that the max allowed output current of a PIC micro-controller or a 74HCxxx is 25mA but the OP said that his micro-controller has a max output current of 20mA.

Maybe its max output current is actually only 20mA when its supply is as low as 3.0V.

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
I'm planning on looking at the IC in more detail as soon as I have the time.

I think I'll just stick to two pins per motor. All I need to know is how to connect the circuits so that PA0=1 and PA1=0 makes the motor go forward, PA0=0 and PA1=1 makes it go backwards, and PA0=PA1 prevents any of the BJTs, MOS-FETs, or whatever else might be used in the H-Bridge, from opening. I don't know if the suggested IC handles all this itself, but either way I would like to know how this behaviour would have been achieved with my schematic, even if the schematic wouldn't work for other reasons, since it's bugging me now and I don't see any reason why a link between the battery ground and PA0/PA1 via diodes wouldn't work... If someone could please answer this question I will be very grateful. I have asked several times now but I've only ever received answers to questions I didn't actually ask...

Even if I find out that the IC will handle all of this, I would still like to know why this aspect of my schematic was incorrect.

Thanks.

Last edited: Aug 1, 2009

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
I was informed by an experienced user of my series of microprocessors that 20mA is the maximum current which can be obtained from the parallel ports of the prototyping board on which my microprocessor sits. He said this was in the documentation, though the documentation is extensive so I'm not sure where. I'm using a 4010 rabbitcore microprocessor mounted on the prototyping board which came with the development kit.

I've never used PICs, though I intend to in future, so I can't claim to know anything about PICs. But obviously a rabbitcore processor is a completely different line of devices. The user on the rabbit forums seemed pretty sure that the current from the parallel ports wouldn't go higher than 20mA.

Incidentally, is there a difference between the terms "microcontroller" and "microprocessor"? If so, mine is the latter.

Last edited: Aug 1, 2009
8. ### Nigel GoodwinSuper ModeratorMost Helpful Member

Joined:
Nov 17, 2003
Messages:
39,324
Likes:
653
Location:
Derbyshire, UK
I would suggest you misunderstood (or he did?), port pins aren't normally over-current protected, and the specs are for the maximum allowed current, it's up to you to ensure that's not exceeded.

9. ### Nigel GoodwinSuper ModeratorMost Helpful Member

Joined:
Nov 17, 2003
Messages:
39,324
Likes:
653
Location:
Derbyshire, UK
LED's work at considerably LESS than 20mA, it's bad practice to use them without a current limiting resistor, and may overload the port.

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
Really? Less than 20mA? I was told by someone that an LED typically requires around 100mA... Okay I'm well and truly confused now. Either way, I was told that the maximum current from the parallel ports was 8mA... I'll try to find the quote.

11. ### Nigel GoodwinSuper ModeratorMost Helpful Member

Joined:
Nov 17, 2003
Messages:
39,324
Likes:
653
Location:
Derbyshire, UK
LED's light quite acceptably on just 1mA - at 100mA many would burn out, or have short lives.

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
Quotes from rabbit forums:

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
Ah... that's bad news for me then. In every circuit I've made so far using LEDs, I've tried to limit the current to 50-100mA since I was informed previously that a standard-sized LED would usually be run at about 100mA... though fortunately I haven't had any burn out yet. I didn't use resistors when connecting to my rabbit prototyping board since I thought if the 8mA max current was correct, it may not have even be able to light up the LEDs, let alone burn them out.

Anyway regardless of all of this, could someone answer my original question please:

I've been trying to wrap my head around why the last schematic I posted earlier wouldn't have this effect, but I haven't had any explanations yet

Last edited: Aug 1, 2009
14. ### Nigel GoodwinSuper ModeratorMost Helpful Member

Joined:
Nov 17, 2003
Messages:
39,324
Likes:
653
Location:
Derbyshire, UK
You're quoting figures out of context - such figures are usually the maximum ALLOWABLE current, not current limited to that figure. Does it anywhere say that the current is limited to that?.

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
I didn't quote any figures. I quoted another user quoting figures. I'm an electronics noob, don't shout 'ALLOWABLE' at me as if saying it again is going to make me understand the difference. Feel free to either explain the difference to me or to shout at the person who told me that in the first place. Perhaps I misunderstood what he said, perhaps he misquoted the figures. You tell me.

Last edited: Aug 1, 2009
16. ### audioguruWell-Known MemberMost Helpful Member

Joined:
Mar 16, 2004
Messages:
32,577
Likes:
950
Location:
ONLINE
There is a High Power Mood Light project on another website.
The designer didn't know so he had the PIC micro-controller directly connected to the bases of the driver transistors without series current-limiting resistors.
People wrote in that their micro-controllers got so hot that they stopped.

The designer also drove the red LED with a current much higher than its max allowed current and some people wrote in that theirs burned out.

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
So what you're saying is that the current from the uC is limited only by the resistance of the circuit, but that the max recommended current will be 8mA? So the circuit should have a resistance of at least 3.3/0.008 = 412 ohms. Okay, I'll bear that in mind when I connect devices to the parallel ports. I suppose I'm lucky that I didn't damage both the LEDs and the processor when I made my 'pedestrian crossing' app then...

Anyway, could someone please address my previous question now that that issue is out of the way?

18. ### marcbarkerNew Member

Joined:
Jul 5, 2009
Messages:
727
Likes:
7
Location:
London, UK
Isn't part of this answer just that we just connect the PA0 & 1 signals to whatever suitable h-bridge is chosen?

But the rest of the asnwer, is to do with the link (green diodes) you mention between battery ground and the PA0/1 signals. That is a strange configuration I have not seen before, I can't get my head around it. I'm afraid you're going to have to explain the theory behind (if you have before already, I'm sorry I missed it, please try again). You teach us please

Joined:
Jun 15, 2009
Messages:
813
Likes:
3
Location:
Kent, England
Okay my theory is this:

When PA0 is 3.3V and PA1 0V, the current flows out of PA0, through the bases of the top left and bottom right transistors, and ultimately ends up at the battery ground, where I joined those green wires to. The wire splits into two diodes, and the the current should flow through the diode to PA1, completing the circuit.

If the inverse is true, i.e. PA1 is 3.3V and PA0 is 0V, the current will flow through the bottom-left and top right transistors, again reaching the green wires connected to the battery ground, and this time the current will return to PA0.

When both PA0 and PA1 are at 3.3V, there is no voltage between the two terminals, since they are both high. No current flows, so none of the transistors allow current to pass between their collectors and emitters; the motor stops.

To clarify, the only reason for the diodes in the green wires is because without them, there is a direct conductive path between the two terminals, so virtually no current will actually reach the transistors.

Please let me know if you can see any holes in this theory.

Schematic has been added to this post as requested by marcbarker. Black denotes the H-Bridge, Blue is the uC output connections, and green is the wiring providing the uC output with a route back to ground via whichever port is connected to ground.

Note that I haven't updated the schematic yet, so I may well use that IC suggested my blueroomelectronics, and will certainly add resistors to the blue circuit to limit the current passing through the uC terminals.

#### Attached Files:

• ###### sam-proto1c.jpg
File size:
34.9 KB
Views:
132
Last edited: Aug 1, 2009
20. ### marcbarkerNew Member

Joined:
Jul 5, 2009
Messages:
727
Likes:
7
Location:
London, UK
This "maximum current thing" can sometimes get like crossing the road in germany. You can get arrested for crossing the road if the green 'cross' light is not lit, even if the cars are far away.

THis is my 0.02. The output of a logic device (in general) is literally a switch which either connects to the IC's supply, or to ground, that's what makes a H/L. This switch isn't perfect, it has an inherent resistance present in it. The amount of inherent resistance varies according to what kind of IC it is.

If it's a Line Driver IC (possibly good for a h-bridge too), the resistance is going to be low, 10 ohms, but if it's a "4000 series" IC running of a small battery, this resistance is something like 1000 ohm. The uC we've been talking about I'll guess is about 100 ohm. When you connect a logic IC output to ground and make it try assert a logic H, a current flows, and the IC starts to get hot. In practice it doesn't blow up, but it can burn off its printed number. But having said that another IC, say a 4000 series I mentioned earlier, can drive an LED directly without bothering with a 'current limiting resistor'.

Enter the 'current limiting resistor'. This is the thing that programs what this current is. I won't elaborate any more because in engineering, this is virtually a religion in itself!

The actual "amount of legal current" is a subjective thing anyway. A data sheet will state in it a "line drawn in the sand", i.e. "25 mA", because that's what inexperienced engineers want, so they can stay their side of the line and not be blamed for anything (defensive engineering). Or that "25 mA" is a value of current they happened to had tested it at, and they don't know (or publish) what happens with other currents.

What is not realised with "legitimate current", is that if you as an engineer 'covered yourself' by setting each IC output driving a load for 24.99 mA, but there are 16 outputs, you'd have an extra 0.4 A supply current! There is a thing called 'maximum package power dissipation', and you've probably exceeded it by this extra power.

21. ### marcbarkerNew Member

Joined:
Jul 5, 2009
Messages:
727
Likes:
7
Location:
London, UK
I need a picture, sorry can you edit the previous posting and add a schematic (again? sorry), with this scheme on it, so there's no chance of making an error understanding it.

EDIT I'll take a look later and post

Last edited: Aug 1, 2009