2
\$\begingroup\$

I came across this question here:

MCU 'remote control' of DC-DC converter's Vout adjustment potentiometer

It is about controlling the output voltage of a DC/DC buck converter by injecting voltage into the middle of the voltage divider of the feedback pin of the converter.

One of the answers is in this diagram below on the post, with a DAC attached to an MCU and this DAC is used to control the output voltage, by connecting it by a R3 resistor to the voltage divider of the converter.

Can I use an ESP32 MCU, that already has a built-in DAC, and connect it directly to the R3 and to the converter? Would it work the same way? Can the ESP32 DAC handle current going into it and out of it, without damaging it?

If so, is there a formula to calculate the R3 resistor needed, for max. voltage -> 30 V and min. voltage -> 18 V? Is it even possible to achieve this voltage difference with a 3.3 V ESP32 DAC?

enter image description here

\$\endgroup\$
1

1 Answer 1

3
\$\begingroup\$

tl; dr: wide regulator output range is hard, if not impossible, to achieve with a microcontroller voltage DAC control. It’s more feasible (and repeatable) with a current DAC.

If you insist, here’s how to move through. First, remember that the FB node will always be Vref. Use Kirchhoff Current Law to work out the formulas for each resistor current to/from the FB node. Then, formulate this in a spreadsheet and experiment with different resistor values. That’s a basic design procedure.

Maxim app note that includes the math: https://www.maximintegrated.com/en/design/technical-documents/tutorials/8/818.html

Alternately, model it in Falstad with an op-amp standing in for the regulator.

How does the DAC work to set the voltage? The current to/from the DAC will be into Vref. The DAC will interact with FB and the output voltage as follows:

  • DAC voltage higher than Vref, sources current into FB and drives the output voltage down
  • DAC voltage lower than Vref, sinks current and drives the voltage up

Now here’s the thing. To achieve a range that includes a high-ish output voltage (30V, say), the DAC has to sink enough current to GND to get the job done. The higher the desired output voltage, the more current it needs to sink. Also, if the DAC itself doesn’t swing all the way to GND that can also work against you.

Scaling the feedback pair to their highest feasible values makes this more achievable. The regulator datasheet will tell you recommended values for R1 and R2. Pay close attention here: there may be some feedback loop stuff that depends on it.

Your attempt to minimize DAC current could result in a feedback pair of such high values that your circuit will suffer other problems, including inaccuracy due to bias current, instability or poor transient response.

My guess is that it won’t achieve 30V because the DAC won’t be able to sink enough current, or swing to a low enough voltage. You could remedy this by adding a buffer or perhaps a voltage-to-current conversion circuit.

Or you can use a DS4432 and call it good. This is what I suggested in the answer you reference.

BONUS: DAC control with a voltage-controlled current sink. Default voltage about 18V. Adjust as needed. Simulate it here.

A major benefit of this circuit is that the DAC will tend to power on at zero, or possibly, high-Z. Either way, this will result in the lowest output (default) voltage. The op-amp only needs to swing in the region of FET threshold, so 1.5V or so, although the LMV321 will work just fine.

enter image description here

\$\endgroup\$
3
  • \$\begingroup\$ Thanks so much for your detailed answer! If I still want to try out in the bench,, adding a buffer would make it work with the onboard ESP32 DAC? A simple opamp buffer like this? eecs.tufts.edu/~dsculley/tutorial/opamps/opamps5.html \$\endgroup\$
    – Rodrigo
    Oct 30, 2022 at 10:13
  • \$\begingroup\$ You would need a buffer that swings rail-to-rail and can run on 3.3V. Not impossible, but it narrows down your choices. \$\endgroup\$ Oct 30, 2022 at 13:01
  • \$\begingroup\$ Thanks! Seems like an LMV321 would do the job then! In fact I need a max voltage and a fixed lower one, not a swing between them. I read in that post that you said something about a Mosfet and resistor to have fixed outputs voltages controlled by IC pins. I think that´s what I really need. I´ll make a new question.. if you could help me out on that would be great! \$\endgroup\$
    – Rodrigo
    Oct 30, 2022 at 14:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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