Variable voltage (0-12V) using PWM from Arduino

No I mean that there is no change in the input to that op amp no matter what the state of the opto LED is. It either connects the input to the supply through a small resistor, when the LED is on, or through a high resistor ( transistor leakage ) when it is off. The result is that the input to that op amp is always the full 18V.

Is a resistor on pin 5 opto-isolator will solve the problem? What should have value? 1k enough?

No a resistor on pin 5 will not solve the problem.

I found some other connection of opto-isolator. Will it be better?

schPowSupOpto.png|752x535

Looks better. :)

No, not completely better. Somewhat better. It is charging through 20k and discharging through 10k.

Why do you have an optoisolator? Why not just PWM through an RC network?

I cannot find the thread here now. Drive it with the Arduino output and smooth it in an RC network. Feed that to an Op Amp with a gain sufficient to change 5V into 12V. The Op Amp needs to be rail to rail, or you need to use a 15V supply voltage. An LM358 will only go to 1.5V below its supply voltage.

Or use an external DAC.

Or use a digital pot as part of the feedback/voltage set network on a linear regulator.

This SPI interface DAC chip is available in surface mount or PDIP for $6 each, minimum 2 from Linear Technologies. It can run on up to 15V and so can output 0-12V directly.

http://www.linear.com/product/LTC1257

Why do you have an optocoupler? Why not just PWM through an RC network?

Using optoisolator wanted to separate the microcontroller from the higher voltage.

The Op Amp rail needs to be a rail, or you need to use a 15V supply voltage. An LM358 will only go to 1.5V supply voltage below its.

What could replace the LM358 chip to improve my system?

Or use a digital pot as part of the feedback / voltage network set on a linear regulator.

I tried to use the AD7376 and AD5290, but both can withstand up to 15V and low currents. I plugged it into the inverter instead of potentiometer, worked for a while, and then he burned.

This DAC chip SPI interface is available in surface mount or PDIP for $ 6 each, minimum of 2 from Linear Technologies. It can run on up to 15V and so can output 0-12V Directly.

I'm afraid that this chip LT1257 does not allow me to power the 4 fans that need about 1.6A at 12V.

Will such a system as the scheme allows you to adjust the output voltage?

schPowSup5.png|2517x1431

You are feeding the feedback input with a low impedance signal from the Op Amp. So it is going to overwhelm the actual error signal and so the regulator will not operate properly.

G_. Do you want to re-invent the wheel.

Fans are perfectly happy with PWM.

One logic mosfet and two gate resistors (220ohm/100k) is all you need. And maybe a 1N4004 kickback diode.

If your fans have RPM outputs, feed that back into your Arduino.

Two PWM frequencies are used to make speed control less noisy. ~30herz and ~25khz. One being just below, and the other one just above our hearing. Use 30herz for normal fans. 25Khz is used for 4-pin CPU fans with inbuild speed control.

You can use TWO mosfets if your fans are too noisy at low speed. One that switches the fan negatives directly to ground, and one that switches the fans to ground via a suitable drain resistor (~22ohm/10watt). Drive the mosfets from separate Arduino outputs, and choose which fet to use in your sketch.

You could also use two fets per fan and have an RPM feedback loop for each fan. Leo..

And you have a diagram of such a solution with two mosfets? How is this accomplished? What MOSFETs use, to withstand up to 2A load?

First image is a common logic fet schematic with a 30Amp N-FET. Like this one. Second image is two of those fets with a 22ohm/10watt cement resistor in the drain of the second one. The value is estimated for four fans. Use the fet/resistor for "first gear", and the main fet for "second gear".

If you want to use RPM feedback, you might have to use P-FETs and high-side switching. I can draw a diagram if you're interested. Leo..

Single_N.jpg|640x395

Double_N.jpg|640x380

Yes. Please. I would like to test different variants.

Do you use 3-pin (computer) fans?

No. 2-pins only. Does this solution is not required at the output LC filter with Arduino PWM?

For 2-pin fans, use one of the schematics in the previous post. The 2-fet version is quieter at low RPM, if you get the code right.

Attached is a basic high-side version for 3-pin fans. AFAIK, with this schematic you can use the yellow tach wire to read RPM with an input pin with pullup enabled. Maybe someone can verify that, otherwise I will try tomorrow. Leo..

edit: The two 10k resistors in this schematic can be lowered to 1k for faster switching.

Single_P.jpg|640x435

After connecting the load in the form of fans probably will drop the voltage. I would like to measure the output voltage to be able to raise them programmatically. That is how I set in microcontroller 10V, I would like to be 10V at the output whether a load is connected or not. Such feedback. Can I implement a voltage divider at the output?

How to protect against short circuit arrangement on mosfets?

There is no need for any feedback, you should not get a voltage drop when you have a load that is what a regulator is for.

Why are you worried about short circuits on the FETs ? It is not normally an issue.

PWM puts the full supply on the fans for a shorter or longer time. e.g. when you set the PWM for 50%, the fans are getting full power half of the time, and are half of the time off. Switching is done so fast that the fans see it as half power.

Your code needs a startup sequence, and a range with a minimum value that guarantees spinning fans. Show us your code. Leo..

Hi,
Are your fans BLDC fans?
They may not like PWM as their supply because their speed is regulated by a built in switching system, speed is regulated by the system frequency not by the supply voltage.
That is why they have 4 wire fans, the 3rdwire is tacho out and the 4th is speed in.
The fans will change speed with load from the air flow, all you can do with 2wire fans is keep their supply voltage constant.
Lowering supply voltage will lower speed but also make the speed unstable.

Tom… :slight_smile: