I'm grateful for some advice.
I'm deep down the rabbit hole and getting out of my depth. I realise this has come up several times previously and have read and tried to understand these previous posts:
Is it possible to control a DC/DC buck converter's output voltage with the DAC of an ESP32?
I have a buck converter based on the XL4016 chip, datasheet here: https://www.makerfabs.com/desfile/files/XL4016-Datasheet.pdf
I am taking a 12 V supply voltage and using the converter to regulate a range of around 4-10 V. The total current will be around 4-6 A. The use case is thermostatic control of Peltier modules.
I am trying to use a microcontroller - Arduino Uno and a DAC the MCP4725, to control the voltage regulation instead of the onboard trimpot, inspired by Curious Scientists videos on Youtube and his website:
https://curiousscientist.tech/blog/mcp4725-szbk07-circuit-control
My understanding is that via the feedback pin, I can use current to imitate the usual feedback loop and make the IC vary its output voltage. I've realised the chip on my buck converter is different to his example..
With Kirchhoff's law of current and reading through the above site, my understanding is that at the the FB pin, where the voltage is maintained at the Vref of 1.25 V, the net current into the pin is 0, i.e. I1 = I2 + I3. By changing I3, the FB pin will regulate Vout and therefore I1.
By my calculations and measured resistances in my scenario, I2 is 3.7 mA (1.25 V/340 Ω). For a desired Vout of say 6 V, I1 would be 5.4 mA (4.75 V/880 Ω). I3 therefore should be 1.7 mA, which say could be Vdac of 1V with a R3 of 147 Ω.
Whilst this makes sense on paper, my prototyped setup does not behave well. I have managed to get some voltage regulation by altering the DAC output, but it fluctuates wildly, has a steep gradient of change over a tiny variation of output voltages. I've tried different resistor values for R3 at 100 Ω, 470 Ω, 1000 Ω etc. with no significant change. By my calculations and measurements, I only manage to regulate the voltage with an I3 current into the node rather than sinking it. e.g. Vdac of 2.85 V with R3 of 470 Ω produced a Vout of 7.1 V, suggesting I3 of 6mA, although when I tried to measure it it was around 3.5 mA.
I guess my questions are many:
- Am I measuring some things wrong? Could I2 be completely different, since otherwise
- The DAC in this case always going to act as a current sink?
- Is my breadboarded setup with wires all over the place causing significant interference?
- I have done the tests with the presence of a load on the Vout, is this wrong?
- Is this beyond the limits of my DAC? (I read about voltage DAC vs current DAC control - DS4432 being a good choice)
More broadly:
- Should I just change DAC to the DS4432 as mentioned in another post?
- Am I better off using a digital potentiometer rated to the max Vout (12)?
- Is there something about the XL4016 compared to the LM25116 (found on the SZBK07 used by Curious Scientist) that is preventing me from succeeding?
Many, many thanks in advance
Edit 1:
Many thanks for all of the input so far. Some of it I understand, some of it is a bit too advanced.
To clarify a few points:
- The intended load on the buck converter is going to be 4x Peltier modules in parallel operating at around 5 V 1.25 A each giving approx. 20-30 W total power. The microcontroller will act as a thermostat and therefore I will ideally be able to vary the voltage to the modules.
- The buck converter is a pre-made item that I bought online and is almost identical to the photo below. I have just found this datasheet which I assume is also identical.
- I have removed the V-adj trimpot and I am feeding my Vdac into pins 2/3 of that.
- I had chosen those values of resistors for R3 based on the measurements for R1 and R2 I made, in order to achieve the current sink by my calculations at 0-5 V.
Edit 2:
I've tidied up my breadboarding and my DAC control. I've tested the output of the DAC and it is stable with no fluctuation. It is a 12-bit converter. The 'useful' range of outputs is across 20 bit values - suggesting only modulating Vdac by around 25 mV!
The regulated Vout fluctuates by around 50 mV at its worst which for a Peltier module I don't think is awful?