Page 1 of 1

issue for NPN transistor as a switch

PostPosted: Wed Jul 15, 2020 10:20 pm
by jonjon
circuitEdited.png
Circuit diagram


Above is the image for the circuit diagram
i have issue for using transistor as a switch for mini-fan project
Objective : act just like a table fan, when the switch is pressed then it will turn on the fan indefinitely, press the switch again, the fan will turn off
issue :
1.fan not turning on / pin turn off itself when npn side switched
2.Power is lower using transistor than connect to + and - directly, i thought transistor suppose to amplify it?

Flow :
1. when the button is clicked, d7 will receive input in which the program will turn on d12
2. d12 will send signal to transistor at base in which should make the circuit complete and the fan will turn on

but the fan doesn't turn on, the fan is tested directly placed on positive and negative terminal and it worked
when i switch the side of npn transistor (collector and emitter position switch)
the fan worked for several second then turned off, i notice the d12 is turned off too

any help will be appreaciated :D

transistor model : CS9011
arduino : maker uno board
power source : computer usb plugged to maker uno

Re: issue for NPN transistor as a switch

PostPosted: Thu Jul 16, 2020 7:21 pm
by ober
Cannot see your image

Re: issue for NPN transistor as a switch

PostPosted: Thu Jul 16, 2020 9:29 pm
by jonjon
Edited , thanks

Re: issue for NPN transistor as a switch

PostPosted: Fri Jul 17, 2020 5:47 am
by ober
issue :
1.fan not turning on / pin turn off itself when npn side switched
2.Power is lower using transistor than connect to + and - directly, i thought transistor suppose to amplify it?

Flow :
1. when the button is clicked, d7 will receive input in which the program will turn on d12
2. d12 will send signal to transistor at base in which should make the circuit complete and the fan will turn on

but the fan doesn't turn on, the fan is tested directly placed on positive and negative terminal and it worked
when i switch the side of npn transistor (collector and emitter position switch)
the fan worked for several second then turned off, i notice the d12 is turned off too

1. Not really understand when you say NPN side switched. Make sure connection is correct before powering it up :) Base of transistor should be connected to control pin of Arduino and there should be a resistor in series, 1K to 10K ohm is good enough.
2. Not necessary, it depends.
3. Button we normally connect to GND instead of 5V. configure it as press LOW.
4. Well, I would separate the system into two parts. Make sure the control of fan is working first. Just write a program to ON and OFF the transistor periodically, like LED blinking, just with longer interval, like 2 seconds ON, 2 seconds OFF. If that works, then move on to input. Simply use the button on Maker UNO at pin D2 to start with. Press the button, activate an LED, say the LED at D3. If that works, then move on to combine these two parts. Then expand the input to D7 as you wanted.

Re: issue for NPN transistor as a switch

PostPosted: Sun Jul 19, 2020 1:41 pm
by jonjon
ober WROTE:
issue :
1.fan not turning on / pin turn off itself when npn side switched
2.Power is lower using transistor than connect to + and - directly, i thought transistor suppose to amplify it?

Flow :
1. when the button is clicked, d7 will receive input in which the program will turn on d12
2. d12 will send signal to transistor at base in which should make the circuit complete and the fan will turn on

but the fan doesn't turn on, the fan is tested directly placed on positive and negative terminal and it worked
when i switch the side of npn transistor (collector and emitter position switch)
the fan worked for several second then turned off, i notice the d12 is turned off too

1. Not really understand when you say NPN side switched. Make sure connection is correct before powering it up :) Base of transistor should be connected to control pin of Arduino and there should be a resistor in series, 1K to 10K ohm is good enough.
2. Not necessary, it depends.
3. Button we normally connect to GND instead of 5V. configure it as press LOW.
4. Well, I would separate the system into two parts. Make sure the control of fan is working first. Just write a program to ON and OFF the transistor periodically, like LED blinking, just with longer interval, like 2 seconds ON, 2 seconds OFF. If that works, then move on to input. Simply use the button on Maker UNO at pin D2 to start with. Press the button, activate an LED, say the LED at D3. If that works, then move on to combine these two parts. Then expand the input to D7 as you wanted.


1. The NPN side switched is no longer a issue, because i refer to wrong picture , as for the control pin with resistor in series, i tried 1k but it is not working, i try 220 then it work but the power to the fan is reduced significantly, any reason to use resistor?
2. how to make the transistor not reducing so much power flow? as compare to direct - and +
3.sorry i don't understand on this one, when i connect my button to (GND --- button --- pin), it doesn't work
4.thanks you for suggestion , the fan is working now but facing reduced power issue while my whole circuit doesn't use any resistor, even i added breadboard power module with external battery are still unable to reach the power of arduino alone with direct - and + power.

thank you very much :D

Re: issue for NPN transistor as a switch

PostPosted: Tue Jul 21, 2020 3:53 pm
by ober
Well, I think you misunderstand the transistor function in this case. It act as a switch, not as amplifier. The CE junction will drop some voltage depending on the transistor model and the driving current at Base. Just search NPN transistor as switch in Internet to understand more.

as for the button to gnd, as I highlighted, search for pull up switch in Internet. Or study the schematic of Maker UNO and the code. You will need to enable internal pull up resistor.

Re: issue for NPN transistor as a switch

PostPosted: Tue Jul 21, 2020 9:30 pm
by jonjon
thank you, i successfully changed to pull_up button
as for transistor, i tried to double pin at the base but the power remain the same, wasn't thinking amplify now but thinking to at least retain 80% of the power
the only solution for me is to buy better transistor
thank you for helping me to single out the problem

Re: issue for NPN transistor as a switch

PostPosted: Fri Jul 24, 2020 7:53 pm
by ober
well, that is good!