OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

0-10v Analog Output (Not PWM)

Mon Sep 12, 2016 3:25 am

Hi,

After much research I have tried to output 0-10v, but can only get from 2.4-10v with my current setup. Well I can actually go over 11v, but I only need 10v max.

I am using the MCP4725 DAC with a range of 1.1mv-4.24v output. I am also using a TL071CP op-amp with resistors 33k and 68k. I tried with higher and lower resistors and have received similar or worse results. My current power supply is a 12v AC/DC wall mount adapter, but I plan to run the setup from a 12v battery after testing. The sketch attached is my current hookup.

Does anyone know why I might not be getting 0-10v or 1.1mv-10v? Should I use a different op-amp and if so which?

Thanks,
OnCake
Attachments
0to10v.png
0to10v.png (13.67 KiB) Viewed 21668 times

pcmanbob
Posts: 13563
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: 0-10v Analog Output (Not PWM)

Mon Sep 12, 2016 12:34 pm

Hi.

Did you try googling your problem ?
I got this on my first try.
http://forum.allaboutcircuits.com/threa ... al.102643/
We want information… information… information........................no information no help
The use of crystal balls & mind reading are not supported

User avatar
brekee12
Posts: 335
Joined: Wed Feb 03, 2016 3:36 pm
Location: HU

Re: 0-10v Analog Output (Not PWM)

Mon Sep 12, 2016 1:39 pm

TL071 needs negative pover supply. If you want 0 to 10 output you need to use CMOS OPAMP with rail to rail input and output.
Brekee12
on a Raspberry B+ with whezzy, two Zero with Jessie Light

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: 0-10v Analog Output (Not PWM)

Mon Sep 12, 2016 4:49 pm

OnCake wrote:After much research I have tried to output 0-10v, but can only get from 2.4-10v with my current setup. Well I can actually go over 11v, but I only need 10v max.

Does anyone know why I might not be getting 0-10v or 1.1mv-10v? Should I use a different op-amp and if so which?
Quoting from this TI bulletin:

http://www.ti.com/lit/an/sboa059/sboa059.pdf
The circuit shown is connected as a voltage follower, so the
output voltage is equal to the input voltage. Of course, there
are limits to the ability of the output to follow the input. As
the input voltage swings positively, the output at some point
near the positive power supply will be unable to follow the
input. Similarly the negative output swing will be limited to
somewhere close to –VS. A typical op amp might allow
output to swing within 2V of the power supply, making
it possible to output –13V to +13V with ± 15V supplies.
Figure 1b shows the same unity-gain follower operated from
a single 30V power supply. The op amp still has a total of
30V across the power supply terminals, but in this case it
comes from a single positive supply. Operation is otherwise
unchanged. The output is capable of following the input as
long as the input comes no closer than 2V from either supply
terminal of the op amp. The usable range of the circuit
shown would be from +2V to +28V.
Any op amp would be capable of this type of single-supply
operation (with somewhat different swing limits). Why then
are some op amps specifically touted for single supply
applications?
Sometimes, the limit on output swing near ground (the
“negative” power supply to the op amp) poses a significant
limitation. Figure 1b shows an application where the input
signal is referenced to ground. In this case, input signals of
less than 2V will not be accurately handled by the op amp.
A “single-supply op amp” would handle this particular
application more successfully.

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Mon Sep 12, 2016 10:36 pm

What is wrong with the PWM ?
viewtopic.php?p=819028#p819028

OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 3:22 am

Hi All,

Sorry, I should have premised my post with the fact that I am a novice at working with circuits. My degree is in Computer Science, but I remember working with circuits in Physics. For these reasons, I did not fully understand some of the help from other forums or some of the features/parameters of the op-amp.

Hi pcmanbob,

Yes I did google search. I found that same thread of the link you posted, but I did not use the thread because I thought they were creating an ADC (Analog to Digital Converter) and it appeared they were having issues with their op-amp. For these reasons, I thought that this application would not work with mine. After re-reading the forum I think some of the material will be helpful.

Hi brekee12,

I thought the TL071CP was rail-to-rail since it shows (In to V+) on this page: http://www.ti.com/product/TL071 , but I now believe this may be referencing input only. I am now searching for a better op-amp that can get closer to ground at 0v. Do you have experience with any good ones? My specific application requires 12v battery for supply and MCP4725 which sends the 1.1mv - 4.24v analog signal. Or should I go with the OPA171 and MCP4921 mentioned in the forum link by pcmanbob?

Hi stderr,

Thank you, I believe this confirms the forum pcmanbob linked to and brekee12's reply. Also, that article mentions the op-amp models "OPAxyz", so, per the question above is OPA171 the best suited for my application?

Hi Dan,

I asked if the electronic regulator could accept PWM and the manufacture said no. At the time I saw that other forum, I thought PWM would possibly cause more issues to build due to the need for a filter to make it analog. Also, I may have a huge misunderstanding on this, but would not PWM possibly cause signal interference in nearby electronics?

Best,
OnCake

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 3:27 am

but would not PWM possibly cause signal interference in nearby electronics?
If you look at the diagram you will see that the 1µF capacitor will filter out the A/C part of the PWM and let only the DC which is the timeON/totalPWMTime * 10V.


B.T.W. The LM324 is a rail amplifier which will give you the 0V you need with an D/A converter.

OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 3:52 am

Hi Dan,

Thank you for the quick reply.

So I was reading this: viewtopic.php?f=37&t=98000 and it shows you used a LM358. Is LM324 better than the LM358?

Also, the previous replies recommend a CMOS, would the OPA171 work better than the LM324?

Best,
OnCake

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 3:57 am

I didn't have a LM324 on hand so the LM358 works!

OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 4:33 am

Hi Dan,

I will test the LM324 out today. I may look into other op-amps as well for an even better operating temp. If the circuit does not work I will go for the PWM. Also, when it comes to the 1.1mv out of the MCP4725, will that show an output of 0v from the op-amp? I noticed that you put a 1k resistor somewhere in the other forum thread, but I didn't see it in the image (Is it 1k or 10k): viewtopic.php?p=819028#p819028

Best,
OnCake

User avatar
brekee12
Posts: 335
Joined: Wed Feb 03, 2016 3:36 pm
Location: HU

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 6:30 am

If you have available OPA171 use that , but there maybe better choice of OPA743 family (if available for you) which available in PDIP and SO-8, one two four unit per package for multi channnel general purposes applications. Good quality opamp and its output will go 0 to 10 V, and the input can be driven with mVs.
In case it is not available, dont worry. Try to find from your supplier selection a similar one. What you should check: power supply is at least 12V or higher which fits to your power supply, rail-to-rail input and output, package handable by you (PDIP, SO, SOIC,..).
In your application I can not see any other limitation.
Brekee12
on a Raspberry B+ with whezzy, two Zero with Jessie Light

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 11:18 am

I noticed that you put a 1k resistor somewhere in the other forum thread, but I didn't see it in the image (Is it 1k or 10k): view ... 28#p819028
D2A10V.jpg
PWM D/A 0..10V
D2A10V.jpg (18.33 KiB) Viewed 21116 times
R5 Is to be sure that the output stay at zero Volt if the GPIO is disconnected.
R1,C1 is your RC filter (removing the PWM cycle).
R2,R3 is amplifier gain (R3/R2)+1 = gain of 3 0..3.3V => 0 .. 10V
R4 complement the RC filter to be what we call a Pi filter and it is also an input resistor match impedance for the amplifier. The positive input of the amplifier is 100K in parallel with 200K so it is ~66K

OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

Re: 0-10v Analog Output (Not PWM)

Wed Sep 14, 2016 5:12 pm

Hi Dan,

I think you might have convinced me to use PWM, but my plan is to try both to see if one has better results since I already have most of the stuff for the DAC/analog version. Hopefully I can post a schematic of a working version for others to use if they want to go down that the DAC/Analog path.

Instead of tieing up the RPi GPIO PWM pin, I would like to use i2c to control another board. Although my application is not for a servo, would this: https://www.adafruit.com/products/2327 give the same PWM results for your design? I was a little confused around the Hz output from the RPi GPIO PWM pin compared to the Hz output ability from the HAT.

Thank you for your help!

Hi All,

I have a slightly fluctuating input voltage from 10v-16v DC (12v nominal). If I were to use this buck booster: https://amzn.com/B00JJHPF0A would I get a non-fluctuating exact 12v DC? or would you recommend anything else? or even a DIY option? The reason for this is to have a more precise 12v input to the LM324 op-amp.

Best,
OnCake

OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

Re: 0-10v Analog Output (Not PWM)

Fri Sep 16, 2016 4:27 pm

Hi All,

Hopefully I haven't used up my question allotment. :) Does anyone know the answer to the above questions?

Best,
OnCake

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Fri Sep 16, 2016 4:57 pm

The 12V is the minimum voltage to get 10V minimum output on the LM324.

The spec said that it needs at least v+ to be 1.5V higher the the output.


Then if your power supply is above 12V and less than 32V for the lm324 you are ok. It doesn't need to be stable but higher than 11.5V.

OnCake
Posts: 7
Joined: Tue Sep 06, 2016 4:40 am

Re: 0-10v Analog Output (Not PWM)

Wed Sep 21, 2016 8:04 am

Hi Dan,

I tested the setup with the LM324N, but I am only able to get from 17.4mV to 9.65V. My V+ is 12.12V. Everything else is set as the image you posted above. I believe I will be ok wit the 17.4mV, but I was wondering how I could get the high number to 9.65V?

Best,
OnCake

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Wed Sep 21, 2016 12:41 pm

The resistor precision and the voltage at the GPIO will influence the output voltage.

Try to add a 12K resistor in series with R3(200k). This way you will boost the gain or replace R3 by 220K.

Mr.Allen
Posts: 2
Joined: Thu Sep 22, 2016 10:27 am

Re: 0-10v Analog Output (Not PWM)

Thu Sep 22, 2016 12:22 pm

I don't mean to hijack this thread but I just have a small inquiry regarding this circuit, as I am not much inclined in terms of electronic stuff.

First of all, I did the schematic as provided by danjperron (thanks bud...) a couple of weeks ago and it's working ok. But instead of using the LM324N, I've used the LM358 and I encounter no problems whatsoever. The only thing that I noticed was that the output voltage is somewhat erratic/fluctuates. In relation to this, I came across a site where its circuit uses a 100nF cap in between the pins 1 and 2 of the LM324N.

My question is, will the cap "smooth out" the output voltage thus preventing sudden change? Again thank you all and much appreciated...

Link to the other circuit:
http://www.hoelscher-hi.de/hendrik/engl ... htm#Filter

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Thu Sep 22, 2016 6:04 pm

Don't forget that the 3.3V from the Rasberry Pi is not very stable.


Possible solution,

1 - Use a zener diode to reduce voltage fluctuation at the output of the gpio. 1K resistor to limit the current and the zener ( around 3V). Four 1n4148 diodes in series will do. you will need to adjust the gain.

2- Yes the capacitor between pin 2 and 3 will remove glitch but I will put anothe capacitor as integrator instead. An integrator will smooth the signal even more. A small ceramic capacitor ~0.1uF in parallel with R3 will be more effective.

Mr.Allen
Posts: 2
Joined: Thu Sep 22, 2016 10:27 am

Re: 0-10v Analog Output (Not PWM)

Thu Sep 22, 2016 6:48 pm

Thanks danjperron for the reply...

I just want to make some clarifications as to what you've mentioned in solution #2. Do you mean like this?
D2A10V - with 0.1uF.jpg
D2A10V - with 0.1uF.jpg (38.4 KiB) Viewed 20524 times
Also, I've contacted a local electronics store here and they said they have that cap in ceramic or mylar. Does it matter which I choose? Is one better than the other?

Terdy56
Posts: 7
Joined: Mon Apr 30, 2018 7:41 am

Re: 0-10v Analog Output (Not PWM)

Mon Apr 30, 2018 7:50 am

Going through so many old forum regarding 0-10V DAC if I wanted to use more than one output what will be the best way ? as I have already google out many device but still confuse regarding what device are cost effective and power efficient to use with raspberry pi ?

danjperron
Posts: 4383
Joined: Thu Dec 27, 2012 4:05 am
Location: Québec, Canada

Re: 0-10v Analog Output (Not PWM)

Mon Apr 30, 2018 12:24 pm

Going through so many old forum regarding 0-10V DAC if I wanted to use more than one output what will be the best way ? as I have already google out many device but still confuse regarding what device are cost effective and power efficient to use with raspberry pi ?
Be carefull about ground loop. Does all the device are on the same common ground.

If yes you have multiple GPIOs on the Pi then you just duplicate the drawing and use a different GPIO.


In my opinion it will be safe to isolate each output using optical swicth and isolated DC/DC converter but this is more expensive.

asandford
Posts: 1998
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: 0-10v Analog Output (Not PWM)

Mon Apr 30, 2018 9:45 pm

Terdy56 wrote:
Mon Apr 30, 2018 7:50 am
Going through so many old forum regarding 0-10V DAC if I wanted to use more than one output what will be the best way ? as I have already google out many device but still confuse regarding what device are cost effective and power efficient to use with raspberry pi ?
Rather than necro'ing an 18 month old post, you should start a new one.

Return to “Automation, sensing and robotics”