transistor to pwm out but lamp on all the time?

Dear people,
My PWM programm to dimm a led is working great now, but I have some problems trying to connect a greater bunch of leds (24) and an external powersource (12 volt) using a transistor. (bc547a)
Here the schedule: <A href='http://members.chello.nl/t.verbeek6/bestanden/18x+transistor.jpg' Target=_Blank>External Web Link</a>
But apparently the transistor is 'open' all the time; the light is on all the time and the picaxe has no effect... any help is appreciated!

Thanks,
Titus


Edited by - TitusVerbeek on 12/21/2005 1:29:06 PM
 

BeanieBots

Moderator
Assuming the base is driven via a lowish value resistor (330R) then the circuit is correct as shown.
If, as you say, the transistor is &quot;open&quot;, then the lights will be out.
The fact that the lights are on all the time suggests that either the transistor is wired incorrectly or it has overheated and become a short thus leaving the lights on.

I cannot comment on your pin assignment because I do not have a spec for that transistor.

Simple test, remove the PICAXE from its socket. If the lights stay on, then it is a problem as described above.
If the lights go out, it is either faulty software or a duff PICAXE. (the PICAXE ouput may have been damaged if no current limit resistor was used between output and transistor base).
Try a simple on/off program first if it looks like a software problem.
 

kranenborg

Senior Member
Hi Titus,

The total power consumption might be quite large with a set-up like this, and the bc548 is really a small signal transistor. Could it perhaps be that the transistor is destroyed? Maybe you should apply a Power MOSFET as a switching device here.

Regards,
Jurjen
 
Here's the datasheet of the transistor:
<A href='http://members.chello.nl/t.verbeek6/bestanden/bc475datasheet.pdf' Target=_Blank>External Web Link</a>

The picaxe is still OK, I checked that with another setting.

I will add the 330 ohm resistance. &lt;-- EDIT did that, also in 'external web link' in my first message. --

I am under the impression that it has to be either your suggested molested transistor (I will check with a new one) or - more likely - that it is falsely connected.

To be more specific: Detaching the BASE of the transistor from the picaxe made the leds a little less bright, but not off. Attaching it to -0v made it shine fully again... so... falsely connected, right? But how should it then be connected?

But I thought I was following the datasheet correctly...?

Concearning that this transistor might not be suitable:
It can control up to 30 volts between collector and emittor or 6 volts between base and emitter, so for me as a beginner in electricity land that would seem OK, does it not? (maybe those values are not the issue?)

Thanks so far,
Titus

Edited by - TitusVerbeek on 12/21/2005 3:08:03 PM

Edited by - TitusVerbeek on 12/21/2005 3:08:41 PM
 
checked with a new transistor, same type.... same result.

What could possibly be wrong with connecting the emittor to both power's -0V's, its collector to the leds+their resitors, and its base via a 330 ohm resistor to the picaxe pwmout port? Edit: Is it ever the other way around? (emittor-collector?)

Edited by - TitusVerbeek on 12/21/2005 3:30:44 PM
 

andrewpro

New Member
They're not going to switch the pins around as long as your using the EXACT same device. Sometimes they make the same numbered transistors, but one number or letter may be different among them and that can denote different pinouts. I've shot myself in the foot numerous times before on that one. Be very sure which one(s) your using.

If you draw too much current, no matter how low the voltage is at any pin, youll toast the transistor. Reading the datasheet, the collector current is only good, continuous, for 100ma. With 24 LED's, youll only be able to drive them with 4ma each or so and not roast it. You haven't said how youve connected the LED's (parallel or serial) and what resistors your using to limit the current, but it seems, to me anyways, that your releasing the magic smoke each time you turn the transistor on.

If you end up needing a larger transistor, I would suggest a TTL compatible IGBT to do the switching. The ones I use are designed for automotive ignition systems, but I chose them because they can be driven directly from the picaxe (with suitable limiting resistor between them of course). You can get them in all different current ratings, enough to drive, oh, say, 3000 LED's or more at 20ma each if you wanted to. They're good stuffs.

--Andy P

Edited by - andypro on 12/21/2005 4:15:34 PM
 
I guess I will have to try that anyway. This doesn't seem to work. Thanks!

Edit - googling at those.. are they called optocouplers?

Edit after your edit: Ha ha, nice choice of words! And clear.
I chose to have 8 parrallel sets of 3 leds in series with one resistor. So that would be 8x20mA = 160 mA. In the shop they THOUGHT that would be OK.

Edited by - TitusVerbeek on 12/21/2005 4:21:42 PM
 
looking at this part of the datasheet I think you (all) are right and I should take a look at something heavier: <A href='http://members.chello.nl/t.verbeek6/bestanden/temp1.jpg' Target=_Blank>External Web Link</a>

What would the best choice be:
1- mosfet - and the schedule like this: <A href='http://members.chello.nl/t.verbeek6/bestanden/picaxe+mosfet.jpg' Target=_Blank>External Web Link</a> but seeing this I would have still some questions..
or
2 - this 'TTL compatible IGBT'? is there a scheme to connect those somewhere?

Thanks,
Titus

Edited by - TitusVerbeek on 12/21/2005 4:30:51 PM
 

andrewpro

New Member
IGBT stands of Insulated Gate Bipolar Transistor. I get mine from Fairchild Semiconductor, the page for the ones I use most often is here:

<A href='http://www.fairchildsemi.com/pf/IS/ISL9V3040P3.html' Target=_Blank>External Web Link</a>

They hook up just like a normal bipolar tranistor pretty much. They're kinda like a hybrid between a BJT and a FET. The gate (base) is insulated from the PN junction to act as a field effect transistor for turnon, but once turned on, the PN junciton acts jsut as a normal bipolar transistor, so you just hook it up as normal.

-=-Andy P

Edited by - andypro on 12/21/2005 4:39:56 PM
 
Andypro, do you min something like this:
<A href='http://power.elecdesign.com/cluster/common/edpower/parts/IR2302.PDF' Target=_Blank>External Web Link</a> There's a schedule too. :)
 
Ah yes, that looks better. (more simple) &lt;-- Edit: Talking about your link before mine here
Thanks!

Titus

Edited by - TitusVerbeek on 12/21/2005 7:29:43 PM
 

andrewpro

New Member
This was for the link two posts up you posted. Man...we're going too fast with this. hehe ;)

Those are jsut the drivers for mosfets and IGBT. They're designed to make the bridge between the logic level output and the power it tkes to drive the device. This is usual with mosfets, and most IGBT's as well. This is why I like the logic level IGBT's as you can skip the intermediate circuitry to get the drive needed to turn them on.

--Andy P

Edited by - andypro on 12/21/2005 4:57:45 PM
 
Okay I took a look at the datasheet you mentioned and linked to. ummm.. some questions:
-what does the 'spring'-symbol (L) mean in this schedule? A spool?
<A href='http://members.chello.nl/t.verbeek6/bestanden/igbtcircuittobe.jpg' Target=_Blank>External Web Link</a>
-what value should this 'spring' have?
-is Rg (use same link for ref.) also roughly 330 ohm?

Edited by - TitusVerbeek on 12/21/2005 9:54:47 PM

Edited by - TitusVerbeek on 12/21/2005 10:01:56 PM
 

andrewpro

New Member
That &quot;spring&quot; is an inductor. L is the symbol of of henries, which is a measure of inductance. It's all semantics in this situaiton, however. That setup is for testing inductive response which you dont have to worry about because your not driving an inductive load (such as a motor). So dont owrry about that at the moment.

--Andy P
 

Chirp

New Member
If you have not given up on the bipolar transistor.

You mentioned that you tied the base to 0 volts. That should have turned the transistor off. A bipolar transistor is turned on when the base-emitter junction is forward biased. You&#8217;re using a NPN transistor so, when the base is 0.7 volts more positive than the emitter, the transistor should be on. When the base is at the same voltage as the emitter, the transistor should be off.

You can roughly check it with an ohmmeter. This is not a perfect test. But it will show a blown transistor. The transistor still could be bad. Take the transistor out of the circuit.

Put the positive lead on the base and the negative lead on the emitter. It should show a forward junction. (Some continuity) Reverse the leads, it should show open.

Put the positive lead on the base and the negative lead on the collector. It should show a forward junction. (Some continuity) Reverse the leads, it should show open.

Put the positive lead on the emitter and the negative lead on the collector. It should show open. Reverse the leads, it should show open.

 
So Andy: I can forget the spring and connect it as you said 'same as allways' (= same as <A href='http://members.chello.nl/t.verbeek6/bestanden/18x+transistor.jpg' Target=_Blank>External Web Link</a> ?)

Chirp: Tying the base to -0V --&gt; that was exactly my same idea: making sure there is no voltage between base and emittor that should make the transistor 'block' (turn off).
I will do the resistance-checks as you described, to be sure, but because of the odd behaviour I will try one of those IGBT anyway. (will probably need them anyhow later)

Thanks, all.
Titus
 
Dear people,
Getting back on this same problem, still not solved:

I have a heavier transistor now, bc337, which should do the job (light 24 leds, controlled directly by the output pin 3 of an 18X picaxe chip) but still: as soon as I connect the picaxe instead of the button in the simple circuit below
<A href='http://home.wanadoo.nl/sepeezebinkhorst/misc/ledje%20met%20tor.png' Target=_Blank>External Web Link</a>link
the leds are lighted all the time. (there is some flickering but they do not dimm really)
This is maybe something for the manual (Technical?) because I won't be the first hitting this problem and spending weeks to overcome it.

Why does the bc337, connected according to the <A href='http://www.promelec.ru/pdf/bc337.pdf' Target=_Blank>External Web Link</a> datasheet stop doing its job as soon as a second powersupply (12 volt) is used (and both -0V's connected) and the picaxe does the switching?

Any help is appreciated!!
T
EDIT: fixed second link. (was wrong one)
Adding a 10k resistance instead of a 330 between the picaxe output pin and the transistor makes the dimm-range come close, but it seems to have a too small range. neither do the leds dimm entirely, nor do they fully light.
Any suggestions?

Edited by - TitusVerbeek on 1/17/2006 12:36:40 PM
 

MartinM57

Moderator
OK,in your posted picture, closing the switch will turn the LEDs off, opening the switch will turn them on.

Normally, driving a transistor from a PICAXE, you would not have the 10K resistor to V+ ... you would just use a low'ish resistor (1K, 4K7 maybe) between PICAXE and the base. This preserves the 'sense' of the link - PICAXE output high = LEDS on, PICAXE output low = LEDs off.

Try a really simple PICAXE program to toggle the output pin (and hence the resistor to base) on and off, say once every 5 seconds, see what happens AND measure the output pin with a voltmeter
 
tried that. EDIT. 1k between picaxe and transistor works but with same result: pulse control just makes slight changes in light. (never OFF) 10k between base and +12v maybe needs change?
By the way: No need for simpler circuit because I check the pwmout pulse (between OFF and 80% ON) with a led on the picaxe board.

Edited by - TitusVerbeek on 1/17/2006 12:53:22 PM
 

BeanieBots

Moderator
As stated by MartinM57, there should be NO resistor between base and +12v.
The idea of using a simpler program is to make sure that it switches fully on and fully off in a way that can be easily seen. That MUST be possible before trying anything cannot be &quot;seen&quot; to work such as PWM.
 
<BLOCKQUOTE><font size=1 face=arial>quote:<hr height=1 noshade>As stated by MartinM57, there should be NO resistor between base and +12v. <hr height=1 noshade></BLOCKQUOTE></font><font face='Verdana, Arial, Helvetica' size=2> noted that but if I do that my 'check led' dimms completely which makes me afraid something wrong is connected taking all the current. (short circuit?)-EDIT: Do you mean by 'no resistor between base and +12V' in fact 'no connection at all'?

<BLOCKQUOTE><font size=1 face=arial>quote:<hr height=1 noshade>The idea of using a simpler program is to make sure that it switches fully on and fully off in a way that can be easily seen. That MUST be possible before trying anything cannot be &quot;seen&quot; to work such as PWM. <hr height=1 noshade></BLOCKQUOTE></font><font face='Verdana, Arial, Helvetica' size=2>
OK, will to that. :-(

Edited by - TitusVerbeek on 1/17/2006 1:24:26 PM
 

MartinM57

Moderator
&lt;&lt;Do you mean by 'no resistor between base and +12V' in fact 'no connection at all'?&gt;&gt;

Yes! Maybe we have a terminology problem!

No resistor == infinite resistance == no connection!

If you connect the base directly to +v you WILL destroy the transistor.


Edited by - MartinM57 on 1/17/2006 1:32:34 PM
 
Ha! OK, we're clear on that! :)
So how, generally, do you control a slightly bigger power comsumer like 24 leds (8 bundles of 3 leds in series with a resistor taking 160mA at 12V in total) with a picaxe chip other than my apparently useless efforts?
Technical: I really think this is something for the manual.
Martin: Is it normal to need so much experimenting and 3 different types of transistor and still not being able to dimm a couple of leds? Would a Darlington chip make any difference?

Edited by - TitusVerbeek on 1/17/2006 1:44:51 PM
 
By the way I could get the mosfet I used earlier to work when I used the same power supply for the chip also for only one led. I will try that with the bc337 now. Just a second.

Edit: Did that. no success! The one led doesn't light at all. (mind I might have made a mistake, I will check that now)

Edited by - TitusVerbeek on 1/17/2006 1:58:42 PM
 

MartinM57

Moderator
Martin: Is it normal to need so much experimenting and 3 different types of transistor and still not being able to dimm a couple of leds?

No(!) Doing the sums quickly....a BC337 has a nominal current gain of 100. So 160mA through the LEDs is 1.6mA base-emitter current. If PICAXE output is 5V and Vbe for teh transistor is 0.7V, then teh series resistor needs to be 4.3/0.0016 = 2687 ohms, let's say 2K7 then!

&lt;&lt;Would a Darlington chip make any difference?&gt;&gt;
No - they just give much more gain - but you don't need it here
 

BeanieBots

Moderator
I cannot think why you are having so much trouble. It is very simple and very standard. The method has been used in millions of circuits that need to drive a high current high load from a small signal such as a microprocessor. As far as I can recall, it is documented in the manual.

Your problems so far have been a transistor that was not up to the job and a resistor fitted where it should not be.
 
OK, took one step back:
One led with resistor connected to the bc337 and the same source as the picaxe (4,5 volt) and 2k7 (thanks!!) between PWMout and the base of the bc337. WORKS.

(but led lights about half of its brightness) Must add that in my pwmout programm the max. is 80% duty. (because you don't see the difference) I messure 3,2V at the pwmout pin.

next step back to the 12volt and the 24 leds: uncontrollable leds. (leds fully on)

Are you sure there is no other connection needed when using a second power supply?
 

MartinM57

Moderator
With your 4.5V supply and a 470R resistor, you're getting (4.5 - 0.2)/470 A, which is 9mA, LED current - which is why it's not very bright. 220R or even 150R IN THIS CIRCUIT would give better brightness.

For the 12V circuit (and I'm starting to run out of ideas why it doesn't work) you say you need 160mA LED current, so R = (12 - 0.2)/ 0.16 = 73R, so I'd go on the safe side and use 100R.
 
STOP! I started all over again. I don't know why but the problem is (a lot less but) reversed. (sorry!!!)
&#8226;2k7 between picaxe and base.
&#8226;On and off and everything in between WORKS (yeahoo!!), but
&#8226;leds shine only very faint or off (when they should be).
&#8226;I tried both 4,5V and 6V for the picaxe side.

Edited by - TitusVerbeek on 1/17/2006 3:32:46 PM

Edited by - TitusVerbeek on 1/17/2006 3:33:46 PM
 
STOP again!!
Changed the bc337 with a new one. (all that experimenting might have not done the poor fella good) VOILA! IT WORKS!

Edited by - TitusVerbeek on 1/17/2006 4:08:20 PM
 

MartinM57

Moderator
Well done!

Welcome to electricity land!

Yes, I think you probably broke it with all the experimenting :-(

Onwards and upwards!!!
 
Yes, hereby:
<A href='http://members.chello.nl/t.verbeek6/bestanden/picaxe+transistorcircuit.jpg' Target=_Blank>External Web Link</a>
 
Top