¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: Resolution, accuracy, error and digital displays


 

Some thoughts...

When reading DC (derived from RF rectifier) on the Arduino ADC...
  1. Read the ADC twice to allow for settling of the charge-capacitor in the ADC.

  2. Set variables as "float" so that the read will return a fractional value.
    x = float, y = float;
    x = analogRead(ADC_Pin);
    x = analogRead(ADC_Pin);? // returns 0 to 1023 in 0.00488V steps
    y = x * (5 / 1023);
If the rectifier diode drop is a problem, then use an AD8307 log detector.



Arv K7HKL
_._

On Mon, Nov 5, 2018 at 5:34 PM Michael Maiorana <zfreak@...> wrote:
Into the deep end indeed. Of course there is likely no practical need to know our output power down to the milliwatt. No doubt that the software can be configured to display as many significant figures as we'd like. The question is, at least in this particular case, how many should we be displaying? Since we talk about test equipment here I thought it would be a worthwhile exercise.?

I got home from work today and read the article, then got the extras from the arrl "in-depth" website. I'm extra confused now since I shyly think that there is a bug. I'll get to that later.

I'm going to start with using 4 significant figures in the measurements. Let's say we're only looking at a pure sine wave, which I think is a reasonable abstraction. We turn up our ultra-accurate QRP rig and put exactly 1 watt (30 dBm) into the 50 ohm dummy load. That should be 7.071 V rms or 9.998 V peak. The diode / capacitor detector circuit should read peak voltage. From there the voltage is reduced to allow more range in the 0-5V arduino input, so a voltage divider divides by 29. So the voltage at the ADC would be 0.3448 V. Each bit in the arduino ADC is 4.883 mV per bit. That math gives 70.60, but it is binary so round to 71? The code averages 30 readings to smooth the reading. It then squares the ADC reading and divides by the load resistance, then multiplies by a "Calibration Offset" of 0.008704. The grand total is 877.5 milliwatts. Since that "Calibration Offset" value is meant to be used for calibration, in this example we'll use 0.009919 since that makes our numbers work. 71 squared, divided by 50, time 0.009919 is 1.0000.?

The issue I started with is possible error, and the displayed 4 digit value in watts. What are the possible errors? The diode drop. The tolerance of the resistors in the voltage divider network. The temperature coefficient of the load resistors. The linearity of the arduino ADC. Accuracy of the arduino's ADC reference voltage. The ardiuno Uno's stated ADC absolute accuracy is?+/- 2 LSB

So let's say that everything else is perfect and we only consider the ADC absolute accuracy. That means that our ADC could have read anywhere from 69 to 73. Those values translate to 0.9445 mW to 1.057 W. That's only two significant figures at most.?

On the higher end of the scale the ADC absolute accuracy will still impact our values (because we're squaring the voltage). 100 watts in, 99.98 volts peak, (do the above math), gets between 98.32 watts and 99.44 watts. Again, two significant figures. Add to this resistor errors, reference errors, and non-linearity of the ADC and I think that the 4 significant digit display is misleading and doesn't reflect reality.?

The potential bug is in the CalculateWatts subroutine. This code is passed the binary value of the ADC. The code then adds a constant "DIODEVOLTAGEDROP" which is defined as 0.7. I understand that they were trying to correct the peak voltage reading by compensating for the diode voltage drop, but in this part of the code the value is not in volts. It is a binary reading of the ADC, equal to about 0.3448 volts per bit. To properly correct for a 0.7 volt diode drop they should add 2, which would be 0.6896 volts. I could be dead wrong, so if others out there who are more code savvy than me could correct me I'd appreciate it.

I'd love to hear what you folks think about this, as well as the potential bug in the software.

Thanks for reading?
Mike M.
KU4QO



On Mon, Nov 5, 2018 at 1:25 PM Alan de G1FXB via Groups.Io <g1fxb=[email protected]> wrote:
Hi Mike,
Couldn't? agree more.

Before you take in account the measurement accuracy,
No mater how many digits there are, the least significant digit is subject to +/- 1 rounding, so is to be ignored.

We had apprentices bringing in their latest purchase 4 1/2 digit DVM's and the first thing we do is point out in 99.999% of cases that accuracy is at best unnecessary / and misleading.
60 years ago we made do without needing that accuracy.
When trying to align something for a peak or minimum, Auto ranging & flickering last digits are a PITA.
Use an analogue meter, alternately it's the reason why better DVM's have the bargraph function to see trends.

*MOST* voltages quoted in manufactures service manuals have a tolerance of at least 5% (10% is not unusual) 10v =? anything in the range 9.5 --> 10.5v (9 -->11v) is allowable.
Does the fact I read 10.501v mean I should look for a fault, while 10.5v is OK??
All but the very cheapest DVM's suffice, and are expendable when the apprentice over current or inadvertently leave the meter on resistance range while they put the prods on the mains line in strip.


It reminds me of a saying. A man with a clock knows the time, a man with two clocks in probability doesn't.? :-[

Alan



On 05/11/2018 14:23, Michael Maiorana wrote:
I was looking over the latest QST magazine and I had a thought that I wanted to discuss with the group. On the cover was an interesting "dummy load" project that used an array of resistors in an oil bath as the load, and an Arduino Nano to display the output power.?

A voice from my past echoed in my head. Dr. Wolfe taught Chemistry at the community college that I attended. He was bright and energetic, but quite strict. I learned a lot from Dr. Wolf, but the one thing that has stuck with me over the years was his insistence on properly expressing values considering the measurement accuracy and significant figures.

The display on the watt meter on the cover of QST shows 4 figures of accuracy. What I wanted to discuss was if it was reasonable to display 4 digits of precision in this particular instance.?

This is certainly not a criticism of the QST project, but simply an opportunity to discuss the topic.

73
Mike M.
KU4QO

Join [email protected] to automatically receive all group messages.