Getting 0V from a DAC/opamp - Page 1
Forum section: electronics / beginners

author: FrankT
author_rank: Regular Contributor
timestamp: May 19, 2014, 06:57:39 am
content: 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?

author: Dago
author_rank: Frequent Contributor
timestamp: May 19, 2014, 07:58:33 am
content: 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 examplehttp://www.analog.com/en/precision-op-amps/precision-rail-to-rail-amplifiers/ada4528-1/products/product.html).

author: Rerouter
author_rank: Super Contributor
timestamp: May 19, 2014, 08:01:02 am
content: try adding a 1K load on the output, most op amps struggle to pull it all the way to ground,

author: Jeroen3
author_rank: Super Contributor
timestamp: May 19, 2014, 01:49:32 pm
content: Can you load the atxmega DAC with a 1 K resistor? They are usually only very little current. Check your datasheets before doing that.

author: han
author_rank: Frequent Contributor
timestamp: May 19, 2014, 02:10:53 pm
content: 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 offset3) use other external DAC / internal PWM DAC + filtering4) Buy cheap load bank and mod it.(use existing proven technique)

author: kizzap
author_rank: Unknown
timestamp: May 19, 2014, 03:02:22 pm
content: Check the datasheet:http://www.atmel.com/images/atmel-8387-8-and16-bit-avr-microcontroller-xmega-a4u_datasheet.pdfSpecifically 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-railORbe given a ±V supply so that the op-amp can set it's output to 0 Volts.-kizzap

author: pipe
author_rank: Contributor
timestamp: May 19, 2014, 06:46:30 pm
content: 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.

author: fcb
author_rank: Super Contributor
timestamp: May 20, 2014, 10:26:37 am
content: 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.

author: FrankT
author_rank: Regular Contributor
timestamp: May 25, 2014, 12:04:03 am
content: 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

author: nuno
author_rank: Frequent Contributor
timestamp: May 25, 2014, 02:20:26 am
content: 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.

author: retrolefty
author_rank: Super Contributor
timestamp: May 25, 2014, 02:25:21 am
content: 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.

author: FrankT
author_rank: Regular Contributor
timestamp: May 25, 2014, 03:47:46 am
content: Quote from: nuno on May 25, 2014, 02:20:26 amIt'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.