Let's Make Robots!


Right, back again with an update on my idea for a kick-ass fanctroller. So far, I've been coding away and right now, I'm up to the point where the actual fan control is implemented (I've already written the LCD-commands, several input functions, a setup and a menu.) But I'm having some problems.

Now that the software is nearing it's end, I'm starting to think about the hardware again. I want to create a custom PCB for this thing. One of the things that bug me the most is the fan power delivery circuit. After a lot of testing (and I mean a lot), I came to the conclusion that the 3-pin fans I intend to use need a true analog voltage. If they're powered by PWM, the fan-speed readout is completely wrong.

That's where I'm at right now and I'd appreciate your input. How can I convert the PWM output (0-5V) of my arduino to a linear analog voltage between 0 and 12 volts with a power supply of 12 volts? I tried using the schematic below, but that gives me a maximum voltage of about 10.5 volts (because of the voltage drop over the darlington). Does anyone have a better idea?

R1 is the load (one or more fans/pumps)
R2 and R3 have been fiddled with endlessly
Q1 is a TIP112 Darlington pair
U1.1 is one of the two opamps in the TS272CN package
The most left wire goes to the PWM output of the arduino

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.


I was too soon with posting that it works... When I provide an input from a regulated 5V power source, the system works perfectly. When, however, I use a pwm output on my arduino to provide an input, it doesn't work anymore.

The system stops the fan when my pwm output is at maximum output (5V), but the fan isn't able to start again properly.

Any ideas? Thanks!

Not sure. I see no reason pwm signals should not transfer through from input to output... no blocking coils or capacitors...  Most normal Op-amps and mosfets should easily handle the frequency that pwm signals would be coming through at. That is going to be only a few hundred (possibly up to a couple thousand at most) cycles/pulses per second.

The only thing I see as a possible problem is, if you used your original layout, I see there is a capacitor from the input to ground. That would have the effect of smoothing out the pulses. If the capacitor is large enough it could smooth out the pulses, eventually making them disappear leaving the input as an average level rather than a series of pulses. Do you still have a capacitor on the input?

That's the whole idea of this controller... Have a linear voltage control. So I need to convert the pwm signal to a lineair voltage with an RC-circuit. Even without the cap, the circuit fails to work. I've noticed that when I pull the input low, it also take a while before the fan starts spinning (as if the opamp is figuring out what to do). I'm baffled...

With a capacitor there, it will take a certain amount of time to start spinning because the capacitor charges up and as it charges, the voltage across it increases.  It must get to a certain level before the motor will start to turn. It always takes more current to start any motor than to keep it running once it is already moving. This time depends on the resistance through which the capacitor gets its current (and is often referred to as the RC constant).

I am a wee bit confused, though. If you do not want the pwm signal, why generate it in the first place?


Basically, I need my fans/pumps speed to be variable. Because I also want the speed of my fans read out, I need to apply a constant voltage to them (the rpm-signal gets distorted when the fan is powered by pwm). In short: I need my arduino to deliver a variable voltage between 0 and 12 volt to my fans.

The only way I know to get a variable voltage out of an arduino is to use put a pwm-signal through a low pass filter. But because this is only 0 to 5 volt and the arduino can only deliver 40 mA, I need a sort of amplifier circuit to convert the  0-5 to 0-12 volt and be able to deliver at least 2.5A.

Running out of room here as this squeezes over...   I'll answer more above.

and it works splendid! The load receives 3-12V, which is perfect :)

If you can find one at a decent price, a fancier "rail to rail" op amp will almost give you a true 0-12V output. That might be close enough for what you need.

Not sure how it fits in with your application, but you could switch the transistor to low-side drive and swap your 0-10.5V output for a 1.5-12V output.

The only way I can think of to get a true 0-12V output would be to use some voltage boosting circuitry (charge pump, SMPS, etc) to bump your 12V supply up to maybe 18V, and then feed that into your transistor. Slap a 12V zener diode on the output to stop it from exceeding 12V, just to be on the safe side.

Whether it is 0-10.5 volts or 1.5-12 volts really makes no difference, since it will still be 10.5 volts across the fan.