PDA

View Full Version : Source or sink?



MJHanagan
04-12-2012, 01:20 AM
Hi everyone - I need some guidance on using the Propeller's I/O pins to drive some devices. According to the manual each of the Propeller's pins can source or sink up to 40 mA of current. I have an application where I am driving the input LEDs on a series of optoisolator TRIAC drivers and a few ZC SSRs most of which require only about 20 mA of current to activate. Some of these devices activate 120VAC power so having them trigger on during a reboot would be problematic as well as a possible safety concern.

I currently has a Propeller running a series of power transistors that witch some small inductive loads. I am using the Prop's pins to source the base current to these transistors and have noticed that some (not not necessarily all) are activated during the boot-up process as well as when I end the Prop's run.

As a matter of good practice how should I prevent this false triggering during the boot-up/reboot process as well as leave the devices off when I power down?

jmg
04-12-2012, 01:49 AM
As a matter of good practice how should I prevent this false triggering during the boot-up/reboot process as well as leave the devices off when I power down?

Check the actual values of sourced current, as the Data claims this :

["Reset (active low). When low, resets the Propeller chip: all cogs disabled and I/O pins floating. Propeller restarts 50 ms after RESn transitions from low to high."] and gives < |1uA| leakage figures.

A pull down may be needed to know the pin-state.

pedward
04-12-2012, 01:51 AM
The prop starts up with the pins in input mode, which makes them hi impedance. If you are experiencing false triggering, I would look at a) your code b) improper biasing of the transistors. It is typical fashion to ground an output to cause it to come on when using something like an LED. If you are using an NPN transistor, then you should bias the base to ground and use a current limiting resistor on the base (to limit the source current from the Propeller, and limit the current flowing through the transistor). All transistors should be biased off to ensure you don't have false triggering.

Something I feel that's important to note here about BJTs and MOSFETs:

BJTs draw constant current proportional to the gain of the transistor. That is, if you have a 100:1 gain, it will draw 1ma for 100ma switched, constant. If you do not have any current limiting in place on the base of the BJT, it can draw too much current from the port pin, up to the limit of the load on the BJT, at least until something breaks.

A MOSFET will draw a gating current from the device controlling it, but once switched on it falls back to a not so significant holding current. MOSFETs have a gate capacitance which will act like a capacitor charging from the controlling device, without a current limiting resistor you will see a large surge of current as the gate charges up, this can exceed what the controlling device can supply and lead to failure.

Both BJTs and MOSFETs can be driven in a non-linear region, dissipating energy in the switching device, as switches this is not typically desired, thus the use of PWM. PWM drives the switching device hard, so it switches on quickly, limiting the amount of time the device is in the linear region.

Something I want to repeat again, because I feel it cannot be understated: BJTs draw a constant base current proportional to the switched current while the device is on. MOSFETs draw a large gating current, but have a very small hold current.

Peter Jakacki
04-12-2012, 02:17 AM
@pedward: You will find that the BJT base current is not proportional at all especially in a typical switching circuit. A common emitter BJT's base-emitter current will be practically the same whether you have full collector load or none. Plus the aim in a switching circuit is to overdrive the base anyway and put the transistor into saturation so that the voltage drop across the collector-emitter is as low as possible to minimize losses.

@MJ: You didn't say whether those transistors you had were BJTs or MOSFETs and in fact you didn't really tell us anything. A schematic speaks volumes as does source code. BTW, please make sure you understand datasheet terminology correctly. If the specs say "sink or source 40ma max" then it also says within these Voh and Vol limits too as you cannot expect the voltage to be unaffected.

As for start-up transients this could depend upon the power supply rise time as there shouldn't be any since the Prop's I/O are floating at reset. It is always a good idea to add pull-down resistors to the gates of MOSFETs and even possibly BJTs although they really need current to operate (which can't come from a floating pin). However you will see that adding them is common practice. Double check your start-up code by manually stepping through the source and pretend you are the Propeller chip. Interpret each instruction literally and you might even find that the "glitch" has nothing to do with the Propeller but has more to do with what you are telling it to do.

jmg
04-12-2012, 02:43 AM
It is always a good idea to add pull-down resistors to the gates of MOSFETs and even possibly BJTs although they really need current to operate (which can't come from a floating pin).

That depends on the BJT :
If we take a small generic TO92 darlington, like this one

http://www.onsemi.com/pub_link/Collateral/MPSA27-D.PDF

the Fig 3 shows it can get close to saturation on 100mA drive, with just 1uA (!) of base current.
Such a device would need a pull down (and series base drive) resistor.

Peter Jakacki
04-12-2012, 03:06 AM
Now now jmg, you are going right over to the far edge to get picky but you have me chuckling and so I parry your move. Although a darlington is comprised of two cascaded BJTs it's not what we are talking about though as it's lousy for switching high current loads even though this little baby is spec'd at 500ma max it is also more likely to have a Vce-sat of around 1.6V which means it will be dissipating 800mw! which is way above it's ratings!! Many BJTs have a Vce-sat of less than 200mv these days and are far more suitable for switching high-current loads with low-voltage drive.

Duane C. Johnson
04-12-2012, 03:09 AM
But that is a Darlington Transistor configuration.

Notice, that the Collector to Emitter saturation voltage is 1.5 Volts.
You don't get that low base current without a cost, in this case a relatively high saturation voltage.

Duane J

pedward
04-12-2012, 04:11 AM
@pedward: You will find that the BJT base current is not proportional at all especially in a typical switching circuit. A common emitter BJT's base-emitter current will be practically the same whether you have full collector load or none. Plus the aim in a switching circuit is to overdrive the base anyway and put the transistor into saturation so that the voltage drop across the collector-emitter is as low as possible to minimize losses.


I agree that the curve is non-linear to a degree, but to sweepingly say that the base current has no bearing on the collector current is ignoring the fact that transistors have gain which is proportional to the base voltage/current.

Peter Jakacki
04-12-2012, 05:02 AM
I agree that the curve is non-linear to a degree, but to sweepingly say that the base current has no bearing on the collector current is ignoring the fact that transistors have gain which is proportional to the base voltage/current.

Hi pedward, I think where you are going awry is your statement " BJTs draw a constant base current proportional to the switched current while the device is on" which is rather back to front in that the maximum collector current can be proportional to the base current so that a BJT with a Hfe of 100 will sink a maximum of 100ma for 1ma of base current. But just because you are only drawing 20ma collector current does not mean that the base current will go down proportionally as the base current is dependent (simplistically) upon the drive voltage minus Vbe (~0.6V) divided by the base resistor.

jmg
04-12-2012, 09:53 AM
Now now jmg, you are going right over to the far edge to get picky but you have me chuckling and so I parry your move. Although a darlington is comprised of two cascaded BJTs it's not what we are talking about though...

We do not know what exact transistor the OP is using.
Also note the ULN2003 is a darlington array, and is very widely used to drive 'small inductive loads'


as it's lousy for switching high current loads even though this little baby is spec'd at 500ma max it is also more likely to have a Vce-sat of around 1.6V which means it will be dissipating 800mw! which is way above it's ratings!!

See Fig 3 in the Data sheet, Vce sat is well under 1.6V : Remember it trends to ONE Vbe, not two. So 800-900mV

I doubt anyone would run a 500mA darlington at 500mA, but using a 'small inductive load' figure region of 100mA-250mA, we have at 100uA of Ib, power values of ~ 80mW and ~220mW

Also, do not dismiss Darlington power loss too quickly.
It does not come from the low voltage rail, so is not as bad as it may seem.

Suppose a 24V supply and a 100mA Load, with a single bipolar device, with a forced beta of 12.5, and a linear regulator.
Your drive power budget is 192mW, most of which heats the linear regulator.

So a Darlington device offers a lower total power loss, and much lower regulator power impact.

Duane C. Johnson
04-12-2012, 12:34 PM
Hi jmg;

See Fig 3 in the Data sheet, Vce sat is well under 1.6V : Remember it trends to ONE Vbe, not two. So 800-900mV

In good engineering practice one would not violate the printed "Max/Min" "ELECTRICAL CHARACTERISTICS" on the data sheet.
Graphs are useful to help see how the part works but these are only approximation based on "Typical" characteristics.

OK, I violate the "Max/Min" specs all the time when looking at a single part on an individual basis. However, I would not be surprised if a part did approach the maximum value.

Duane J

Peter Jakacki
04-12-2012, 01:22 PM
@jmg: Obviously you have never used super-beta BJTs then as these have very little Vce-sat. Take the PBSS4021NT for instance, with 10ma of base drive it has a "maximum" of 75mV Vce-sat at 1A collector current and this device is only a small SOT-23 pack device! Obviously you can drive them with less too and the advantage is very low drive voltage required coupled with efficient switching. Darlingtons have always been a compromise and the 200x arrays are very popular but they are far more limited than a lot of people think because they don't RTM. Although I may occasionally use for instance a 2803 I still find discrete or dual devices far more useful in terms of real world performance. This thread took off because I was moderating the statement that this magic "1ua" leakage figure could turn on a BJT or even a darlington. First off the leakage figure is a maximum and it is never assumed to be sourcing current (<= +/- 1uA). Secondly a GOOD darlington can possibly have a gain of 10,000 (at low load currents) but to turn 1ua even if it were sourcing into anything that would glitch these outputs seems far fetched indeed. Nothing on the 2803 datasheets even comes close and it's gain is more like 1000 rather than 10,000. Also with it's input resistor network and 1ua source current you would end up with around 12mV on the input of the array (not the base) which I think you will admit is never going to start to tickle it.

However much I enjoy a little friendly banter on a subject it just seemed that this "far-fetchedness" confuses the OP when a simple "show us the code and schematics" would clear up a lot of conjecture.

jmg
04-12-2012, 10:08 PM
This thread took off because I was moderating the statement that this magic "1ua" leakage figure could turn on a BJT or even a darlington. First off the leakage figure is a maximum and it is never assumed to be sourcing current (<= +/- 1uA).

Did you not bother to look at the actual data sheet I gave a link to ?
http://www.onsemi.com/pub_link/Collateral/MPSA27-D.PDF

Take a look at Fig 3, and you can see exactly what this real device will do.

Sure, the 1uA is a data sheet figure, but one cannot do a design HOPING things will be way better...
[Indeed that 1uA is the first to go, on poor handling, or even moisture, and yet things will otherwise 'work ok' ]

My posts are to prove you cannot assume anything, and really Do need to read a real data sheet every now and then, (and also run some
system mW numbers, when sniffing at Darlingtons).

The OP stated he had strange things happening, viz "have noticed that some (not not necessarily all) are activated", but forgot to tell us the devices. I've given a possible explanation, supported by the data, and notice he said SOME only..

Another reality check : (yes, I have used super-beta BJTs, and also MOSFETS ) is they are not cheap, and tend to be low voltage :
@ Future :
MPSA27RLRAG 60V 2000 : $0.0319
PBSS4021NT,215 20V 3000 : $0.127

Peter Jakacki
04-13-2012, 05:33 AM
Yes I did, but who would use a high-gain darlington WITHOUT cutoff resistors???? :)

pedward
04-13-2012, 06:35 AM
Yes I did, but who would use a high-gain darlington WITHOUT cutoff resistors???? :)

NOOB? Naive, Ignorant, Obstinate?

Peter Jakacki
04-13-2012, 06:47 AM
:) (I think? I hope)
This highlights the difference between possible and plausible. It is possible to have a high-gain darlington without cutoffs glitched by leakage current but it is highly implausible that this would ever be the case. But then again........
Anyway, the discussion I hope is a healthy discussion. Even in jest I wouldn't bandy about any derogatory remarks. Everyone has a valid point and we are only looking for good to come out of it, aren't we?
The moment we clam up is the time to forget about participating on the forum. (NO NO NO)

jmg
04-13-2012, 09:40 AM
Yes I did, but who would use a high-gain darlington WITHOUT cutoff resistors???? :)

Perhaps someone who posted this ?
[ "have noticed that some (not not necessarily all) are activated"...] - the report suggests either a MOSFET, or Small Darlington, sans resistors.

MJHanagan
04-13-2012, 08:54 PM
I attached a quick sketch of the wiring schematic I am using. I am using a TIP120 NPN transistor. Did I properly locate the resistor that is supposed to help prevent false triggering? What value should this be 10k?

Here is a link to the transistor datasheet (http://www.fairchildsemi.com/ds/TI/TIP122.pdf). I think the 200 ohm resistor between the base and the Prop pin shoudl limit the current to about 20 mA (Vbe ~ 2V and an hfe>1000).

Circuitsoft
04-13-2012, 10:58 PM
You're actually getting about 4mA, but that should be plenty. Also, the TIP120 has built-in base draw-down resistors, so that wouldn't appear to be the issue you're facing.

jmg
04-13-2012, 11:08 PM
Did I properly locate the resistor that is supposed to help prevent false triggering?

If you hold the Prop in reset, does this still apply ? [ "have noticed that some (not not necessarily all) are activated"...]

Use a multi-meter to find why only some are activated - all prop pins should be the same (floating) state in reset.

Duane C. Johnson
04-14-2012, 02:36 AM
Hi MJHanagan;

The TIP120 NPN darlington transistor will, acording to the spcc, disipate about 6 6 watts of power so will require a heatsink, escentially negating any cost savings from its low cost. Besides there will only be 10V across the 12V relay.

A much better solution is to use an IRF3708 (http://www.redrok.com/MOSFET_IRF3708_30V_62A_12mO_Vth2.0_TO-220.pdf) MOSFET. It is guaranteed to have 0.029 ohm on resistance driven with 2.8V. Even better at 3.3V.
The power dissipated would be about 0.34 watts. This will not require a heat sink.

Duane J

Peter Jakacki
04-14-2012, 05:20 AM
I concur with Duane that you are not saving anything at all by going with a "cheap" solution. You could use the MOSFET he specified which will definitely work but then again there are other much smaller MOSFETs that will be more than capable to drive this solenoid . The MOSFET does not require an expensive heatsink and I would keep your resistors the way they are even though the 200R is not really necessary for the transistor but it's a little protection for the Prop in case of meltdowns. The usual trick when activating solenoids is to PWM them after they have pulled in so that the coil does not draw too much current or get too hot if it's on for too long.
Here's a dual logic level N-channel 8A MOSFET (http://search.digikey.com/us/en/products/DMG9926USD-13/DMG9926USD-13DICT-ND/2179796) that costs only 55 cents in one off quantities but there are plenty to choose from. At 5A load it will drop 100mV with 3V gate drive. I use similar ones to drive solenoids.

frank freedman
04-14-2012, 06:23 AM
Once this thread started getting into exotica, I sorta started to scan it so pardon me if I missed anything significant. The intent of the OP seemed to be mainly concerned with the issue of safety and false triggering of potentially dangerous loads when the system was un/partially initialized. Once the thread jumped the rails, it did not appear to return to answer the original concerns as I (perhaps mis)understood them.

The concerns for the safety and control of the system would seem that rather than relying on some possible design characteristics which can vary depending on design and component characteristics, he would be better served going the route of an inline safety circuit whether the mechanical (relay) or electronic type. Every X-ray system I have ever worked on and also all mechanical control systems for tables, single and bi-plane Card/angio system as well as CT have a safety circuit built into the design that will absolutely NOT allow activation/power sourcing until specifically enabled by a fully initialized system. Look for the term Safety Contactor for example. It should be of a fail-safe design that can not be enabled with out a very specific signal or enable command. Other systems such as those using PWM and multiphase variable frequency motor systems, the mains supply to the power supply / power circuit is separately switched either electronically or via relays depending on Voltage/current/power requirement.

Understanding the esoterica is important, but the designer must ultimately make the risk analysis and see where on the spectrum from an elegant maybe tricky design to full on brute force failsafe. This is not a slap at the previous posts in this thread, just a redirect to the initial question of as far as possible assuring the safety / risks of an intended function.

Frank

Peter Jakacki
04-14-2012, 08:05 AM
Hi Frank,

Throughout the thread we were "discussing" what the cause could be but without sufficient input from the OP therefore the "exotica" I guess. This does not sound like an X-ray system or a safety critical system as it would not be discussed at this level on the forum. From the rough sketch that was supplied etc we are making recommendations appropriate for someone inexperienced in these matters as it is also necessary to address associated areas of concern. At a professional level I completely agree with the statements concerning safety critical operation which however would not seem to be applicable in this case.

frank freedman
04-14-2012, 04:34 PM
Hi Peter,
Agreed probably not x-ray dangerous, but 120VAC can be as dangerous. Since we can't always tell if the poster is some bright middle schooler or another PhiPi, I tend to suggest on the side of safety, especially electrical so as not to encourage bad or dangerous practices.

FF

Peter Jakacki
04-14-2012, 05:31 PM
I was brought up and taught to stay away from propellers because they are dangerous. Now look at me, engaging unrestrainedly in this bad and dangerous practice! :)

frank freedman
04-15-2012, 03:19 AM
I was brought up and taught to stay away from propellers because they are dangerous. Now look at me, engaging unrestrainedly in this bad and dangerous practice! :)

Yes, might even put an eye out.......

No, wait.. That was for BB guns..

Nevermind....

MJHanagan
04-16-2012, 01:37 AM
Hmmm, I better clarify a few things here. First, my immediate project involving the solenoids is somewhat less important than a medical device. I am using the solenoids to strike a set of tubular chimes that mimic the classic Westminster bell tower sequence. My major concern is to not activate these when I need to reboot the Propeller which controls them along with other important things such as the accent lights and a ceiling fan on the deck. Not exactly a life threatening application, I am just trying to avoid the occasional noise nuisance.

However, I do have another application I am working on which involves some 120VAC power so what I learn here will be applied to that application. This next project is geared towards kids (controlling a toy train) so I do want this to be relatively failsafe. For this application I need to send 120VAC power to a nominal 80W transformer. Again, not a major application but I do want to be sure I don't accidentally send 120V power unless it is intended.

I like the MOSFET device and at $0.55 each I'm inclined to buy a set of ten!

I need another day or two before I can get back to measuring the pin outputs during the reboot/reset conditions. I will post the results as soon as I get a chance to measure.

I appreciate all the feedback on this - it is very helpful.

MJHanagan
04-19-2012, 01:04 AM
I found the problem! I am using a Gadget Gangster Platform that has a micro SD slot which uses pins 0-4. These pins have pull-up resistors so when the Prop is booting up these pins go high with enough umph to trigger the TIP120 transistor(s) into the on state.

After moving to pins 11..15 the problem went away so there is no false triggering with a "normal" Prop pin!

Thanks for all the input and suggestions!

Peter Jakacki
04-19-2012, 03:14 AM
Doh......now you see why it makes all the difference when you supply relevant information from the start!!. Suspecting the plausible rather than the implausible, I even mentioned in my first post that a schematic and source code would make all the difference in diagnosing your problem. Knowing that you were using certain pins on a certain board would have provided sufficient information a week ago, but then we would miss out on all the fun of discussing what the problem could be and could not be :tongue: :innocent: :smile:

NEW POSTING RULE
Please do not provide sufficient information to actually solve the problem, but please tell us your observations and frustration. This is to make sure that forum members do not miss out on a little educational entertainment (why else do they answer posts?).
DISCLAIMER: Parallax takes no responsibility for: a) loss of hair b) time lost in misdirected research c) dangerous X-rays emanating from a thread