Replacing the potentiometer on LM2596S with a digital pot?

Hi all,

I purchased a DC-DC step down (buck) converter using the LM2596S 150 kHz IC.

I studied the application note as per suggested by ti datasheet:

R2 which is the top resistor for a feedback voltage:

Vout = Vref *(1 + R2/R1)

Soldered on the circuit, R2 is a potentiometer range from 0 up to about 10 kOhm which is the blue colour squarish plastic thing with a brass knob part number is Bornus 3296.

It looks like a very simple pot with terminal B - wiper and terminal A, hence 3 pin outputs

I de-soldered the pot and trying to replace it with a MCP41050 digital pot and Arduino Mega2560, so that I can digitally control the output voltage without the need to mechanically alter the voltage everytime.

I figured out that only terminal B and wiper are in use on the board, and there is a connection between terminal A and wiper made on the PCB track. So I basically replicated and replace the mechanical pot with a digital one.

However, the problem is that after replacing the pot, the output of the step down converter does not change no matter whatever resistance I output from the digital pot. Later, I even add in series connected resistors to see if the output can be digitally adjusted. FAIL X.X

So wondering if anyone could give me some suggestions or help, or even want more details of my work.

Thanks for looking.

Correct me if I'm wrong, but the MCP41050 looks like a 50K digipot? Wouldn't you want a 10K pot like a MCP41010 to replace the 10K analog pot?

For anyone else wanting to help.......here s datasheet—

So.....how did you connect the digital pot? Do you have a picture or schematic of that? How did you power it? Which voltage/connections went to pot's VDD/VSS?
What code did you use to control it? Which pins on Arduino did you use?

Help us to help you. Need more info.

1ChicagoDave:
How did you power it?

Ooh good point, I hadn't considered that. Probably can't power it from the voltage reg output, since it varies. :wink:

What code did you use to control it? Which pins on Arduino did you use? [/quote]Also, confirm with a multimeter (voltage regulator not powered) that the digipot has the expected resistance values for full, mid, and zero settings.

tylernt:
Correct me if I'm wrong, but the MCP41050 looks like a 50K digipot? Wouldn't you want a 10K pot like a MCP41010 to replace the 10K analog pot?

Good point, but the matter is that it would still work when I set the output of MCP41050 in the range of 10K. Which you pointed out correctly, I lost 80% of the resolution.

1ChicagoDave:
For anyone else wanting to help.......here s datasheet—
http://pdf.datasheetcatalog.com/datasheet/microchip/11195c.pdf

So.....how did you connect the digital pot? Do you have a picture or schematic of that? How did you power it? Which voltage/connections went to pot's VDD/VSS?
What code did you use to control it? Which pins on Arduino did you use?

Help us to help you. Need more info.

A rough wiring diagram:

The Cff in the two lines connecting the LM2596 circuit and MCP41050 is a cap on the LM2596 not an external cap.

I set everything up on a breadboard for the time being due to the ease of plug and unplug. Cut long story short, the MCP41050 is powered by Arduino Mega2560 from its 5V pin, Arduino is either power from the main AC or via my laptop.

So Vdd (pin8) to either one of the 5V port on Mega2560 and I measured this voltage, it sits very close to 5V and we know its well regulated. Vss of course to anyone of the GND pin on Arduino, just to clear things, because I was using laptop to power Arduino and a DC power supply to power the LM2596 board, it might cause some confusion in terms of the grounding (earth issue). So I made an attempt on pairing all the ground pins to the DC power supply and powering everything ( Arduino, the IC which is driven by Arduino and the LM2596 module). Problem still exists.

My codes:

/*
 The circuit:
  * CS - to digital pin 53  (SS pin)
  * SI - to digital pin 51 (MOSI pin)
  * CLK - to digital pin 52 (SCK pin) */
// inslude the SPI library:
#include <SPI.h>

// set pin 10 as the slave select for the digital pot:
const int slaveSelectPin = 53;
//int channel = 0;
//int pot = 0;
//int level = 0;

void setup() {
  Serial.begin(9600);
// set the slaveSelectPin as an output:
  pinMode (slaveSelectPin, OUTPUT);
//  pinMode (SPICCLOCK, OUTPUT);//Needed to be defined?
//  pinMode (SLAVESELECT,OUTPUT); //same as above?
// initialize SPI:
  SPI.begin();
SPI.setDataMode(SPI_MODE0);//SPI_MODE0, SPI_MODE1, SPI_MODE2, or SPI_MODE3
SPI.setBitOrder(MSBFIRST); // LSBFIRST or MSBFIRST

}

void loop() {
    delay(10);   
    digitalWrite(slaveSelectPin,LOW);
    SPI.transfer(B10001);
    SPI.transfer(byte(128));
    digitalWrite(slaveSelectPin,HIGH);
}

Each time I change the code, I use a highly accurate multimeter to measure the output resistance, then I reconnect the circuit.

Pins I used for SPI on Arduino is 51 to 53 as per recommeded in the SPI secssion.

Thanks for looking again.

I even looked at the signal from Arduino that drives the SPI. Before plugging in the LM2596 and after.

Nothing interferes, so still no clue why it didnt happen for me.

I don't know if this will help you or not but you might want to look at a series of video made by Dave Jones. Here is the like to the first one.
http://www.eevblog.com/2011/11/28/eevblog-221-lab-power-supply-design-part-1/.

In his example he is working with a linear regulator that he want under micro control. However, it may be worth looking at.

RandallR:
I don't know if this will help you or not but you might want to look at a series of video made by Dave Jones. Here is the like to the first one.
EEVblog #221 – Lab Power Supply Design – Part 1 – EEVblog.

In his example he is working with a linear regulator that he want under micro control. However, it may be worth looking at.

Thank you, any info would be helpful at the moment because I am really STUCK.
Thanks

Looking over the datasheet for the Digital Pot, I came back with some concern...

Are you looking to control the output voltage between 1V and 5V? If more than 5V, you may have made the digital pot exceed it's voltage ratings...

Since a digital pot may be used just like a standard physical pot with a physical wiper it seems logical to assume you can use one here, as long as the potential of any potentiometer terminal is between ground and the power supply voltage, +5 V, and the current in the digital pot is limited, usually to 1 mA. See the datasheet... wiper has a 1mA max rating... which means... you may possibly force it to become a very small fuse...

What range of output voltages do you want to be able to get, and with what resolution? There may be easier ways than using a digital pot. For example, you could connect several resistors between pin 4 of the regulator and Arduino pins. The output voltage will change depending on whether each of those pins is configured as an input, an output driven LOW, or an output driven HIGH.

pwillard:
Looking over the datasheet for the Digital Pot, I came back with some concern...

Are you looking to control the output voltage between 1V and 5V? If more than 5V, you may have made the digital pot exceed it's voltage ratings...

Since a digital pot may be used just like a standard physical pot with a physical wiper it seems logical to assume you can use one here, as long as the potential of any potentiometer terminal is between ground and the power supply voltage, +5 V, and the current in the digital pot is limited, usually to 1 mA. See the datasheet... wiper has a 1mA max rating... which means... you may possibly force it to become a very small fuse...

To answer your first question, I am not using the digital pot as a potentiometer, hence the output would be resistance.

I setup the digital pot in the rheostat mode, so I should just be getting a reading between 0 and 50 kohm. I am not very clear about the comment that I might made the wiper become a small fuse, could you elaborate on this one please?

dc42:
What range of output voltages do you want to be able to get, and with what resolution? There may be easier ways than using a digital pot. For example, you could connect several resistors between pin 4 of the regulator and Arduino pins. The output voltage will change depending on whether each of those pins is configured as an input, an output driven LOW, or an output driven HIGH.

I am hoping to get a output voltage between 10 up to 14 volts from the converter. However, this voltage should be able to alter within the range and not remain constant. I will be very happy if I can get a 0.5v/step resolution for the start.

With your idea of connecting resistors from Arduino to the IC, you basically trying to turn on/off these resistors by playing the analog ports?

DouX_X:
I am hoping to get a output voltage between 10 up to 14 volts from the converter. However, this voltage should be able to alter within the range and not remain constant. I will be very happy if I can get a 0.5v/step resolution for the start.

With your idea of connecting resistors from Arduino to the IC, you basically trying to turn on/off these resistors by playing the analog ports?

With the port configured as an input, the resistor is in effect not present (provided the Arduino is powered up). With the port set to an output and LOW, the resistor is in parallel with the lower resistor in the feedback circuit, so the output voltage is increased. With the port set to an output and HIGH, a positive bias is inserted into the feedback input, so the output voltage is reduced.

Assuming you require that while the the Arduino is still starting up the output voltage should be at its minimum (10V), then the attached circuit should do the job. I have shown the values of the resistors as multiples of R, which is the resistor between the LM2596 feedback output and ground on your board. Setting each pins A, B and C to output LOW or output HIGH will have the effect on the output voltage shown in the table. This allows you to get 10V to 14V in steps close to 0.5V, along with several voltages below 10V.

I don't know if I would try to use the Arduino to switch resistor in and out of the circuit. The desired output is about 3 times higher than the maximum Arduino voltage.

DouX_X:
Good point, but the matter is that it would still work when I set the output of MCP41050 in the range of 10K. Which you pointed out correctly, I lost 80% of the resolution.

I have been working on a project that involves a digital pot, and have been really frustrated trying to find exactly the impedance that I need, in a pot that has the exact features and form factor that I need. Two workarounds that I have found are 1) to wire a fixed resistor across the two non-wiper inputs of the pot, thereby reducing its effective maximum impedance without compromising its linearity or its resolution, and 2) to use a fixed-resistor wired to a transistor, and then feed the transistor a PWM signal. PWM duty cycle maps to percentage of the fixed resistor's resistance.

RandallR:
I don't know if I would try to use the Arduino to switch resistor in and out of the circuit. The desired output is about 3 times higher than the maximum Arduino voltage.

The voltage at the Feedback input of the LM2596 (which is what the resistors from the Arduino are connected to) is only 1.23V.

joshuabardwell:
use a fixed-resistor wired to a transistor, and then feed the transistor a PWM signal. PWM duty cycle maps to percentage of the fixed resistor's resistance.

Interesting. Do you need some kind of smoothing cap to keep the output from rippling?

Also -- how's the linearity of this technique?

Interesting. Do you need some kind of smoothing cap to keep the output from rippling?
Also -- how's the linearity of this technique?

I apologize, but the technique is totally new to me, so I can't answer these questions with any confidence. I just wanted to pass it along conceptually, so that people could do more research if they thought it might fit their needs. The post in which it was suggested is here (http://forums.adafruit.com/viewtopic.php?f=25&t=43053#p214742)--maybe you can ask the OP.

I can speak a little to your question about the smoothing cap, however. I have been using the Arduino's PWM output in place of a potentiometer to control a circuit. The control signal runs at 2.7 volts, and there is a 22k pot that causes the received voltage to vary between 0 and 2.7 volts, with the resulting voltage being mapped to an output value by a welder. Instead of using a pot, I have just been using the Arduino's PWM output to send between 0 and 2.7 volts to the welder's "receive" pin. It has been working fine without any smoothing cap, and I conjecture that this is due to a combination of the high frequency of the Arduino's PWM and possibly the fact that the welder's detection circuit has some kind of incidental smoothing effect. I would say that the need for smoothing would depend entirely on the nature of the receiver and the frequency of the PWM signal. Since my welder works fine with a direct PWM input, I have every reason to believe that it would also work fine with a fixed resistor switched on and off by a PWM signal. In both cases, the welder sees, more or less, a square wave of a given frequency.

I would add that, in any case where a digital pot might be called for, and the control signal is less than 5v, it's worth a try to simply send raw voltage to the receive pin with the Arduino's PWM output. In many cases, the signal will be "analog enough" to be picked up properly by the receiving device. This approach makes me a little nervous, because there's the possibility of overdriving the receiving device's pins, whereas if you use a pot or resistor, you are always working with the original control signal, but it's an approach that some may be willing to take.

Another down-side of the direct-drive PWM approach is that I've found that the Arduino's exact PWM output voltage can vary a little, for example if it's powered off the wall vs. if it's powered off a 9v battery. This makes it hard to dial in an exact output to a receiving device. If you went with the transistor-and-resistor approach, the exact voltage of the PWM output would become irrelevant. Only the duty cycle would matter, so the device would have more consistent output.

joshuabardwell:
PWM duty cycle maps to percentage of the fixed resistor's resistance.

I think that we may be making this more complicated that it needs to be.

The purpose of the resistors and trim pots is to create a voltage divider to feed back into the feedback pin. The converter regulates the output to keep the feedback pin at a fixed voltage, usually 1.23 volts.

I think the best solution would be to filter a PWM output to generate a control voltage. Use an Op-Amp to buffer/amplify the control voltage. The control voltage and the output voltage can be used to feed another Op-Amp. The output of the Op-Amp can be sent to the Feedback pin.

8-pin packages with two op-amps are readily available and cheap. Add a few resistors and a couple caps and you have variable voltage supply that can be processor controlled. You might also want to put a voltage divider on the output and feed that into an analog input to read the output voltage. This will close the loop to insure that you are getting the output voltage that you want.

I think I would mock up the design with LTSpice to make sure that it works as desired.