LM317 won't give full output with MCP4131, but does with resistor.

Use an Arduino to control an MCP4131 digital pot, which in turn controls a variable-output LM317 to programatically throttle (buck?) the output of a completely separate, standalone DC power supply with its output turned “all the way up” (17V DC).

When using the MCP4131, I cannot get more than 6.8V DC out of the LM317.

The external supply has a wall wart that feeds a small chassis with a pot/rheostat on the front.

The AtMega 328 w bootloader is always connected to a PC via USB FTDI adapter, which supplies 5V, ground, and allows programming.

I put a 510 Ohm resistor between the ADJ and VOUT pins of the LM317, which should work well with the 0-10K Ohm range of the MCP4131. The +17V DC output of the external supply feeds VIN of the LM317. The LM317 ADJ pin is wired to POW (wiper) of the 4131, and the 4131’s POB goes to ground. POA has nothing connected.

The MCP4131 accepts a value range of 0 to 127, which corresponds to resistance values of 0 Ohms to 10K Ohms. By putting a meter on the 4131’s POW and POB, I can see the resistance respond to progammatic control exactly as expected. So, the Arduino, SPI and the 4131 are working perfectly.

Here’s the trouble: The output from the LM317 peaks at about 6.8V DC at a value of apx 50 on the MCP4131. The additional steps of 51 through 127 do not result in any additional output from the LM317 - the highest output is 6.8V DC.

If I remove the MCP4131 from the picture and just use discrete resistors, I can see the full range of output from the LM317. For example, I see the LM317 output 9.3V DC by using a 3.3K Ohm resistor. A 9K Ohm resistor gives 16V DC out. So, the LM317 is doing his job, but he doesn’t like the 4131.

My observations lead me to conclude the MCP4131 is not acting like a “plain old” potentiometer, so I’m doing something wrong. I have tried various ground configurations, as I am suspicious of the separate USB ground versus the external 17V DC power supply’s ground.

I’m a coder by trade. I really enjoy trying to get electrons to dance - but I’m no EE for sure! I surely appreciate any help you fellas/gals can offer.

My first attempt at Fritzing is attached. I omitted the SPI and other various Arduino connections, as those are working.
(Corrected original post’s image - I had the ATmega and 4131 chips backwards on the Fritzing picure.)

The datasheet, page one, top right corner shows the 4131 pinout (MCP41X1)
The pot terminals are 5,6, and 7; 6 = wiper (see attached DWG); your fritzing (ugh!), if accurate, shows that’s all messed up.
You show the power backward, too. They don’t like reverse bias.
Anyway, take some time, do a hand-drawing of what you’ve done, take a picture of that and post it. Digital cameras abound.

[Electrons don’t dance - they march.]


Thanks for the reply! Oops, sorry about that: I had the 4131 and Atmega chips 180 degrees off in the Fritzing. I corrected the pin 1 position by flipping the chips, but the labels are upside down now (ugh, sorry again). I'll draw it by hand and post as soon as possible. [Also, thanks for the correction on the marching electrons.]

Hand-drawn diagram attached as a photo and a scan. Neither capture method improved my lack of drawing skill, unfortunately. Please accept my humble apology.

Again, the problem: regardless of the value I send to the 4131, I do not see any output from the LM317 higher than 6.8V DC.

The input from the external power supply into the LM317 is 17V DC. I hope to programmatically adjust the output across the range of (nearly) 0V DC to (nearly) 17V DC.
If I put a meter on the 4131’s POW and POB, I see a full range of resistance values up to 10K Ohms, fully and correctly dependent on the value I send over SPI.
Furthermore, I can replace the connection between POW and POB with a discrete resistor (removing the 4131 from the circuit), and will can see proper output from the LM317 above 6.8V Dc. For example: a 3.3K Ohm resistor yields a 9.3V DC output, and a 4.7K Ohm resistor gives 12.7V DC.
But I cannot get the LM317 to output higher than 6.8V DC when using the MCP4131. Why?

Again, I really appreciate any help on this!

Diagram scan.pdf (96 KB)

Diagram photo.png

That looks good. Thanks.

[u]Datasheet[/u] page 32: 3.5 Pot Terminal B 3.7 Pot Terminal A The voltage on terminal A/B must be between Vss and Vdd.

Connect your mechanical potentiometer again and note the voltage across it as you adjust it.

Yes, you can't get a digital pot to handle signals outside of its supply-range - that's a given for any chip...

MCP4131 takes a supply of 1.8V to 5.5V - won't do what you want, the standard approach to generating a control voltage out of the 5V range would be a DAC driving an op-amp in non-inverting configuration. The op-amp would be powered at the higher voltage.

Gentlemen, THANK YOU!

"The voltage on terminal A/B must be between Vss and Vdd." Well, that certainly makes it clear. I will measure voltage across the mechanical pot so I can see the voltage go past 5.5V, just to nail this one shut in my mind.

I'll investigate the DAC/op-amp solution next. Next stop, Google. I'll get those electrons marching soon, I hope.

Again, I appreciate your help, and thanks for your patience on the diagrams.


Gentlemen, I started investigating the DAC/Op-Amp solution and quickly became overwhelmed by the choices. Can you offer a couple of potential specific part numbers that you've had success with in the past for the DAC and Op-Amp?

The parameters are use of an Arduino to control a DAC that then controls an Op-Amp that thus controls/throttles/bucks an external power supply delivering max 20V DC at max 2A.

Thanks for any input.

(The overall goal is to provide programmatic control of a power supply that's turned "all the way up" with the remote control module sitting between the power supply and a device using the power.)