Voltage Regulator

HI.
i am looking for a way (shield or whatever) to regulate voltage with the control of arduino.
i want to connect the system to 24V for example and with the arduino control to output 0-24V.
i am not talking about PWM. i want real voltage.
Thanks!

I don't know exactly how to do it... I can't give you a schematic... You need to have a good idea of how voltage regulators work. Most people just grab a voltage regulator IC and follow the manufacturer's recommended schematic, but you'll need a deeper understanding.

A switching regulator is probably best for two reasons - The Arduino doesn't have an analog output, and a linear regulator with that kind of voltage range will tend to generate lots of heat (depending on current) so you might need high power transistors/MOSFETs and big heatsinks, etc.

So, a switching regulator uses a kind of PWM filtered to DC through an inductor (and capacitor). The pulse width is controlled with via feedback, switching on when the voltage is below the threshold and off when above the threshold. With the Arduino it's "simply" a matter of adjusting the threshold in software. The Arduino does have an analog input (for the feedback), but you'd need a voltage divider to knock-down the 24V to 5V.

So, your request is wide open, and as such I could say "Sure, Eazy-Peazy!"

And proceed to advise you to feed that PWM output into a resistor that feed a capacitor with its other end connected to ground, then linearly amplified to 24V range [probably with an OpAmp]. Bingo! Nice, predictable voltage across the capacitor. unless:

  • You, also, need to supply any current from that voltage
  • You need a particular response time
  • You have some kind of aversion to ripple [see #1]
  • You need precision beyond what can be delivered with 8-bit PWM resolution [UNO] or 12-bit resolution [DUO].

What I described, above, is PWM modified by an amplified Passive Low-Pass filter. You can take that to the extreme with an Active Low-Pass Filter, and, perhaps with some extra buffering. That's a "Linear" solution, which is probably fine, as long as the current demand is low [e.g. below around 100 to 200 mA -- or more if a lot if heat dissipation is tolerated]. But, not much regulation in that scenario -- which may or may not be OK -- it depends on how you plan to use this thing.

For higher currents, I would suggest a "Switch Mode" approach. But, getting an Arduino [I'm going to assume UNO, for this discussion], to respond fast enough might be a challenge, unless your supply doesn't need a great deal of response time [e.g. if a sudden load change causing the voltage to sag or spike, isn't an issue -- or maybe, in your application, there will be no sudden load changes -- don't know, because your vague specifications leave much to the imagination ;)].

I've played around with this sort of thing, using a PIC µController to regulate current to a string of LEDs, by modulating the duty-cycle of a PWM output to a MOSFET [I also tried *pulse position modulation*, but that was a long time ago, and I don't remember which worked better]. The technique I settled on works quite well, since the collective forward voltage of the LED string doesn't change much.

Alshochat:
HI.
i am looking for a way (shield or whatever) to regulate voltage with the control of arduino.
i want to connect the system to 24V for example and with the arduino control to output 0-24V.
i am not talking about PWM. i want real voltage.
Thanks!

Not enough information. For instance how much current? Is the load analog electronics that cares about
switching noise? Do you really need all the way down to 0V?

Look up High power LM317 circuits.. Something like this - 15 Ampere Adjustable Power Supply - Power Supply Circuits

You don't even need an arduino for this unless you want a digital readout of some sort to display the output voltage.. For that look up "arduino voltage monitor" as well as "voltage divider" since you are working with 0 - 24 volts.

Simple voltage monitor code

/*===================Simple Serial Print DC Voltage Monitor==========
 Every 1 second this will sample voltage on Analog Input (Pin A0) and print it into the Serial Monitor

 This code is easily modifiable to support whatever display you choose.
 ====================================================================*/

int analogInput = A0; // This connects to the output of your voltage divider.

float vout = 0.0;
float vin = 0.0;
float R1 = 1128000.0; /*Exact value of resistor #1 in your voltage divider. Use a VOM to get the value and put it here*/
float R2 = 10000.0; /* Exact value of resistor #2 in your voltage dividers. Use a VOM to get the value and put it here*/
int value = 0;

void setup() 
{
Serial.begin(9600);  
} 
void loop()
{
   value = analogRead(analogInput);
   vout = (value * 5.0) / 1024.0; /* Don't mess with this */
   vin = vout / (R2/(R1+R2));  /* Or this unless you know what you are doing. */  
Serial.print(vin,2);  /* Print the sampled Voltage on A0 */
Serial.println(" DC Volts"); /* Print "DC Volts */
delay(1000);  /* Pause between samples */ 
}

You can't control a voltage divider from an Arduino as the OP asked...

And there won't be many digipots with 0--24V supply range. Typical feedback networks
compare a fraction of the output voltage with a reference voltage with an internal
comparator. Controlling the output means controlling either of the inputs to the comparator
in some manner - perhaps replacing the reference voltage with a DAC output if both
comparator inputs are pinned out.

I'd look for PSU's with (electronically) programmable output voltage as a feature.

MarkT:
And there won't be many digipots with 0--24V supply range.

Here's one: https://www.mouser.com/datasheet/2/609/AD5291_5292-877063.pdf

If you are looking for Arduino controlled power supply

Here are one of the open source Arduino controlled power supply

A fully open source programmable power supply offering professional lab-quality features and performance
https://www.envox.hr/eez/bench-power-supply/psu-introduction.html

https://forum.arduino.cc/index.php?topic=368780.15