The DS2740 High-Precision Coulomb Counter that doesn’t seem to be - Page 1
Forum section: electronics / projects

author: Mr.B
author_rank: Unknown
timestamp: February 06, 2017, 03:06:15 am
content: Good day all,tl;drMy latest project uses a DS2740. It does not appear to be as accurate as the datasheet claims.At ~10mA it appears to be accurate, but goes bad at higher current to reading ~489mA when the actual is 400mA.The error is non-linear and cannot be adjusted in software due to the fact that the error will also be accumulated by the device.The full story:For years I have been designing and building small WiFi enabled temperature transmitters.Calculating battery life expectancy has always been a challenge as the user has control over the sleep duration and logging frequency.My first prototype, many years ago, actually spent a whole year in a freezer, logging every 10 minutes and transmitting the data to a server every 30 minutes. That particular design used a Roving Networks RN-171 radio. The battery was a 5000mAHr LiPo.My latest design will use the ESP8266 in an attempt to reduce the cost of the BOM and for my own personal interest to see if the ESP8266 is a serious contender for use in an industrial environment.Before the design and build of the ESP8266 enabled device I decided I would build an important piece of test equipment – a coulomb counter.This way I don’t have to wait as long as a year to understand battery life.I chose the DS2740 High-Precision Coulomb Counter from Maxim. The reason was mainly driven by the claimed accuracy.The sense resistors are three 0R03 1% to derive 10mOhms. Don’t worry about the fact that they are 5w SMD, I have no intention of dissipating anything like that much power. They were leftovers from previous project.So I write the code and then begin testing the unit to make sure everything is working as expected…It isn’t working as expected.At ~10mA it seems to read correctly.At 400mA it reads ~489mA. It is not a high current issue as the device is capable of measuring 5.12A when using a 10mOhm sense resistor.The oscilloscope shows practically no noise on the line being sensed.I started to doubt my own test equipment.Maybe the DC load was not working in CC mode properly.Maybe the coulomb counter was more accurate than my test equipment.Maybe… etc…I have carefully washed all flux off with IPA.I have replaced the DS2740 with a new one – in case I had somehow damaged the first one.I finally resorted to using a battery and a resistor to verify the chart results.The chart below shows the 40 odd test points between 10mA and 400mA.The error seems to be fairly linear above 50mA, however below that it is all over the place.I cannot use software to correct the error as the error will be accumulated by the DS2740 and I need the accumulated value to be accurate due to the erratic current draw behaviour of the DUT.Any ideas on what I have done wrong here?Any advice much appreciated.Attachments:1. Screenshot of the top section of the board where the DS2740 lives. From Eagle. The GND flood fill is off in that shot.2. The chart of results.3. A photo of the back of the PCB4. A photo of the front of the PCB5. The DS2740 datasheet.Test equipment used:Tektronix PWS4205 Programmable Power SupplyRigol DP831A Programmable Power SupplyRigol DM3068 Digital MultimeterAgilent U1273AX Digital MultimeterFluke289 Digital MultimeterRigol DS2072A OscilloscopeMaynuo M9710 DC Electronic LoadA 12v SLA batteryA 30 Ohm 50w alloy encased resistor.A 50 Ohm 50w alloy encased resistor.A 100 Ohm 50w alloy encased resistor.

author: Hensingler
author_rank: Regular Contributor
timestamp: February 06, 2017, 03:27:02 am
content: Data sheet shows an RC filter on VDD and you seem to just have the R.

author: Mr.B
author_rank: Unknown
timestamp: February 06, 2017, 03:38:10 am
content: Well spotted.Thank you.I will bodge the cap in and retest.

author: Mr.B
author_rank: Unknown
timestamp: February 06, 2017, 07:44:28 am
content: Ok, so I bodged the 0.1 cap in and ran all my tests again.No change.Still have the error and it is still non-linear.Any more thoughts?

author: capt bullshot
author_rank: Super Contributor
timestamp: February 06, 2017, 08:45:13 am
content: According to the datasheets spec, your plot looks quite OK.There's no spec at all about absolute accuracy of the DS2740, so the first thing you should do is to calibrate the full scale range of the reading at either a reasonable high current or your typical operating current. Then check again the non-linearity (your plot looks like there's no non-linearity at low currents, or maybe I'm not able to read the plot they way you intended).I wouldn't expect absolute accuracy from this chip without calibrating (after reading the data sheet). The only vague spec about accuracy is a "gain error" of +/- 1%, for a decent ADC there should be temperature and long term specs. They do not mention an internal reference at all, so the chip is quite questionable.

author: 2N3055
author_rank: Super Contributor
timestamp: February 06, 2017, 11:03:29 am
content: I agree with capt..If blue is reference data, your DS2740 is perfectly linear.. You do have gain error though.. You paralleled 3x 0.033Ohm so that is 0.011 Ohm, that will give 5.5mV voltage drop for 500mA..You need to get shunt to be accurate or calibrate in software.. I took a look in a datasheet, chip doesn't take any config, it measures voltage and voltage accumulated representing current..To get current and Coulomb count you need to take both values from registers and divide them with shunt resistance.. Well, divide with 0.011 Ohm (or whatever you put in) and it will be fine.Of course tempco of resistor and internal errors from chip will be there...

author: Mr.B
author_rank: Unknown
timestamp: February 06, 2017, 06:35:48 pm
content: Thank you for your input.Looking more closely at the chart I can now see that the error is in fact pretty close to linear.I will test at 1000mA and zero out the error in software.