Author Topic: Getting 0V from a DAC/opamp  (Read 6778 times)

0 Members and 1 Guest are viewing this topic.

Offline FrankTTopic starter

  • Regular Contributor
  • *
  • Posts: 176
  • Country: au
Getting 0V from a DAC/opamp
« on: May 19, 2014, 06:57:39 am »
I'm building yet another electronic load - something to load test LiPo batteries I use in my little RC helicopters - under heavy load the voltage drops below the helicopter's low voltage cutoff and the helicopter drops from the sky.

I'm using the 12-bit DAC on an ATXMEGA32A4U.  The DAC goes into one leg of the opamp, and the voltage from a 0.02Ohm current sense resistor goes into the other.  The opamp output goes to a FET to control the current.  I borrowed the design from Dave's USB power supply.

My problem is when I set the DAC to 0, I'm getting 22mV out of the pin.  With 0.02 current sense resistor, this tries to run my load at 1.1Amp when off - not good.

From what I've read online, this is an issue with rail-to-rail opamps not really got all the way to the 0v.  Given that I'm using a single supply (USB 5v), it doesn't look like this is a simple fix.

I thought I could...
1) Use an opamp as a differential amplifier, to subtract a small amount from the DAC to get it to 0, or less - but this will require dual supplies.  Or,
2) Add a small offset to the current sense side, using an opamp in a summing configuration - but I've only seen it use to generate a negative sum, which would mean I'd have to invert that with another opamp, and I'd still need dual supplies.

Any ideas?
 

Offline Dago

  • Frequent Contributor
  • **
  • Posts: 659
  • Country: fi
    • Electronics blog about whatever I happen to build!
Re: Getting 0V from a DAC/opamp
« Reply #1 on: May 19, 2014, 07:58:33 am »
There's basically two different "rail-to-rail" issues. Other is if the input goes from "rail-to-rail" and the other is if the output goes from rail-to-rail. Its fairly uncommon for an opamp to be both but they do exist (for example http://www.analog.com/en/precision-op-amps/precision-rail-to-rail-amplifiers/ada4528-1/products/product.html).
Come and check my projects at http://www.dgkelectronics.com ! I also tweet as https://twitter.com/DGKelectronics
 

Offline Rerouter

  • Super Contributor
  • ***
  • Posts: 4694
  • Country: au
  • Question Everything... Except This Statement
Re: Getting 0V from a DAC/opamp
« Reply #2 on: May 19, 2014, 08:01:02 am »
try adding a 1K load on the output, most op amps struggle to pull it all the way to ground,
 

Offline Jeroen3

  • Super Contributor
  • ***
  • Posts: 4078
  • Country: nl
  • Embedded Engineer
    • jeroen3.nl
Re: Getting 0V from a DAC/opamp
« Reply #3 on: May 19, 2014, 01:49:32 pm »
Can you load the atxmega DAC with a 1 K resistor? They are usually only very little current. Check your datasheets before doing that.
 

Offline han

  • Frequent Contributor
  • **
  • Posts: 311
  • Country: 00
Re: Getting 0V from a DAC/opamp
« Reply #4 on: May 19, 2014, 02:10:53 pm »

few option:
1) add offset from the input sense resistor using op amp with adjustable input offset.
2) add DC-DC converter for make dual supply. and add differential amplifier (i.e. AD620) + potentiometer for zeroing offset
3) use other external DAC / internal PWM DAC + filtering
4) Buy cheap load bank and mod it.(use existing proven technique)  ^-^



 

Offline kizzap

  • Supporter
  • ****
  • Posts: 477
  • Country: au
Re: Getting 0V from a DAC/opamp
« Reply #5 on: May 19, 2014, 03:02:22 pm »
Check the datasheet:

http://www.atmel.com/images/atmel-8387-8-and16-bit-avr-microcontroller-xmega-a4u_datasheet.pdf

Specifically page 79:

Linear Output Voltage Range: Min 0.15V out, Max Vcc - 0.15V. The INL and DNL of the DAC aren't that great either. up to ±4 LSB error on the output.

Your DAC cannot output 0 volts, no matter what you do. You will have to redesign the circuit if you desperately need that output to go to 0 Volts. One possible way to get around the issue is by using a differential amplifier at the DAC output, to add a DC offset to the level you are outputting, so that you can null out that 0.15V. You can then use some simple code to figure what you need to add to the DAC value to output the correct voltage.

As others have said, your op-amps could also cause an issue. They either need to be rail-to-rail OR be given a ±V supply so that the op-amp can set it's output to 0 Volts.

-kizzap
<MatCat> The thing with aircraft is murphy loves to hang out with them
<Baljem> hey, you're the one who apparently pronounces FPGA 'fuhpugger'
 

Offline pipe

  • Contributor
  • Posts: 27
  • Country: se
Re: Getting 0V from a DAC/opamp
« Reply #6 on: May 19, 2014, 06:46:30 pm »
I'm probably missing something here, because my answer seem so trivial, but you're unlikely to need the full output range of the DAC. Why not a simple two resistor voltage divider from the DAC to the op-amp? Make it divide by 10 and your upper range goes from 5 or 3.3 V to 500 or 330 mV, and your 22 mV is now magically 2 mV, which should be much easier to handle.

And instead of an op-amp, maybe you should check for dedicated comparators. They handle these cases better, in my (arguably very limited) experience.
 

Offline fcb

  • Super Contributor
  • ***
  • Posts: 2117
  • Country: gb
  • Test instrument designer/G1YWC
    • Electron Plus
Re: Getting 0V from a DAC/opamp
« Reply #7 on: May 20, 2014, 10:26:37 am »
I would use an differential opamp configuration with a rail-rail opamp (MCP6002 perhaps).

So if you generate the DAC ref from say a TL431 (2.5v), then just create a potential divider to feed the -IN input, nice and stable.
https://electron.plus Power Analysers, VI Signature Testers, Voltage References, Picoammeters, Curve Tracers.
 

Offline FrankTTopic starter

  • Regular Contributor
  • *
  • Posts: 176
  • Country: au
Re: Getting 0V from a DAC/opamp
« Reply #8 on: May 25, 2014, 12:04:03 am »
Thanks for the tips. 

For the record, I'm a software guy, so anything analog is hard to me.

When looking for a solution to this problem, the first opamp adding circuit I found was similar to this (http://www.allaboutcircuits.com/vol_3/chpt_8/8.html), where the opamp will sum different voltages, but the result was negative.

A bit more googling and I eventually came across the circuit "Offset Voltage Adjustment for Voltage Followers" on page 6 of (http://www.ti.com/ww/en/bobpease/assets/AN-31.pdf).  So I ended up just adding a small voltage to the current sense circuit to lift its "zero" position. 

I simulated the circuit in ltspice, and the results look non-linear (Vdac is linear with respect to Vsense), but my circuit also sends the original current sense signal to the uC, so I should be able to use that feedback to control the current.

Thanks,
Frank
 

Offline nuno

  • Frequent Contributor
  • **
  • Posts: 606
  • Country: pt
Re: Getting 0V from a DAC/opamp
« Reply #9 on: May 25, 2014, 02:20:26 am »
If the zero is your only problem and is created by the DAC only, another possibility is to just clamp the DAC's output to zero when you want it zero, by reconfiguring it to an output GPIO or using another micro pin to pull it down. You may need to add a series resistor to the DAC output if it can't be clamped to GND.
 

Offline retrolefty

  • Super Contributor
  • ***
  • Posts: 1648
  • Country: us
  • measurement changes behavior
Re: Getting 0V from a DAC/opamp
« Reply #10 on: May 25, 2014, 02:25:21 am »
How about just adding a series diode on the opamp output, it will prevent any output until you reach 0.6 vdc or greater on the opamp output at just the expense of loosing a little output range.

 

Offline FrankTTopic starter

  • Regular Contributor
  • *
  • Posts: 176
  • Country: au
Re: Getting 0V from a DAC/opamp
« Reply #11 on: May 25, 2014, 03:47:46 am »
If the zero is your only problem and is created by the DAC only, another possibility is to just clamp the DAC's output to zero when you want it zero, by reconfiguring it to an output GPIO or using another micro pin to pull it down. You may need to add a series resistor to the DAC output if it can't be clamped to GND.

It's the start value at 0 DAC that is the problem.  The zero dac voltage of 22mV meant 1.1A would be the smallest current I could control.  I'm using a 1v reference on a 12bit dac, which translates to ~0.25mV sense or 12mA load per step.  It is important that I can control currents on some of the small batteries I want to load test.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf