Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pic and transistor as a switch

Status
Not open for further replies.

large_ghostman

Well-Known Member
Most Helpful Member
hello i have made a power supply from a pc power supply and i put it in a box. it works fine but it gets hotish in the box so i did a circuit with a pic18f1320 and a small pc fan to add extra cooling to the box my problem is turning on the fan from the pic pin i know i need a transistor and i have a npn one (BD139) but i cant work out what size resistor i need for the base of the transistor to get it to act like a switch (i have read up on it but cant do the maths) the fan uses approx 750ma the fan voltage is 12v the base voltage is 5v can anyone help me work out what resistor i need please
 
Well at a 750mA load and a min Hfe at 100...u need about 7.5 mA base current. Make it 10mA to be safe.
At 5VDC base voltage? PIC driven with pull up or direct from PIC?

If direct from PIC go with about 4.2V base voltage. V=Ir, therefore R=V/I = 4.2/.010 = 420 Ohms. Anything around that should be ok.

Edit: Why didn't u just tie the 12VDC fan to the pwr supply 12VDC rail...so it runs when the pwr supply is on?
 
Last edited:
Well at a 750mA load and a min Hfe at 100...u need about 7.5 mA base current. Make it 10mA to be safe.
At 5VDC base voltage? PIC driven with pull up or direct from PIC?

If direct from PIC go with about 4.2V base voltage. V=Ir, therefore R=V/I = 4.2/.010 = 420 Ohms. Anything around that should be ok.

Edit: Why didn't u just tie the 12VDC fan to the pwr supply 12VDC rail...so it runs when the pwr supply is on?

hi Mosaic,
The medium power transistor will not have a gain of 100 when used as a saturated switch, more in the region of 10 to 20.
This would require a base current in the order of 50mA.

I would use your suggestion of connecting the fan directly to the 12V supply line.:)
 
hi eric hi mosaic its true i could of connected straight to the 12v BUT :D i am learning some stuff while i wait for bits to come for my dads project i got the day off school today cos dad is home tommorow!! so i thought i would spend the day doing some more of my project i didnt want to just connect to 12v as i have got a lmsomething or other temp sensor that is connected to adc on the 18f1320 i have somehow got this to work and i have basic pwm working i am very close to getting the pwm working with the temp sensor so i thought i would have the fan speed change with tempreture i know this is somewhat stupid for what i am doing but its been fun trying and i have learned some stuff its been boreing waiting for parts to get here so i decided to do this while i waite sorry soo if the transistor needs more oomph to the base and i checked the sheet but it gives a few values for hfe but they are as eric says all lowish i also have a normal bc547 npn so i am guessing to turn the other transistor on i could use the 547 to turn the base of theother one on?? if thats true then how do i connect them and what resistors?? really sorry for asking but i got stuck with the maths although i am reading on it and trying to work it out but cant find easy examples to foolow
 
hi,
Good news about Dad. give him my regards.:)

If you have a BD139 and a BC547 you could use the lower power power BC547 connected to the two as a Darlington pair. Do you need a diagram.?

EDIT:
Diagram
 

Attachments

  • 000esp08.gif
    000esp08.gif
    30.6 KB · Views: 332
Last edited:
thanks eric i will tell dad hi from you i have seen darlington on the web so beforeask you for a diagram i will try and work it out one question tho what size resistor do i use from pic pin to the bc547 base?? i am realy tryin to grasp the maths but its hard and i hate maths
 
thanks eric i will tell dad hi from you i have seen darlington on the web so beforeask you for a diagram i will try and work it out one question tho what size resistor do i use from pic pin to the bc547 base?? i am realy tryin to grasp the maths but its hard and i hate maths

hi,
See my last post EDIT

NOTE: you may need a small heat sink on the BD139 if it starts to overheat.

EDIT:
This link may help with the maths
**broken link removed**
 
Last edited:
thank you Mr gibbs (mum says is rude to call you eric as your older than me) i have another question? we use 100nf decoupling capacitors on the pics but i have seen you put 47uf capacitors on your drawings for dad are theese decoupling capaicitors as well or do they do something else?? and are they electrolitic caps?
thank you and sorry for calling you eric
 
thank you Mr gibbs (mum says is rude to call you eric as your older than me) i have another question? we use 100nf decoupling capacitors on the pics but i have seen you put 47uf capacitors on your drawings for dad are theese decoupling capaicitors as well or do they do something else?? and are they electrolitic caps?
thank you and sorry for calling you eric

hi,
As you may already know, when you switch ON a FAN say [or any heavy current device], it draws a fair amount of current for few millisecs while its running up.
Its possible your power supply cannot supply this extra start up current, so the 47uF acts as reservoir to supply this extra current.

Without the 47uF the 12V rail could sag down for a few millisecs, any other device connected to the 12V line would see this dip and it could cause mis-operation within the rest of the circuit.-
Its always a good idea to have at least a 22uF and a 100nF on all you projects.

Dont worry about calling me Eric, after all thats my given name.:)
 
thank you so is the 47uf a electrolytic capaitor or a ceramic one or dosnt it matter?if its a electrolytic one wich way roun d does it go?? i will look at the maths link as well :D
 
thank you so is the 47uf a electrolytic capaitor or a ceramic one or dosnt it matter?if its a electrolytic one wich way roun d does it go?? i will look at the maths link as well :D

hi,
You will find that high values like 22uF or 47uF are Electrolytic [ or Tantalum, I would not use this type until you know more about electronics, they are VERY unforgiving if used incorrectly ] the 100nF are general purpose ceramic decoupling caps.

The capacitors +V terminal marked with a '+' sign always goes to the more positive voltage
 
thanks Mr eric (mum cant moan if i use mr can she :D ) that link is great i am going to read through it as it seems easier to understand than most sites i found on web thanks for info on capacitors i know its a pointless project but its more for learning than doing something i need you been a great help
 
hi all, logan has run up against a small problem and its got me stumped, he has set up the circuit as per erics drawing but we couldnt get to make the fan run. so we stripped it all back on the bread board untill all we had was the bc547 transitor, no fan etc. what we get is only 5v at the emitter not the exspected 12V.
i have checked and double checked in the datasheet and i am sure we have the transitor the correct way round. so does anyone have any idea why we would see 12v at the collector but only 3.98v at the emitter when the transistor is "switched" on?? i have tried several of theese transistors from the same batch and all are the same. when the other transistor is also added it also shows low voltage at the emmiter.
many thx chaps
 
hi all, logan has run up against a small problem and its got me stumped, he has set up the circuit as per erics drawing but we couldnt get to make the fan run. so we stripped it all back on the bread board untill all we had was the bc547 transitor, no fan etc. what we get is only 5v at the emitter not the exspected 12V.
i have checked and double checked in the datasheet and i am sure we have the transitor the correct way round. so does anyone have any idea why we would see 12v at the collector but only 3.98v at the emitter when the transistor is "switched" on?? i have tried several of theese transistors from the same batch and all are the same. when the other transistor is also added it also shows low voltage at the emmiter.
many thx chaps

hi,
Measuring from 0V to emitter should be 0V...

Do you have the transistor the correct way around,??

EDIT: image
 

Attachments

  • 000esp04.gif
    000esp04.gif
    12.9 KB · Views: 249
Last edited:
hi eric according to the datasheet its the right way round i have also reversed it. at present i only have q1 on the bread board, what should the voltage there be?
 
hi,
You cannot just have the BC547 on its own, with the 10K emitter resistor and say a 1K collector resistor.

If you want to test the BC547 , connect the emitter directly to 0V and the base to via a 220R to either +5V or 0V.
Have a1k resistor in the collector to either +5v or +12v.

As you connect the base resistor 220R to the 0V the collector should go High [12 or 5v] when you connect the 220R to +5V, the collector will go low.

OK.
 
Last edited:
ok thanks eric i will try that a bit later when i am allowed back out of bed! :eek: thanks for the help

hi,
Nice to see you back in action, take it easy for a while, your lad is doing a great job.:)
 
nice to be back. the npn checks out ok as per method above, so will rebuild board and try again!! might take a while one handed :D
 
much oddness going on, i have rebuilt the board five or six times exactly the same way each time and no luck! then the seventh time bingo it works, so i assume the bread board is on the way out :( or its just one of those things, thanks alot eric at least now we have a better idea how to use transistors and trouble shoot them. i am starting to dislike bread boards as this is a long way from being the first time i have had trouble that ends up being down to a iffy board!
 
Status
Not open for further replies.

Latest threads

Back
Top