Electronic – arduino – Variable Voltage with MOSFET using Arduino

arduinomosfetvoltage

fairly new to Arduino and all things relating to it. I have tried searching for the answer but to no avail. At least, it wasn't in terms that I could grasp.

I have a circuit that I want to be able to change the voltage via an arduino. The power source is is approximately 3.7v with 20A of power. Basically, I don't know what the correct component to use with this amount of amps. I though I could maybe use a digital potentiometer, but it doesn't seem that it is the correct part because there is too much current.

I know you can use a MOSFET as a switch. I was wondering if it is possible to turn the switch on and off with PWM and use that to change the voltage. So for example, if I had a duty cycle of 50%, the voltage across the cicuit would be 1.85V. Is this possible or is this even remotely the correct way to do this? Any help would be appreciated.

schematic

simulate this circuit – Schematic created using CircuitLab

Best Answer

I know you can use a MOSFET as a switch. I was wondering if it is possible to turn the switch on and off with PWM and use that to change the voltage. So for example, if I had a duty cycle of 50%, the voltage across the cicuit would be 1.85V

You can do something like this, but you have to consider the characteristics of the load.

Suppose the load is a resistor, or an LED & resistor, or something else where it's actually okay to apply the full voltage and you just care about the output power. In that case, you can just PWM, and this is a common way to vary brightness of a light. But more complex loads actually need a stable voltage. How do you produce a smoother voltage out of PWM input? You add a capacitor.

But then the output voltage on that capacitor will not be 50% of input — it will depend on the capacitor's charging curve and how much the load is drawing from the capacitor. So you need to vary your PWM duty cycle based on the voltage/charge on the capacitor — a feedback loop.

Now what you have is better known as a switch-mode power supply (SMPS). There's one more detail — you also need an inductor, which is used to avoid the losses which result from abruptly connecting a capacitor to a voltage source.

It is tricky to build a stable and efficient SMPS, and you should not try to build it using your Arduino as the controller. Instead, buy a premade module — you can find ones with voltage adjustment inputs. SMPSs are called either buck converters or boost converters depending on whether they lower or raise the input voltage, respectively. In your case you want a buck converter.