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.
Dan M's picture

Let me update the drawing so you will get a more even "analog" output. [It will actually be 256 levels /steps, but as close to analog as you can get from a μ-controller.]


I do understand that the so-called analog outputs from an arduino are really PWM (such as from the analogWrite command).  What I was thinking was that the capacitor you used might be too large of a value.  What size is the capacitor?


You might try removing the capacitor off the input and put one at the output. About 1 microfarad across the fan would be a good place to start and then go up or down from there according to the actual specs of the fan motor. According to this: http://www.maxim-ic.com/app-notes/index.mvp/id/3530


Another method would be this: 



[Yes, I see that I typed the word "allows" twice, but I am not going to fix it. Too many steps to go through to fix a drawing like that and it is not that important.]




MG2R's picture

One more thing, if I may. What software do you use to draw your schematics?

Dan M's picture

A free program called TinyCAD


It is pretty easy to work with once you get it first figured out.


[There is a list of symbols down the lefthand side, but rather than look through them, you can enter the word (like resistor, capacitor, NPN, PNP, mosfet, etc. in a box at the top (labeled 'filter') and it will find any entries of that item for you. Put them on the page and then use line draw button to connect them.]

MG2R's picture

Ok, thanks to the link and the schematic/info you gave me, I've got something I can work with... It's not perfect yet, but I'm getting there! To make it work I did the following:

  1. add a low pass filter on the pwm-output of the arduino
  2. add a low pass filter to the opamp output
  3. place a big cap over the fan AND mosfet (only the fan didn't give the best results)

Thanks for your tremendous help!

Dan M's picture

Since a regular bipolar transistor is a current sensiive device and FETs are voltage sensitive, I might use an FET for the output, but it is not a big deal, since a certain voltage through a fixed resistance will translate to a certain current anyway. However, an FET will give you more of a rail-to-rail swing.

You already have it worked out how to convert PWM to analog, otherwise I might have used a DAC (digital to analog converter, -either stand alone or from one of the microcontrollers that already come equipped with such, like a picaxe 08M2 or 28X2, etc.) You still need an output stage, however, to drive enough current for your fan load.

Here is an example: http://www.ebay.com/itm/MOSFET-FDD8447L-FSC-TO-252-2PCS-/250824808921?pt=LH_DefaultDomain_0&hash=item3a6652d9d9

That MOSFET (FDD8447L) is 40 volts max and up to 50 amps. Since you probably do not need anywhere close to that, at least it won't be burning it out anytime soon. That example ebay page sells them 2 for $1 with free shipping.

Even if you do not care to use an FET, different power transistors have different collector-emitter voltage drops, so you maybe just need to change the output transistor to a different one; --one with only a couple tenths of a volt drop.

MG2R's picture

If you look in the datasheet for the FDD8447L, you can see that Rds(on) isn't linear in function of Vgs. Moreover, it becomes apparant that the usable Vgs-range would be 3-5 volts if you connect this to an arduino. This makes it quite unusable.

Or am I missing something?

Dan M's picture

Hmmm, started to answer this yesterday then had internet problems and lost the post.  Let me try again.

I really just gave that one as an example to show how inexpensive such FETs can be from the right vendors.

However, I threw together a drawing that may illustrate a possible answer. (Click picture to enlarge.)

MG2R's picture

Am I right in thinking that this would be an inverted output? e.g if the µC sends out 5V, then the load will receive 0 V and if 0V is sent, the load will receive 12V?

If yes, great, no problem! If not, then I have no clue as to how this circuit works :s

Dan M's picture

No worries. Ok, we assume in this circuit that the input is coming from logic level (0-5 volts). I have used pin 2 of the op-amp as the input for the control voltage. The little minus sign means this is the inverting input.

Pin 3 is a non-inverting input and that input is coming back from the FET output which is (essentially) either 12 volt or ground.  [Ok, not exactly, but it's close enough.]  The output voltage at the Drain of the FET is dropped down using the resistor divider R1 and R2, so that if the output is ~12 volts, the feedback supplied the op-amp pin 3 will be at ~5 volts. The op-amp is being used as a comparator of the 2 inputs.

Ok, the op-amp output will be the inverse of the input at pin 2. This is being fed into a common source FET amp stage. Common source stages are also inverting. Thus the input was inverted once at the op-amp and then inverted a second time at the FET stage. The result is that the output from the FET is a non-inverted mirror of the input, but switching 12 volts instead of 5 volts.


MG2R's picture

so, when you put in 5V at pin 2, there will be 12 volts at the drain, thus there will be 0 volts across the load. When 0V is put in, the drain will be at 0 and 12V is applied to the load.

Would that be corredt? Thanks a lot!