Question about DC DC Step Up converters

But how does the feedback pin work - have you thought about that?
The key here is that the feedback pin looks at the voltage that is fed back to it (hence the name) from the output of the regulator. This is how it regulates - if the output rises, it quenches, if it drops, the regulator opens up - simply put, in layman's terms.

If you put a DAC and some kind of controller into this feedback loop, you're making the regulator dependent on the operation and speed of that controller to look at the output voltage and translate this into a sensible output to the FB pin on your regulator. Getting that to run stably may be a bit of a challenge - without it oscillating and quite possibly going into a meltdown mode.

Whether your circuit works or not is debatable, but one thing is clear: the fact that you're using the R1/R2 divider as well as a DAC/PWM input implies that you're mixing up two modes of control. So even if this works, it's only by virtue of whatever DAC or PWM circuit you have overdriving the feedback signal derived from the output through R1. Then why have R1 to begin with - which brings the question what purpose R2 has. That, in turn, depends on the control circuitry we don't see - as does the entire functioning of the setup.

If you want a programmable output voltage, the most sensible thing to do is to select a converter that is explicitly made for this by accepting some kind of input that sets the output voltage, while the regulator can maintain its own feedback loop. Alternatively, you could use a higher input voltage than necessary and take some kind of DC-coupled power amplifier that you set to the desired level.

However, all this is kind of hypothetical, because any sane design exercise along these lines would have to start by making a couple of requirements explicit: what is the voltage range you need to generate, what is the input voltage available, what kind of loads are you expecting to power, what is the required output filtering/what kinds of noise (qualitatively and quantitatively) are acceptable, what kind of safety features are required (overcurrent, overvoltage, short circuit protection etc.), what's the required efficiency/maximum dissipation in the converter - and probably a few others.

The more you try to keep your options open by basically saying "as high/clean/powerful/etc as possible", the more complicated the design effort will be.

If this is about basically building a variable lab power supply, in all honesty, save yourself the trouble and just buy one. They're affordable these days.

Ok now I perfectly understand your point.
I took the DAC as a good starting point for my project because I also found an article from Analog Devices that explain the DAC system summed in this schematic.

Now about your solution of digital potentiometer, do you think it is better to replace R1 or R2? Or maybe even a dual output digipot can be the only solution in the feedback line?

Replacing R2 would take you beyond the maximum ratings of most digital pots. Replacing R1 is safer in that regard.

You could of course do a mix of both; replace R1 with a slightly smaller resistor and tie the wiper of the digi-pot to the FB pin, lower leg to GND or a small resistor to create a little offset, and the upper leg to the lower leg of R1.

By playing with the values, you can pick an optimum between range and resolution depending on your application.

Whatever you do, keep the maximum ratings of the digi pot in mind. Most digi pots don't want any of their legs exposed to voltages over ca. 6V. There are a few exceptions that go to something like 30-40V if memory serves, but they're few and far between.

Yeah, cool approach. You'd have to run the numbers, but I expect the range will be somewhat limited, depending on how you select R1 through R3. The math is all worked out; it's a matter of putting it into Excel/Calc and playing with it.
I assume you took the illustration from here: Digital Adjustment of DC-DC Converter Output Voltage in Portable Applications | Analog Devices

Ok I'll keep the R1 solution.
Thank you for now I take a deep dive now into this and I will come back to you guys. Thanks for now

R2, like I suggested back in post #12, one side is grounded

Rsmls suggested R1, but if I consider R2 I can connect two pins to ground of the digital potentiometer?

My apologies, I got them switched up. The lower resistor connected to GND is the most straightforward to replace since it won't violate the ratings on the digi pot.

Yes, if you mean like this: top pin to R1, the bottom pin to ground and the wiper to ground

So I have tried this solution with a digital pot AD5160 by Analog Devices with SPI interface.

image

I would say it works, but it is not precise, if I increase or decrease the analogWrite to the digipot, sometimes it gives a peak of voltage, and sometimes it drops.

How can I fix it?

I am also considering the DAC way, I found an article by analog devices, which explains all with these schematics:

image

What are your thoughts about it?

That's not how you control a digital pot meter, though.

Can you show the code that controls the pot, please?

My bad I wrote the wrong code.
I based all on this code found online.


/*

  Digital Pot Control

  This example controls an Analog Devices AD5206 digital potentiometer.

  The AD5206 has 6 potentiometer channels. Each channel's pins are labeled

  A - connect this to voltage

  W - this is the pot's wiper, which changes when you set it

  B - connect this to ground.

 The AD5206 is SPI-compatible,and to command it, you send two bytes,

 one with the channel number (0 - 5) and one with the resistance value for the

 channel (0 - 255).

 The circuit:

  * All A pins  of AD5206 connected to +5V

  * All B pins of AD5206 connected to ground

  * An LED and a 220-ohm resisor in series connected from each W pin to ground

  * CS - to digital pin 10  (SS pin)

  * SDI - to digital pin 11 (MOSI pin)

  * CLK - to digital pin 13 (SCK pin)

 created 10 Aug 2010

 by Tom Igoe

 Thanks to Heather Dewey-Hagborg for the original tutorial, 2005

*/

// inslude the SPI library:
#include <SPI.h>

// set pin 10 as the slave select for the digital pot:

const int slaveSelectPin = 10;

void setup() {

  // set the slaveSelectPin as an output:

  pinMode(slaveSelectPin, OUTPUT);

  // initialize SPI:

  SPI.begin();
}

void loop() {

  // go through the six channels of the digital pot:

  for (int channel = 0; channel < 6; channel++) {

    // change the resistance on this channel from min to max:

    for (int level = 0; level < 255; level++) {

      digitalPotWrite(channel, level);

      delay(10);

    }

    // wait a second at the top:

    delay(100);

    // change the resistance on this channel from max to min:

    for (int level = 0; level < 255; level++) {

      digitalPotWrite(channel, 255 - level);

      delay(10);

    }

  }

}

void digitalPotWrite(int address, int value) {

  // take the SS pin low to select the chip:

  digitalWrite(slaveSelectPin, LOW);

  delay(100);

  //  send in the address and value via SPI:

  SPI.transfer(address);

  SPI.transfer(value);

  delay(100);

  // take the SS pin high to de-select the chip:

  digitalWrite(slaveSelectPin, HIGH);
}

Why? Does your pot actually have 6 channels? It doesn't seem to do. You're using a library for AD5206 while the part in your schematic is AD5160 - they're totally different devices.

Also, why would you cycle through all channels (which don't even exist!) and then run through all wiper positions in every iteration of loop? No wonder you get erratic results.

Your circuit should be like this

You must go one step at a time very slowly when you want to change the voltage

I know, in fact I set to channel 0 only, I don't have the code here at work, as I said I based it on the code above.
It is working but I get spikes and drops sometimes in voltages.

Thanks Jim, yes also in the same article I found it is also using 3 Resistors. I will have a look to redesing the schematic.

What do you think about the DAC solution?

You're using the wrong library for your device.

Do you know an alternative library that I can test out?

And connect the wiper to B and ONE step at a time slowly.

What do you think about the DAC solution?

I've done that in the past but had to do quite a bit of spice simulation to get it right

I'm afraid not. You could try a couple of things:
1: Compare the datasheets of AD5206 and AD5160 and determine where the differences in command structure are. Then decide if you can use the AD5206 library and just avoid any function calls that would not work with the 5160.
2: Do the command comparison and modify the AD5206 library so it's actually compatible with the AD5160. Since the 5160 looks like a simpler device, you could probably prune down the 5206 library and maybe make a few further changes here and there. Depends on how they differ exactly.
3: Write a library for the 5206 from scratch based on the datasheet.

In all cases, you'll notice that you have to back to the datasheet of the device and work out how it's controlled. You can use the existing 5160 library for inspiration on how to code it. The fact that you get some response apparently from the 5206 suggests that something is happening and the "SPI.xxx" commands might work and you don't have to fall back on bit-banging.

PS: option 4 which I used to prefer when I just started out: look for which parts a library is available and then use/buy those parts.