PNP transistor forces arduino nano to reset....

Hi everyone! I am trying to build a temperature controlled fun circuit. I am using Arduino nano, a DHT11 sensor, a 20x4 LCD to display data and a 2N2222 transistor to control the fun. The problem is that the transistor seams to force the arduino to reset. The transistor is connected to the 9 pin of the arduino. Any ideas are welcome!
Thanks!

You need to post a schematic of how you have wired it up.

Note a 2N2222 is not a PNP transistor like you said in the title.

Edit-: when you say control the fun, do you mean control the fan?

Ok, about the fun control, when the temperature is below 25 Celsius the fun is off, at 26 celsious the fun works at 20%, at 27 celsious at 40% ect. I was sure the transistor 2N2222 is PNP transitor…. What I can use instead?

Hi,
You can still use the 2N2222, just reconfigure how you use it.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Show us what you have now and we can advise on what to change.
I think you mean fan when you say fun.
What size is it, how much current does it draw?

Hope to help .. Tom.... :slight_smile:

TomGeorge:
Hi,
You can still use the 2N2222, just reconfigure how you use it.

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Show us what you have now and we can advise on what to change.
I think you mean fan when you say fun.
What size is it, how much current does it draw?

Hope to help … Tom… :slight_smile:

;D ;D ;D Yes i mean fan when i say fun!!! I used the following schematic for the wiring

Of course the wiring of the LCD in my case is different , but i used the schematic in order to wire the transistor. The fan is 5volt 40mmx40mm, but i don’t know it’s power consumption…

Hi,
The transistor used in that circuit is a 2N2222 an NPN so it will work but for two things, the transistor emitter and fans power supply are not referenced to the arduino grn, and the base needs a resisitor.
I have added to the circuit to show you what is needed.
Temperature-Controlled-Fan1-.jpg

Make sure you have the 2N2222 connections correct.
4x AA cells would be enough for the fan supply, not the 9V battery.

Tom… :slight_smile:

TomGeorge:
Hi,
The transistor used in that circuit is a 2N2222 an NPN so it will work but for two things, the transistor emitter and fans power supply are not referenced to the arduino grn, and the base needs a resisitor.
I have added to the circuit to show you what is needed.
Temperature-Controlled-Fan1-.jpg

Make sure you have the 2N2222 connections correct.
4x AA cells would be enough for the fan supply, not the 9V battery.

Tom… :slight_smile:

Thank you Tom! Because the fan needs 5 volts supply I wired it to the 5v supply from the arduino, so the GND of the fan and the emitter of the transistor are connected with the arduino GND. I will definitely add a resistor to the transistor base as you recommended!

yiannis:
Because the fan needs 5 volts supply I wired it to the 5v supply from the arduino,

Powering the fan from the Arduino will reset the Arduino, as you already noticed.
Better wire it to a power supply of 5V (which could drive the Arduino too).

One way of avoiding the need for a separate power supply for a motor is to add some decoupling to the power supply. The last circuit on this link might work for you.
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html