Controlling two 12V fans with a 5V PWM, problems...

Discussion in 'The Projects Forum' started by corrado33, Jun 30, 2010.

  1. corrado33

    Thread Starter New Member

    Oct 22, 2009
    Hey guys, first, or second post, I'm not sure. Anyway, here's my problem. First off, there are NO erroneous connections, I checked every one with the multimeter. Basically I have an AtMega8. I have an LED, and a transistor connected to pin 17/PB3 (OC2). This pin outputs a PWM signal. But, that's not really the problem, because this happens regardless if I have the MCU in the socket or not. Here's a quick and dirty schematic for the problem I'm having.

    Geeze that pic sucks, here's a link to it so you can zoom in/download it.

    Ok, so as you can see, both the LED and a transistor are connected to pin 17. Two transistors are then connected to the first. (I'm not sure if I have it drawn right, but it's connected right, because I've used these transistors in very similar situations before, I always face them the same direction, and power goes in the top, out the bottom, with the control wire in the middle.) I'm doing this because I have a 5V PWM signal that I want to control 2 12V fans with. Yes, there are probably better ways, but this is what I thought of. So the PWM signal is sent through the first transistor, which is controlled by pin D7. The PWM signal then controls the two other transistors, letting the 12V signal through to the fans, and making me able to control their speed at the same time. The transistors aren't PWM optimized, but I'm under the speed they can switch at. Anyway, 12V shows up at wire 1 and 2, which makes sense (obviously, it's connected directly to the 12V source). However, 12V is ALSO present at wire 3, the control wire for both of the transistors. This is where I think something is wrong. 12V is also present at the wire connect to D7. However, when I test continuity, there is 700 Ohms of resistance between the wires 1 and 3 (and obviously 2 and 3). I thought that was odd, so I checked on another transistor not in use, and I got the same results. Since there is 12V present at wire 3, the transistor "opens" and lets current through to the fans, which also weirdly enough lights the LED. I'm so confused, I don't know where I went wrong. If anyone can offer any wisdom I'd be grateful. Of course the rest of the AtMega is wired correctly, I just didn't feel like doing the whole schematic. Again, this happens when the AtMega isn't in the socket.
  2. retched

    AAC Fanatic!

    Dec 5, 2009
    You didn't use resistors on the base of the transistors, thats not good.
    Also, are you using PNP BJTs as you have shown on the schematic?
    What is the code on the transistors? (Which model)

    If you dont get some resistors there soon, your gonna need a new ATMEGA.
    corrado33 likes this.
  3. corrado33

    Thread Starter New Member

    Oct 22, 2009
    Really? Why? (OH... uh.. is it because like in an H bridge when you try to switch the direction of the motor really quickly it sends a voltage spike (or is it a bunch of current?) going the other way?, if I don't have them the AtMega will take the brunt of it?) Yeah I'm using the PNP transistors. They're 2N 2907. I know a bit about this kind of stuff, enough to get me in trouble, but not enough to do things correctly most of the time. I'm just stumped, I honestly have no idea why this is happening. Of course, I had the rest of the circuit built and working fine until I decided to put these in. If worse comes to worse, I'll snip these two wires and use a separate PWM chip to power the fans.
  4. mcgyvr

    AAC Fanatic!

    Oct 15, 2009
    before you get into the same situation I'm in what type of fans are they. And are you simply trying to turn the fans on or do you want variable speed. I ordered some new brushless 12vdc fans and tried to control their speed via PWM and transistors like you but it doesn't work under 95% PWM duty cycle. The PWM screws up the circuitry in the motors (hall sensors) and just causes the fan to stall/wobble instead of spin. If you just want on and off you will be just fine (0% PWM on, 100% PWM=on) but if you want variable speed you need to look at another way to control the voltage to the fans. I'm going with a LM317 regulator and plan to drive 3 different fan speeds with 3 different outpu voltages from the regulator. Or I might filter the PWM, feed an op amp and be able to adjust regulator voltage via a range of PWM duty cycles.
  5. Norfindel

    Active Member

    Mar 6, 2008
    You need to limit the current that flows in a circuit, or you'll have a short-circuit. The led and the transistor base-emitter junction are diodes. They don't let current pass, until voltage is higher than certain threshold, then, they don't limit current at all, it would be like putting a wire from the uC output to ground.

    You should go to, and learn the basics.
  6. Bernard

    AAC Fanatic!

    Aug 7, 2008
    If you wish to keep PNP fan drivers, use an invertor to drive them.