Go Down

Topic: Need some advice on a Digital Potentiometer (Read 12534 times) previous topic - next topic


I'm working on my first real-world project;  It's a digital adjustable power supply.

I'm planning on using a digital potentiometer in it, and I've been reading a page in the playground utilizing the AD5206, a Digital Pot that has 6 outputs (http://arduino.cc/en/Tutorial/SPIDigitalPot).

That's a bit overkill for my situation (unless in the future I want to have multiple outputs on the supply), so I found what looks to be a similar version (it's similar and uses SPI like the AD5206).  It's the MCP4131.  Here's the datasheet:


Now, I've never used something that there isn't a prewritten library for, so this is a (fun) new experience for me :).  I was wondering if you guys think I could adapt the library for the AD5206 for use with this "little brother".

If I could, how hard would it be?  I've been sifting through the datasheet, and it might as well be an alien language for all the good those charts and diagrams are doing me.

Perhaps someone more skilled in this area could give me some advice? ;D



I can't give any advice, but I sure hope you get it working.  That is MUCH more what I'm looking for also - 81 cents is a LOT better than $5/chip.

I'll be following this thread and wish you LOTS of luck.

Ken H>


Thanks.  I thought five bucks a chip seemed a bit much for only needing a single pot.  If I ever get my power supply up and running, I'll be sure to post it in the Exhibition area.


While you could use this chip it is only a 7 bit conversion and if all you are going to do with it is to use it as a potential divider with a fixed input voltage I would have though you would be better off using a real D/A converter.


Mar 30, 2010, 02:44 pm Last Edit: Mar 30, 2010, 03:04 pm by KenH Reason: 1
MCP41x1 series is available in 7 bit OR 8 bit give 257 steps - the 7 bit is around 81 cents while the 8 bit is more expensive..... at 98 cents.  I can deal with 98 cents.

[edit]I just checked DigiKey and the dual channel 8 bit version is only $1.02 each ;)[/edit]

I'm thinking this might be a way to vary the gain of an OpAmp chip to automatic range change?  Not sure if that will work, but it's something I've on the back burner to play with.

Thanks for bringing this series of chips to my attention.

Ken H>



If you are not familar with this technology I wouldn't start with writing my on library. I suggest that you use an existing code. As soon as your protoype works you can think about changing the integrated circuit (IC).

Can you post us the schematic how you want to change the output voltage?

Years ago I implement a power supply project like this. But I did not use any special chips for this project. With operation amplifier, power transistor  and D/A converter you can do this also.

If you really want to use this digital potentiometer I suggest to use the AD5206 with the sample code.


I was simply trying to avoid paying so much for something I don't need :P.

My method may be round-and-about, but I was planning on using the LM317 with a fixed resistor and this digital potentiometer to vary the voltage through the adjust pin.  A microcontroller would sample the output voltage, and adjust according to user input.

I thought this would be better than a simple potential divider, because if the voltage changes, the LM317 helps keep the output close.


I "assume" (yea, I know how to break the word down: ass-u-me :) you are wishing to use the digital pot "just because"?  Simple to use a manual pot to adjust the output voltage.  That's what I normally use - a manual pot in a variable voltage supply.  OR are uou wishing a fixed output voltage?

I know TchnclFl has a LOTS more code abililty than I do - so have at it and GOOD LUCK!

Ken H.


I want to use a digital pot for one: because it's new and I've never tried it before, and two: a microcontroller can adjust the pot a lot more accurately than a human can, so it'd be a more steady output.

This would also make it more digital, only using buttons and an LCD display to adjust :).



First off, I think you are selling yourself short; I really think you have the skills to pull this off, and you can read that tech sheet and such - just take your time, and don't get in a rush.

From what I can see on that sheet, it doesn't look too difficult to interface with. I would also bet that the code from the original example could be adapted (just serial comms in probably a slightly different format; I didn't look too closely at it, but it seemed workable).

I think if you take the time to compare things, you can get this to work out. From what I could see, there really didn't seem much to it (famous last words, I know).


The only other thing that concerns me, though, and once again, I didn't look hard into it, is whether the digital pot you are using will have the range needed (or if you can adjust it using a fixed resistor either in parallel or serial with the digital pot) for the LM317, as well as the current handling capability. If you can verify that, then it is simply a matter of hooking up the SPI interface and writing code to control it.

I would certain try to modify or add on to the original library, to expand it for others. If I were taking it on, actually, I would probably want to try to make the library more modular, to allow for the easy addition of future chipsets (at least in the same family). But that is just me. I certainly think you could get this to work with this digital pot.

I also noted that the chip you picked has multiple pots (2); you could use the other for variable current control in the future (not sure how that actually works, though - I've got little experience with power supply design).

If you can make this thing be a variable voltage controlled power supply, from something like 0-15VDC at 2-10 A output - I would love something like that for my bench for cheap (I've been pricing benchtop supplies, and such supplies are anything but inexpensive - not out of my price range, but I would love to find something cheaper).

I will not respond to Arduino help PM's from random forum users; if you have such a question, start a new topic thread.


I have some of the dual 8 bit ones, might fart around with it tonight, so maybe we can bonk heads together


Well, I've been using a 10K pot here for testing purposes, and it seems to give me the full range with the LM317.

As for current, I don't think it will be too high for the chip, but that's something to look into.

As the LM317 only supports up to 1.5A, that will be the max output.  It does, however, support anywhere from 1.25-37 volts, so that's a plus :).


I have some of the dual 8 bit ones, might fart around with it tonight, so maybe we can bonk heads together

These ones:



Those are the ones I'm probably going to get now.  I'd love to know if you can get the code working with them! :)


Mar 30, 2010, 07:32 pm Last Edit: Mar 30, 2010, 07:33 pm by Osgeld Reason: 1
no I have a pair of MCP42100, dual channel 100k spi

should be close enough though


no I have a pair of MCP42100, dual channel 100k spi

Oh ok.

They're essentially the same though, are the not?  Except "yours" is 100k and "mine" is 10k (Also yours looks like it has 256 "taps", and the one I'm looking at has 257).

Go Up