Arduino Forum

Using Arduino => General Electronics => Topic started by: borillion on Jan 17, 2013, 12:12 pm

Title: Digital potentiometer with op amp
Post by: borillion on Jan 17, 2013, 12:12 pm
(http://i224.photobucket.com/albums/dd201/etechsv/Ideanote_20130116_015821_01_zps3b91cdf2.jpg)

Hi I'm to take a 5V 500mA power supply and pass it  through a digital potentiometer AD5235 and then step it up through an op-amp with a gain 2 to get up to 10V output and put that into voltage based meanwell dimmer controller.

I'm a little confused on how to handle grounding with this. They are circled blue. Can I "ground" the -5V from the pot, and the -10V from the dimmer and the opamp together without damaging the pot by connecting them on the power supply -5V terminal of the wall wart l'll be using?

Also I have a couple questions about the pin meanings:
WP - Optional Write Protect. When active low, WP prevents any changes to the present contents
PR - Optional Hardware Override Preset. Refreshes the scratchpad register with current contents of the EEMEM register.  PR is activated at the logic high transition.
RDY - Ready. Active high open-drain output

what is active low vs just low, why the verb active?
what do Logic high transitions and active high open-drain output mean exactly?  :smiley-red:

Thanks you for your help!
Title: Re: Digital potentiometer with op amp
Post by: dc42 on Jan 17, 2013, 01:43 pm
If you are driving that from an Arduino, then there is a much simpler solution. Take a PWM output pin, pass the output through an R-C filter, then use exactly the same op amp configuration to double the output from 0->5V to 0->10V.

To answer some of your questions: "active high" means the signal does what it is supposed to so when it is HIGH (i.e. voltage neat +5V or whatever Vcc is), and doesn't when it it LOW (near 0V). Active low is the reverse. So "RDY - Ready. Active high open-drain output" means that the output is HIGH when the device is ready.

"Open drain" means that the output pulls the output low, but not high. So you need a pullup resistor to Vcc to actually get a high on the pin.

"Refreshes the scratchpad register with current contents of the EEMEM register.  PR is activated at the logic high transition." means that when this input changes from LOW to HIGH, it refreshes the scratchpad register.
Title: Re: Digital potentiometer with op amp
Post by: SirNickity on Jan 17, 2013, 09:07 pm
Quote
WP - Optional Write Protect. When active low, WP prevents any changes to the present contents


That is simply bad wording in my opinion.  As already stated, the phrase "active low" means that the pin does whatever (i.e., it's active) when the input is low.  So there's no state called "active low."  There are only high and low states, and the pin's function is either activated by being high or low.  To put it one more way:  It can't be active low, it can only be activated when low.
Title: Re: Digital potentiometer with op amp
Post by: borillion on Jan 17, 2013, 09:27 pm
That's what I figured it activates a function being high or low but wasnt sure.

As for the rc filter would it look something like this? Course I would be replacing Vs here with the pwm signal source and connect the end grounds to the -5V line on the wall wart Ill be using for power? Can I leave out the resistor and cap I don't understand why would need a filter?

Sorry if I'm being stupid but this is the first time I've dealt with pwm and not put it directly to and led or servo.

(http://www.ecircuitcenter.com/Circuits/opfil1/opfil1_1.gif)
Title: Re: Digital potentiometer with op amp
Post by: majenko on Jan 17, 2013, 10:38 pm
Just a note on your terminology...


A 5V wall wart doesn't have a -5V line.

You have a +(whatever)V connection, and a GND connection.  The same goes for the Arduino, the op-amp power supply, etc.  You have + and GND, not + and -.

For a 5V supply you have +5V and GND.  For a 10V supply, it is +10V and GND.

If you had +5V and -5V, then the difference between them would be 10V!  (ouch).

Also, I assume you have a 10V power supply to run the op-amp from?  You do realise that you can't power the op-amp from 5V and expect a gain of 2 to give you 10V out of it...?
Title: Re: Digital potentiometer with op amp
Post by: dc42 on Jan 18, 2013, 12:07 am

As for the rc filter would it look something like this? Course I would be replacing Vs here with the pwm signal source and connect the end grounds to the -5V line on the wall wart Ill be using for power? Can I leave out the resistor and cap I don't understand why would need a filter?


Yes, it would look like that. You need an op amp whose input common mode voltage goes down to ground, and whose output goes close enough to ground as well. Best is a rail-to-rail op amp, but 1/2 a LM358 or 1/4 a LM324 will do if you use a 12v supply. Making Ra and Rb quite low (say 1K each) will help ensure that the output goess close enough to zero.

The RC network is needed because the dimmer expects a voltage between 0V and 10V, not a 10V PWM digital signal. Values of e.g. 10K and 22uF should be OK using the Arduino default PWM frequency.
Title: Re: Digital potentiometer with op amp
Post by: retrolefty on Jan 18, 2013, 01:48 am

Just a note on your terminology...


A 5V wall wart doesn't have a -5V line.

You have a +(whatever)V connection, and a GND connection.  The same goes for the Arduino, the op-amp power supply, etc.  You have + and GND, not + and -.

For a 5V supply you have +5V and GND.  For a 10V supply, it is +10V and GND.

If you had +5V and -5V, then the difference between them would be 10V!  (ouch).

Also, I assume you have a 10V power supply to run the op-amp from?  You do realise that you can't power the op-amp from 5V and expect a gain of 2 to give you 10V out of it...?


I don't know if there is any really accurate terminology one can use with DC wall warts that doesn't either make assumptions or needs context to be understood correctly.

 Certainly a 'wall wart' type DC voltage source has both a positive and negative terminal (just like a battery) usually terminated into a coaxial DC connector, but no standard as to if center pin is positive or outer shell is positive, they come in both flavours. And one is free to connect either the negative terminal to one's circuit common and that results is a positive 5vdc available to power the circuitry, but of course there is nothing wrong with connecting the positive terminal to one's circuit common when they do require a -5vdc voltage source as for perhaps a op-amp's negative rail. But it's certainly true that a 5 volt wall wart doesn't have both a +5vdc terminal and a -5vdc terminal, at least not at the same time.  ;)

And the term 'ground' is such an overloaded term that can have several meanings and is a major pain in the butt to determine what one really means without the specific context being explained. I prefer the term circuit common or just common, over the term ground. And calling it GND is no help as that is almost impossible to pronounce. But then again I'm a crusty old hardware type that has his idiosyncrasies.  ;)

Lefty
Title: Re: Digital potentiometer with op amp
Post by: SirNickity on Jan 18, 2013, 02:30 am
Sure a wall-wart can have both positive and negative pins!  XD  I have one originally terminated on mini-DIN with +12, -12, +5, and gro--- uh, common.  ;-)

Granted, that's not what one typically imagines when thinking "wall wart", although I think discarding preconceptions when dealing with 'warts is probably not a bad thing.  After all, is it center-positive?  Center-negative?  Regulated?  50% voltage rise under no load?  AC??

Plugging in some random black box and expecting 5.0vDC on the center pin of a barrel connector is a good way to produce magic smoke.
Title: Re: Digital potentiometer with op amp
Post by: borillion on Jan 18, 2013, 05:56 am
Thanks Guys, I got this down and understand it now!

Ill use the circuit here

(http://i.stack.imgur.com/MOJkJ.jpg)
Title: Re: Digital potentiometer with op amp
Post by: retrolefty on Jan 18, 2013, 06:01 am

Thanks Guys, I got this down and understand it now!

Ill use the circuit here

(http://i.stack.imgur.com/MOJkJ.jpg)


Nice drawing. You missing a series resistor wired between the PWM input and the cap and + op-amp input to form a proper low pass filter. 10K ohms should work.

Lefty
Title: Re: Digital potentiometer with op amp
Post by: Maciej on Jan 23, 2015, 11:08 pm
I'm using the below circuit to regulate a 220V dimmer (Eltaco SUD12). It's working fine. However, the output is not 0-10V but 0-9.4V.  Does anybody have an idea how to change the circuit to deliver exactly 10V as maximum output?
Title: Re: Digital potentiometer with op amp
Post by: Grumpy_Mike on Jan 23, 2015, 11:30 pm
Quote
It's working fine. However, the output is not 0-10V but 0-9.4V.  Does anybody have an idea how to change the circuit to deliver exactly 10V as maximum output?
What is the op amp supply voltage?

You can increase this or get a better Op amp, one with rail to rail outputs.
Title: Re: Digital potentiometer with op amp
Post by: polymorph on Jan 24, 2015, 04:41 am
The LM324 output can go no higher than 1.5V below the supply voltage.

Also, your two 22k resistors may be outside their range in just the right direction to get you a gain of less than 2.

Another also, the 5V in your Arduino might be a little low.

Yet another also, the output of an Arduino may not go quite to 5V with any load on it.

Simplest way to fix it? Put a 1k trimmer potentiometer between the two 22k resistors, and connect the wiper arm to the inverting input of the Op Amp.

BTW, an LM324 has four sections. You -must- connect the unused sections or they may, can, and will cause problems. Best way to connect unused sections is to connect them as noninverting buffers, ie, inverting input connected to the output, then tie the noninverting inputs to ground through a 1k resistor.
Title: Re: Digital potentiometer with op amp
Post by: MarkT on Jan 24, 2015, 12:52 pm
In general if you are not using a digital pot to handle an analog signal originating off-board,
you don't need the digital pot, a DAC is the simplest approach.  DACs are much more
numerous and easy to source too.
Title: Re: Digital potentiometer with op amp
Post by: ArtemKuskov on Mar 07, 2016, 07:18 am
I know this topic was published a while ago, but I have a question. I am fairly new to digital electronics applications and I ran into some problems for power supplies in Op-Amps. For this very operational amplifier LM 324N I am supplying 15 Volts 300 mA to pins 4 and 11 respectively. when I do that the IC is getting heated up ALOT! I have tried to create a simple voltage divider to supply 12 volts or so, but in that case the IC is not even on. How can I overcome this issue? And also polymorph mentioned that all not connected pins have to be connected, I am curious why this is.

Thank you.
Title: Re: Digital potentiometer with op amp
Post by: Paul__B on Mar 07, 2016, 07:54 am
Since the LM324 is rated for up to 32 V supply, the only way you can overheat it is to connect the supply backwards, or connect it to the wrong pins.  Pin 4 is positive, pin 11 ground.
Title: Re: Digital potentiometer with op amp
Post by: polymorph on Mar 08, 2016, 08:10 pm
And also polymorph mentioned that all not connected pins have to be connected, I am curious why this is.

Thank you.
Because with any Op Amp sections not connected, you now have a very high gain amplifier with inputs and outputs floating around, randomly coupled to other parts of the circuit by parasitic capacitance.

They can burst into oscillation, causing... wait for it... high power consumption and heat!

Do NOT just ground them. More like this:
(https://www.maximintegrated.com/en/images/appnotes/1957/1957Fig01.gif)

More information in the link:
https://www.maximintegrated.com/en/app-notes/index.mvp/id/1957 (https://www.maximintegrated.com/en/app-notes/index.mvp/id/1957)
Title: Re: Digital potentiometer with op amp
Post by: pwillard on Mar 08, 2016, 08:38 pm
Because the chip is madly trying to reconcile the electric field noise picked up at the two input pins with infinite gain... it's going hog wild trying to do it's job and only succeeding in getting very hot.  At the very least... hook it up like a voltage follower... a no parts, but no real benefit solution.

Voltage Follower (http://www.learningaboutelectronics.com/Articles/Voltage-follower)
Title: Re: Digital potentiometer with op amp
Post by: KeithRB on Mar 08, 2016, 09:04 pm
Pin 11 needs to go to ground, not 15 V. You probably killed the chip.
Title: Re: Digital potentiometer with op amp
Post by: MarkT on Mar 08, 2016, 10:14 pm
If an opamp gets hot (and you're not running it at 36V), its probably damaged.  They normally take
a few milliamps from the supply.  They normally can only drive a few milliamps of output too, note.
Title: Re: Digital potentiometer with op amp
Post by: Nibs91 on Jan 30, 2017, 08:54 pm
I'm using the below circuit to regulate a 220V dimmer (Eltaco SUD12). It's working fine. However, the output is not 0-10V but 0-9.4V.  Does anybody have an idea how to change the circuit to deliver exactly 10V as maximum output?
Sorry to bring up an old thread but im using the exact same circuit as you have in your picture but i'm only getting 1.5V on the output when i should be seeing 10V (5v has been applied to the input).

Has this happened to you before?
Title: Re: Digital potentiometer with op amp
Post by: MarkT on Jan 31, 2017, 12:37 am
Quote
For this very operational amplifier LM 324N I am supplying 15 Volts 300 mA to pins 4 and 11 respectively. when I do that the IC is getting heated up ALOT!
That makes no sense.  Did you mean GND-> pin 11, 15V -> pin 4?? Did you measure the actual current? It
should be a mA or two.

The fact it got hot means something is very wrong.  Perhaps you connected it wrongly and fried it - at 15V
you don't get a second chance, transistor circuitry will usually blow instantly if misconnected.