0-10V analog signal using PWM or DAC

Discussion in 'Analog & Mixed-Signal Design' started by electro_fan, Feb 6, 2018.

  1. electro_fan

    Thread Starter New Member

    Feb 6, 2018
    9
    0
    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.
     
  2. MaxHeadRoom

    Expert

    Jul 18, 2013
    18,653
    5,780
    What device is the 0-10v operating?
    Max.
     
  3. electro_fan

    Thread Starter New Member

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

    Active Member

    Aug 17, 2017
    959
    303
    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
     
  5. electro_fan

    Thread Starter New Member

    Feb 6, 2018
    9
    0
    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).
     
  6. Alec_t

    Expert

    Sep 17, 2013
    10,102
    2,458
    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?
     
  7. philba

    Active Member

    Aug 17, 2017
    959
    303
    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.
     
  8. bruce429

    New Member

    Feb 17, 2017
    2
    0
  9. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,031
    2,280
    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: Feb 22, 2018
    absf and Reloadron like this.
  10. BobTPH

    Senior Member

    Jun 5, 2013
    1,861
    486
    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
     
  11. electro_fan

    Thread Starter New Member

    Feb 6, 2018
    9
    0
    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?
     
  12. ebp

    Well-Known Member

    Feb 8, 2018
    2,332
    811
    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.
     
  13. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,031
    2,280
    Post
    Your
    Schematic.

    ak
     
  14. crutschow

    Expert

    Mar 14, 2008
    22,818
    6,759
    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: Mar 13, 2018
  15. AnalogKid

    AAC Fanatic!

    Aug 1, 2013
    8,031
    2,280
    "You area sick and twisted individual. I like that in a person."
    - Hawkeye Pierce
     
  16. Randika Jayasekara

    New Member

    Sep 28, 2018
    3
    1
    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: Sep 28, 2018
  17. LesJones

    Well-Known Member

    Jan 8, 2017
    2,292
    689
    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.
     
  18. BobaMosfet

    AAC Fanatic!

    Jul 1, 2009
    709
    175
    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.
     
  19. shteii01

    AAC Fanatic!

    Feb 19, 2010
    4,667
    745
    Without a model name/number/ebay link I have to assume it is something you cooked up in Photoshop.
     
  20. danadak

    Distinguished Member

    Mar 10, 2018
    3,398
    765
    Designing the filter see attached.

    Regards, Dana.
     
    Randika Jayasekara likes this.
Loading...