I recently started building a fan controller based around two temperature sensors and for prototyping I used two LEDs instead of the fans and a photo resistor taking one of the thermosistors place in order to better test the system without having to heat one of the sensors. The tests that I ran with the LEDs turned out great and from this I got the software dialled to a point that I was happy with a sort of rough design. My attention turned to getting the hardware set up for the fans I was going to use. Replacing the LEDs with npn transistor would allow me to control the two fans up to the 12v that they need for full power and in doing so I got some weird problems.
First of all after I wired everything up and immediately the fans started without power to the transistors from pwm pin on the arduino and worse, when I attempted to speed up the fans by changing increasing the value of the photo resistor it did nothing to the speed of the fans as though it was completely separate from the rest of the circuit. So I began thinking that the current was too high for the transistors and placed current limiting resistors to decease the current to a value that was closer to what the fans needed to use. The only effect this had was that the fans didn't move at all. So I changed the hardware again to just LEDs again but instead of hooking them up straight to the arduino I used the transistors that I used in my attempt to control the fans and it worked exactly like the previous tests I without the transistors, perfect.
So I plugged the fans into the 5v supply, to rule out any chance of the fans being the issue, from the arduino using the transistors and I was able to control them just like I was able to with the LEDs, however, it seems like when I use a second power source in the circuit I get really weird problems. I have tried diodes, resistors and to no avail I cannot find a solution. If anyone has had a problem like this and/or know how to fix it any input at this point would be appreciated. Keep in mind I am grounding everything as far as sensors goes to the arduino and the fans to the power supply's ground. The transistors are a model n24401 and the power supply is a 12v, 1.2 amp supply just for some background. I am quite new to the arduino and general circuit design so really anything would help.