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

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?

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

Double_N.jpg

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

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:

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

Short-circuiting can happen to someone who will connections to the fans, because they will not be permanently connected. Therefore, I would make sure that even when nothing short circuit burned.

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

Until now, PWM output steered manually using this code:

int R = 200;
byte value = map (R, 0, 1023, 0, 255);
analogWrite (9, value);

A value of 200 is an example …
How do I know what the value may be the maximum, it will add security.
I wish it worked that way, that I set myself a specific voltage in uC and this value is specified for the load. This is important, that I associate with the speed voltage with generated wind.

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.

I have a 2-wire fans and can the control voltage.

You might want to map to ~50-255 Fans need a minimum to keep spinning (~1-50 is useless).

You need fan bootup in your final code. They need full power, or almost full power, for half a second to start spinning. Leo..

Short-circuiting can happen to someone who will connections to the fans, because they will not be permanently connected. Therefore, I would make sure that even when nothing short circuit burned.

In that case you might consider adding in-line fuses .