View Full Version : Fan Speed Control

11-18-2009, 05:23 AM
Hello all!

I'm trying to build a laptop cooler with a temperature controlled variable speed fan. I've ordered the main components such as a DS18B20 temperature sensor and a 12VDC pwm computer case fan. I have seen multiple projects similar to this on the internet, but I need help controlling the fan speed. The one I found uses 5V fans not 12V.

Here's my problem. I want to use the pbasic command pwm to tell the fan what speed to operate at using duty and duration. The problem is the duty is only rated for 0-5V and I need to output pulses at 12V for the fan to operate at its optimum rpm range. Is this possible? Do i need to use a transistor to switch the fan up from 5v to 12V or what? Any help we be amazing.



11-18-2009, 06:52 AM
Take a look at this web site

·Click here....>>>>>· Fans ( http://www.coolerguys.com/5vf.html)

··Thanks for any·http://forums.parallax.com/images/smilies/idea.gif·that you may have and all of your time finding them http://forums.parallax.com/images/smilies/smile.gif


11-19-2009, 04:11 AM

Thanks for the reply. Yeah, I've found a bunch of 5V fans, but i was just wondering if there was any other way.

11-19-2009, 10:55 PM
Will a 5V .15A fan work with the Bs2 board? Can it handle that amount of current?

Mike Green
11-20-2009, 12:29 AM
A BS2 I/O pin can handle maybe 25mA. If you want to control more, look at Nuts and Volts Column #6. Go to Parallax's main web page and click on the Resources tab. In the list that you'll get, choose the Nuts and Volts Columns link and look for column #6.

11-20-2009, 06:33 AM
Ok, so let me see if I'm understanding this right. To get the fan to be powered by the BS2 board pin, I need to use a (in my case) ZTX689AB Transistor to get the current up, pairing this with a 390 ohm Resistor will send a 5V signal from the board to the transistor, but will loose .5V, so the fan will be at 4.5V, but will have enough current (need .15A and will get 2A?). Is that right? So then I can send pwm to the fan? Do i send this signal out through the same pin (+V) or the ground?

Mike Green
11-20-2009, 06:45 AM
Again, refer to the Nuts and Volts Column I mentioned.

Yes, you need to use a switching transistor to control the current for the fan. This switching transistor will drop a small amount of voltage across it that will "take away" from what's available for the fan (usually about 0.3V - typical for a saturated switching transistor). The fan will use as much current as it needs, in your case 150mA (not 2A!)

If you need to control the fan's speed, you should be able to use what's called PWM (pulse width modulation). This turns the fan on and off rapidly so the average current (and average speed) is what you want. A BS2 can't do anything else when it's generating PWM signals, so that may not be practical. If you really need to control the fan's speed, there are some external circuits that can take responsibility for the actual PWM operation so the Stamp doesn't have to do it.

11-20-2009, 06:54 AM

Thank you so much for pointing me in the right direction. So basically, if i want to use the BS2 pbasic command PWM, I could'nt say take the temperature using a DS18B20 at the same time? If not, what external circuit will i have to build to free up the BS2 but still use PWM? What does it consist of?

Mike Green
11-20-2009, 07:03 AM
You could use an LM555 timer with digital potentiometers to set the frequency and pulse width. There are different digital potentiometers all of which can be controlled with a Stamp. Look at Maxim/Dallas' website for a large selection of potentiometers.

11-20-2009, 04:25 PM
Just to add you shouldnt overlook starting current for the fan

11-20-2009, 07:31 PM
You can also see Chapter 6 & 7 of Process Control.

12-01-2009, 10:34 AM

So I got the fans figured out, but i have another problem. I ordered 3 DS18b20's thinking I could use them with the BS2 but in reality the commands owin and owout only work with the bs2p. Is there any way to get these to work with the BS2 I saw a code by PH Anderson, but I'm not sure exactly how everything is hooked up. Should I just forget it and use a LM34 sensor to make my life easier?