MCP4231 Digital Potentiometer Circuit

@KeithHilton
Measure resistance with no other connections to the potentiometer section/s.

You might have tried to do what I said but you still made a mistake which is why I wanted to see the code so I could see your mistakes and point out where you went wrong, and let you correct them. That is the way you learn.

Remember at school when you spell a word wrong the teacher asks you to write it down then times. That is an attempt to get you to learn spelling. By correcting your own mistakes you stand a chance of learning. By copying and pasting you do not learn anything.

So might that give you a hint as to why the LEDs did not fade in and out at the same times when you gave them the same voltages? Yes they we’re going in different directions but one was the complement of the other.

runaway_pancake and Grumpy_Mike I am going to set the circuit up again, with the LEDs powered by two transistors. Can not believe I did not check the absolute maximum listing of the digital pots that TomGeorge pointed out. I feel very stupid. For one thing, the example looked so professional on the internet. This is a good example to no believe everything you see on the internet.

1 Like

The key is to go to original sources as much as possible. Cut out the middle man.

@KeithHilton - Perhaps you'd like some pre-construction criticism?

Yes runaway_pancake I would love some pre-construction criticism.

Post your schematic.

image.png

There would be two of these circuits, one for each POT in the MCP4231. The wiper of each pot would go to the input of each circuit.
Concerning the 2.5mA maximum of both POTS ---any of the terminals of the POTS can not exceed 2.5mA. Any terminals means any of the 3 terminals of the POTS, not just the wipers.

That particular circuit won't allow the current through the transistor to vary with the 'Input'.

PE --
This will:

Note there is no base resistor, that is correct, and the voltage at the emitter will be 0.7V lower than that on the base. But as the base voltage changes so will the voltage across the LED and resistor.

Which dictates a control voltage between the sum of the transistor EB junction and the LED forward voltage drops, and 5V.

Not a very well behaved circuit. It will be interesting to see how you intend to bias the digital potentiometer to cover that range.

Same thing for the common emitter version, but with different problems.

If you think you will get a 0-max output from the LED from a 0-max setting of the digipot, you are in for some big surprises.

runaway_pancake I like your circuit, I knew the 100K resistor would have to be changed.
Yes, Grumpy_Mike the .7V transistor junction will cause issues.
I am going have to agree with aarg concerning the 0-max of the pot and LED, because of the .7V voltage drop. aarg I had not planned on any fancy bias of the digital pot, just hook the A terminal to +5 volts, and the B terminal to ground, and the wiper to the base of the transistor ---in the circuit runaway_pancake suggested. Maybe the transistor could have a different bias which would come closer to the 0-max pot range?

What is max resistance of this device?
If you place a resistor of that value between it and Ground then the Wiper voltage at digipot Min will be 2.5V (assuming 5V supply) and emitter follower output will be 1.8V or so at digipot Min.

The MCP4231 IC I have have two 100K pots. I agree-- If I put a 100K resistor between the pot's ground terminal and ground, the wiper output would be 2.5 volts when the wiper is a minimum. That is if the pot is powered with +5 volts DC. So to get the 1.8 volts you are subtracting .7 volts from the 2.5 volts. That would not shut the LED off but would make it a lot dimmer. Is that what you are getting at runaway_pancake?

One way of removing it is to use an operational amplifier instead of a transistor. You wire it as a voltage follower, that is the wiper to the + input and the - input connected to the output. You need to use a rail to rail op amp to maximise the voltage range. Also op amps do not provide much output current (see the data sheet of the one you choose) but they can be in the region of 50 - 100 mA.

The different LED colours, and hence the cut off point voltage was always a problem with the concept of controlling the brightness of an LED by controlling the voltage to it, and hence the use of a digital pot to dim an LED is not the brightest of concepts. Which is why PWM is nearly always used to control the brightness od an LED.

As a total fudge you could arrange each different op amp to provide a suitable DC offset on the two colours to "match them up" so they drop below the LED's turn on voltage for the same wiper voltage. But why bother?

PE -
But, anyway, 100K+ (or 200K) source impedance is too much for this simple emitter follower (it needs something in the "low Z_out" realm). It's not an op-amp.
Best of luck.

Yes Grumpy_Mike, I agree a Op Amp could be used. I also agree that PMW would be much better for controlling a LED.
runaway_pancake I have not tried your resistor-circuit. Had the back of my head cut today to get rid of skin cancer place. For that reason I have not done any circuits today.
You asked what the objective was--the last word. The objective is to learn how to control digital pots with Arduino. A worthy objective since a pot--voltage divider-- is a basic component in electronics. Yes, I know there are much better ways to fade a LED.
No you did not dump me. Yes you threw me a lifeline. No I am not looking a gift horse in the mouth---but I do appreciate your help. Probably the biggest help was when the person pointed out the current limitations of the POT being 2.5mA.
There have been ways presented on how to boost the wiper's output and stay within the 2.5mA current range. I appreciate everyone's help!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.