0-10V analog signal using PWM or DAC

Thread Starter

electro_fan

Joined Feb 6, 2018
10
Hello,
I am looking for a possible solutions to generate 0-10V driving analog signal using AVR microcontroller.
I found some ideas but i would like to discuss them:
First idea is to use (16bit-timer1)PWM signal + RC filter (to get DC voltage)+OpAmp(Rail to Rail) to amplify DC signal.
Problems:
- I need to generate signal with 0.01V accuracy and I would like to ask is it possible using simple RC filter?
- As amplifier I woulld like to use ST TS912ID amplifier. Is It good choice, or maybe someone could propose something better?

Second idea is to use external 12-bit DAC to generate 0-5V signal, and then amplify It to 0-10V.
- Problems :
- I need to use three chip's so that solution will be more expensive.
- space on the PCB is limited so layout design will be more complicated.

There is 12V source in the system and microcontroller is powered by 5V LDO.

Thank's for every suggestions and answers.
 

Thread Starter

electro_fan

Joined Feb 6, 2018
10
Peristaltic water pump with 0-10V,4-20mA driving input. I have information that there is a driver with 0.01 speed resolution.
 

philba

Joined Aug 17, 2017
959
If you have a 12V power supply, you don't need rail to rail. An LM 358 or similar works fine if your filter has a fairly low cutoff. Using 16 bit PWM (look at the timer1 library) you can easily get the needed resolution. Here's what I've used. PWM freq is 1KHz. 5V input (would need to change R2 and R3 if 3.3V). The pot is to dial in 10V as the top end.
pwm to 10V.png
 

Thread Starter

electro_fan

Joined Feb 6, 2018
10
Are you sure that 12V power supply will be enough to get 10V on the output of LM358 ? I know that is very cheap OpAmp but It's old chip made on bipolar transistors(I am a supporter of MOSFET solutions).
 

Alec_t

Joined Sep 17, 2013
14,332
What motor are you using and does it provide a tacho output? Peristaltic pumps that I'm aware of would have a cyclically varying physical load and hence current, and may not be predictably controlled by simply varying their supply voltage, so why do you feel you need 0.01V resolution?
 

philba

Joined Aug 17, 2017
959
Absolutely. I can get around 10.5 with a 12V supply. Try it out on a breadboard. Nothing wrong with BJTs, they work just fine and cost almost nothing.
Are you sure that 12V power supply will be enough to get 10V on the output of LM358 ? I know that is very cheap OpAmp but It's old chip made on bipolar transistors(I am a supporter of MOSFET solutions).
 

AnalogKid

Joined Aug 1, 2013
11,055
High precision signal conversion is difficult and expensive.

0.01 V accuracy over 10 V is 1 part per thousand, or 0.1%, or 10-bit resolution. To achieve that as your total system accuracy you will need a 12- or 16-bit DAC with exceptional differential non-linearity, a reference voltage accurate to at least 0.025%, and an amplifier with very low input bias current and input offset voltage errors. You don't have to worry about it being expensive, because it will be *very* expensive compared to parts like the LM358. Advance warning - the reference is the thing that will bite you.

In very round numbers, each system element adds at least 1 bit of uncertainty to the output. You need a 10-bit accurate result, plus at least +/- 1 bit of error for the DAC, another bit for the reference, another bit for the opamp, and another bit for the opamp gain-set resistors (assuming you can afford 0.05% tolerance parts). It is possible to get a 10 bit accurate result with all 12-bit parts, but not without calibration adjustments (a whole different problem) and over only a relatively narrow operating temperature range.

I did a tech refresh on an 8-bit system using all 12-bit parts, and *still* needed one calibration adjustment. Because voltage reference errors show up at the output as gain errors, I used part of the system controller to generate a test output code for 10.000 V and used the single opamp gain adjustment to tweak out both the gain and reference errors with a 6-digit voltmeter. To make this work, the temperature coefficients of the fixed and variable resistors were tightly matched.

Now, about the 0.01 V requirement. Is that +/-0.01 V, or +/-0.005 V?

ak
 
Last edited:

BobTPH

Joined Jun 5, 2013
9,000
The other consideration is how fast it needs to respond to changes. An RC filter will have a time constant that, if set to high, will not respond fast enough and if set too low will have lots of ripple.

Bob
 

Thread Starter

electro_fan

Joined Feb 6, 2018
10
Hello again! Thank's for all ideas and all tips. I've decided to use ST TS912ID Rail-to-Rail amplifier. At a glance everything looked fine but now I have some problems. I'm using 10-bit resolution with phase correction PWM, so I have 1024 PWM levels. When PWM signal is OFF, at the output of Op-Amp there is about 40mV offset ;/ I was trying short non-inverting input to GND, but that doesn't work. Now I know that RR Opamp coudn't give 0V at output with asymmetric power supply. So now I am looking for solution how to cut off the output. Schematics Is the same like in @philba post. Any suggestions?
 

ebp

Joined Feb 8, 2018
2,332
It is a power waster and will compromise the ability of the amp to get to the positive rail, but if neither of those is a concern a pull-down resistor on the output can help. Gain setting resistors can double as pull-downs for non-inverting amps.
 

crutschow

Joined Mar 14, 2008
34,464
Here's an off-the-wall suggestion to pull the output to near zero volts.
I remember reading way-back-when (I think in the old GE Transistor Manual), that BJT's have a very low saturation offset when operated in the inverse mode (collector and emitter interchanged) although the gain is very low.
So try an inverted current mirror with the op amp output connected to the mirror as below.
The current mirror Q1 acts as a saturated transistor with a low impedance to pull the op amp output low but will only draw a maximum current, when the op amp output goes high, about equal to the current through R1.

You adjust the value of R1 to give the output lowest offset. Start with a few kΩ and work up.

Note that the reverse Vbe of the 2N3904 is 6V so the amp amp power supply should be no higher than that.
If it is, then you could try the current mirror in the normal configuration.

upload_2018-3-12_22-51-10.png
 
Last edited:
You can use this kind of module
which is include 12v power boost and I2C 12bit DAC with combing rail to rail op-amp to provide 0-10v

DAC-Pinout-1.jpg
 
Last edited by a moderator:

LesJones

Joined Jan 8, 2017
4,191
0.01 speed resolution is 1 part in 100 so you should only need the voltage to have the same resoulution which is 10/100 = 0.1 volt resolution. (Not 0.01 volt resolution.)

Les.
 

BobaMosfet

Joined Jul 1, 2009
2,113
Are you sure that 12V power supply will be enough to get 10V on the output of LM358 ? I know that is very cheap OpAmp but It's old chip made on bipolar transistors(I am a supporter of MOSFET solutions).
FETs are fine, but are not the end-all-be-all. I prefer to use the appropriate part, whether BJT or FET based on requirements, not just because I like one over the other. Many FETS for example require at least +/-10V on the gate before they completely turn 'ON/OFF'. Something not well known by most people in electronics.
 
Top