I am creating a simple boost converter that step up voltage in the range 5V-30V. The switch is a MOSFET controlled by PWM output of an Arduino (with additional necessary components.) I want to implement a feedback mechanism to control or regulate the output voltage. I need to understand how a voltage divider read the output voltage as an analog input to Arduino and how to write the correct Arduino code for this feedback controlling.

  • 1
    \$\begingroup\$ Ok, this is far too broad. You're literally asking us how to build a voltage feedback boost converter without having an approach of your own. To top that of, you kind of indicate you're not experienced with real-time control by the choice of digital controller, so we'd have to first write a book on converter theory, including a lengthy chapter on control theory, and then a tutorial on how to write microcontroller firmware for realtime control applications, and one on practical converter design, and why arduino is very likely not the tool of choice. Nope, that's a bit much. \$\endgroup\$ – Marcus Müller Dec 28 '19 at 20:39
  • \$\begingroup\$ Control also means step response ,overshoot, load regulation and ripple so , Arduino code cannot fix that \$\endgroup\$ – Tony Stewart Sunnyskyguy EE75 Dec 28 '19 at 21:39

Boost converters use inductive charge pumps for high efficiency. A current is allowed to cumulate to an inductor from the low voltage source with a switch. The switch is kept ON a short time (typically for 10 to 20us) to prevent the current to grow too high. Induction law states that the current grows at rate voltage/inductance. That's amperes per second if voltage is in volts and inductance is in henries.

The switch is turned OFF abruptly. The current through the inductor fights its way with as high voltage as needed. That's the inductive or "flyback" pulse. In boost converters there's a diode which allows the current charge the output capacitor. Its voltage increases a little, typically only few millivolts, maximally less than 100 mV.

The switch controller observes the output voltage and starts a new switch ON-switch OFF cycle as soon as the output voltage has dropped under a specified regulation limit. It drops due the output load current as the math law of the capacitor states. The output voltage dropping rate (V/s) depends on load current and the capacitance. For that reason the output voltage swings up and down intentionally, but the swing is kept acceptable (well below 100 millivolts) with proper math design.

That design before all programming is your first job. Then you can check how quickly you must be able to run the controlling software loop. By having big enough inductor and output capacitor you can make the switch ON-switch OFF cycle as long as needed for acceptable software timing accuracy.

Switchmode converter design has been the subject of numerous cases in this site. Here's one: Flyback Converter Capacitor Value selection with given ripple voltage limit

Controller IC manufacturers have published detailed application notes with valid math for their ICs. Of course they must properly cover also the trademark independent design principles.

NOT ASKED: I recommend you to use a controller IC. Let the computer output the wanted voltage or adjust parts in the controller cicuit for that purpose. I guess you must make the software controlled ON-OFF cycle very long to get accurate enough output voltage. Big inductor costs money and its mechanical vibration can create very annoying whistle if the switching frequency is in the audio band.

Disclaimer: I'm not a competent programmer


Not the answer you're looking for? Browse other questions tagged or ask your own question.