Author Topic: Arduino digital ammeter with a 75mV current shunt?  (Read 20652 times)

0 Members and 1 Guest are viewing this topic.

Offline rs20

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Arduino digital ammeter with a 75mV current shunt?
« Reply #25 on: August 07, 2014, 10:19:21 am »
I do see your point.  I use percent as percent of reading as typically the reading is end result, and likely displayed somewhere for use; whereas FS may not be remembered (if different dividers/multipliers deployed via a selection switch.)  So while %FS is more technically definable, %reading is more "user-friendly".

The thing is, the error rising to infinity is purely an artefact of your definition of error, it'll happen with any ADC. In fact, the same phenomenon will occur with all sorts of things people trust, like a metal ruler. Use a ruler to measure 1.3mm, it's awfully difficult to get "10% accuracy". Use the same ruler to measure 130mm, it's incredibly easy to get "10% accuracy". This is a good principle to be aware of in general, of course, but presenting it as if its a special peculiarity of AVR ADCs is surely very confusing for people. I think most people, myself included, interpreted your message as "beware of microcontroller ADCs, they have this weird behaviour" as if it was somehow unique to the AVR or non-dedicated chips.

I'm struggling to think of an instrument I've encountered in my life that displays an error as +/- x % of measured value. I totally take your point that % of FS should be left on the ADC datasheet on not presented to consumers or end-users because it could be misunderstood, I agree with that, and I haven't seen any instruments do that either. But the solution is to present error in millivolts, milliamps, millimeters or widgets, not % of anything.
 

Offline zapta

  • Super Contributor
  • ***
  • Posts: 6190
  • Country: us
Re: Arduino digital ammeter with a 75mV current shunt?
« Reply #26 on: August 07, 2014, 01:23:24 pm »

The thing is, the error rising to infinity is purely an artefact of your definition of error, it'll happen with any ADC.

Doesn't happen with a logarithmic ADC, right?
 

Online Rick Law

  • Super Contributor
  • ***
  • Posts: 3442
  • Country: us
Re: Arduino digital ammeter with a 75mV current shunt?
« Reply #27 on: August 07, 2014, 05:20:01 pm »
I do see your point.  I use percent as percent of reading as typically the reading is end result, and likely displayed somewhere for use; whereas FS may not be remembered (if different dividers/multipliers deployed via a selection switch.)  So while %FS is more technically definable, %reading is more "user-friendly".

The thing is, the error rising to infinity is purely an artefact of your definition of error, it'll happen with any ADC. In fact, the same phenomenon will occur with all sorts of things people trust, like a metal ruler. Use a ruler to measure 1.3mm, it's awfully difficult to get "10% accuracy". Use the same ruler to measure 130mm, it's incredibly easy to get "10% accuracy". This is a good principle to be aware of in general, of course, but presenting it as if its a special peculiarity of AVR ADCs is surely very confusing for people. I think most people, myself included, interpreted your message as "beware of microcontroller ADCs, they have this weird behaviour" as if it was somehow unique to the AVR or non-dedicated chips.

I'm struggling to think of an instrument I've encountered in my life that displays an error as +/- x % of measured value. I totally take your point that % of FS should be left on the ADC datasheet on not presented to consumers or end-users because it could be misunderstood, I agree with that, and I haven't seen any instruments do that either. But the solution is to present error in millivolts, milliamps, millimeters or widgets, not % of anything.

We are in total agreement of facts, but in disagreement of presentation.  We are from very different frame of reference.

First, I did not (nor mean to) say or imply "beware of MCU" when it come to measurements.  I was saying: "hey, there is this habitable zone and there is this wild country, stay in the sweet zone you are fine, but assume the whole thing being flat and everywhere (Vmin to Vmax) being same, you are off for a problem."

Second, I fully understand your "struggling to think of an instrument I've encountered in my life that displays an error as +/- x % of measured value."  Makes perfect technology sense, but not user friendly except EE-kinds.  FS%error+RD%error+CountError. 

My experience is mostly outside the EE world, and few if any one think of error as %FS value.  My experience has been mostly :
Read a number and add a tolerance (Value+-%error).

This is one part that is very confusing to people not of EE background.  The way DMM defines accuracy was driving me nuts.

The car engine guy may think it makes perfect sense measuring speed in terms of % of max engine power, but some one walking into the shop would be totally confused.

It was precisely that difference in frame of reference that I translated the data to something I encounter more in my world:
LowLimit < Value +- X%error < HiLimit

This is an EE forum, of course everyone here should use an EE common frame of reference.  But not everyone is there yet.  The way the OP framed his original question, it looks like a post from someone like me - not already an EE expert, thus...  Perhaps "more common ways" may be easier to understand.
« Last Edit: August 07, 2014, 05:22:38 pm by Rick Law »
 

Offline GeorgeOfTheJungle

  • Super Contributor
  • ***
  • !
  • Posts: 2699
  • Country: tr
Re: Arduino digital ammeter with a 75mV current shunt?
« Reply #28 on: August 07, 2014, 10:03:18 pm »

You just have to accept that when you are measuring below 1V, your accuracy will go very very far south.


Aren't the Arduino ADC steps 5/1024? That's ~ 4.88 mV. I don't see why it would be any less accurate than that below 1V? Could you please elaborate?

He just needs to amplify x133.33 as he said and a 1023 read at the ADC will mean 5 Amps, or 4.88 mA per count.

If you assume condition is perfect, you would have 4.88mV for every step.   There is no ideal opamp even inside an MCU.  Whatever circuits it uses, it is going to have imperfections.  Random noise in and out side the circuit...Measuring equipment, power supply... they all have their imperfections.

- If I have a 1V source, a 0.01V random noise pulse show up as 1% error.  If I have a 0.1V source, a 0.01V noise pulse show up as 10% error.

- When ADC count is 100, 1 count off is 1%, when ADC count is 10, 1 count off is 10%

- It takes longer time for the ADC to measure 100 count reading than to measure 10 count.  A repeating noise pulse would inject more noise (longer time) at 100 count than at 10 count.

- Count is an integer.  You either get there or you don't.  4.88mV per count means below 4.88mV count is 0.  4mV has a zero count, the 0.88mV error in percentage is infinite.  At 9.76mV (count=2), ADC measuring just a tiny tiny bit low would have count=1, error of 100%

etc etc etc

In short, I don't know exactly where the error comes from, I measured them to be such.  I agree it is rather unsatisfactory, but that's the case with imperfections.

Rick


I see your point. The imperfections are specified in the datasheet:

• 10-bit Resolution
• 0.5 LSB Integral Non-linearity
• ± 2 LSB Absolute Accuracy

Yes, it´s a good idea to be aware.
The further a society drifts from truth, the more it will hate those who speak it.
 

Offline ice595Topic starter

  • Regular Contributor
  • *
  • Posts: 98
  • Country: ca
Re: Arduino digital ammeter with a 75mV current shunt?
« Reply #29 on: August 09, 2014, 06:33:09 pm »
since all I wanted to do was to make a battery capacity meter, can't I just make a constant current dummy load with a stop watch timer?
for example, if I want to discharge a lithium ion cell from 4.2v to 3.0v, can I just start the timer and stop the timer when it reaches the 3.0v threshold then multiply the constant current value by the discharge time in hours then get the amp-hour value of the battery?
 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 16615
  • Country: us
  • DavidH
Re: Arduino digital ammeter with a 75mV current shunt?
« Reply #30 on: August 09, 2014, 07:49:09 pm »
That will work but may not accurately represent the characteristics of the load.  Switching power supplies provide a constant power load (negative resistance), linear supplies provide a constant current load, and some loads are resistive so the current and power drop as the voltage drops.  Any of them used consistently will measure battery capacity.

Batteries are usually specified with constant current loads.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf