Go Down

### Topic: How to measure a supply voltage to arduino uno? (Read 7618 times)previous topic - next topic

#### GolamMostafa

#15
##### Mar 28, 2017, 02:11 pmLast Edit: Mar 28, 2017, 04:59 pm by GolamMostafa
Quote
It represents half a volt
1. SAR starts with setting up (HIGH) the MS-Bit with a value equal to Vref/2 (1/2 Volt).

2. Because, it is 1-bit ADC; the MS-Bit is established; no other bit awaits to be defined;
the conversion is done.

3. The ADC value is 1 (1/2 Volt) with an error of 1/2 volt.

4. In a closed loop regulation system, the available data to us are the Vref and the value of
of the in situ ADC for the calculation of error signal.

5. In a Forum like this where industrially experienced people are voluntarily engaged  to
answer to the queries even of the novices, the placement of the sophisticated
methodology (reductio ad absurdum) to resolve the ADC issue is not much desired.

Some people say that the ADC conversion process of the ATmega328 invoves 1024 steps
(0 t0 1023); I see it as a 10-Step process, and this brings the difference of one count. It is
a matter of misunderstand/understanding; it cannot be resolved by  reductio ad absurdum
methodology.

#### AWOL

#16
##### Mar 28, 2017, 02:20 pmLast Edit: Mar 28, 2017, 02:28 pm by AWOL
I'm assuming you quoted my earlier post twice to emphasise its correctness.
Thank you.

Quote
The ADC value is 1 (1/2 Volt) with an error of 1/2 volt.
...And with a ten bit converter, a reading of 1023 represents . . . what?
We got the half a volt or greater, by dividing one volt by two, aka 21 (one being the number of bits the convertor has)
(Have you had the light-bulb moment yet?)
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### GolamMostafa

#17
##### Mar 28, 2017, 03:01 pmLast Edit: Mar 28, 2017, 04:58 pm by GolamMostafa

Quote
...And with a ten bit converter, a reading of 1023 represents . . . what?
1. What should we consider - it is what we have in our minds or what we observe?

2. The conversion is finished. The ADC has produced a digital value which is equal to the Vin with error
(+/- 1/2 of LSB).

3. You tell me what to answer - 1023 or 1024?

#### AWOL

#18
##### Mar 28, 2017, 03:22 pmLast Edit: Mar 28, 2017, 03:37 pm by AWOL
Well, for a one bit converter, we divide by 21, so for a ten bit converter, we divide by (Ta-da! ) 210
(and we still have an error, albeit much smaller)
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### zoomx

#19
##### Mar 28, 2017, 04:03 pm
Ten bits represent 1024 values, from 0 to 1023. When you divide you MUST use the number of values and not the maximum value.
So 0 represent a voltage from 0 to the minimum that the ADC get as 1
1023 represent a value from little less 5V (about the same difference between 0 and 1) and 5V
The total number of values the ADC returns is 1024.

Using only one bit, like AWOL and jremington wrote, you have 2 values and the maximum is 1 but when you divide you must use 2 since the possible values are two.

#### GolamMostafa

#20
##### Mar 28, 2017, 04:51 pmLast Edit: Mar 28, 2017, 04:57 pm by GolamMostafa
Well, for a one bit converter, we divide by 21, so for a ten bit converter, we divide by (Ta-da! ) 210
(and we still have an error, albeit much smaller)
Everything is fine as long as we accept the presence of error.
Thanks a lot for a beautiful conclusion.

#### jremington

#21
##### Mar 28, 2017, 06:55 pm
Quote
Everything is fine as long as we accept the presence of error.
An important lesson learned!

#### GolamMostafa

#22
##### Mar 29, 2017, 07:00 amLast Edit: Mar 29, 2017, 08:18 am by GolamMostafa
@jremington
By saying 'An important lesson learned!', if you have wanted to mean that the factor should always be 1024 then I have the humble request to read the following excerpt; else, forget this post.

Digital Electronics by Christopher E. Strangio of Massachusetts Institute of Technology, Prentice-Hall Inc., 1980, p398.

Resolution is a measure of the smallest change in analog input that can be discriminated by an A/D converter. As an example, consider an eight-bit A/D converter that spans an input range of 10V (0 to +10). With eight bits, the input range is divided into 255 equal intervals,* each of which is 39.22 mV(=10 V/255). The resolution of this device, then, is 39.22 mV. A ten-bit A/D converter would offer considerably more resolution by dividing the 10-V range into 1023 equal intervals. In this case, the resolution would be 9.78 mV.

* In general, the resolution of an 'n'-bit A/D with voltage range of 'X' is
X/(2n-1).

#### zoomx

#23
##### Mar 29, 2017, 11:59 am
Something in the excerpt is wrong, 8 bit A/D gives 256 intervals/values not 255.

Quote
* In general, the resolution of an 'n'-bit A/D with voltage range of 'X' is
X/(2n-1).
So, if I have a one bit A/D the resolution is X, so 10V in your example, and I have only 1 interval? Do you expect that if I have a voltage less than 10V I will get zero? For example, do you expect that if I have 9.5V I will get zero? I believe that a reasonable answer is that you get zero if the voltage is between 0 and 5 and 1 from 5 to 10. So you have 2 intervals. Maybe 5 is wrong, but there will be a value in the middle between 0 and 10V and you have two intervals.
One interval mean one value so you get the same value for zero and 10V.

#### AWOL

#24
##### Mar 29, 2017, 12:55 pm
@jremington
By saying 'An important lesson learned!', if you have wanted to mean that the factor should always be 1024 then I have the humble request to read the following excerpt; else, forget this post.

Digital Electronics by Christopher E. Strangio of Massachusetts Institute of Technology, Prentice-Hall Inc., 1980, p398.

Resolution is a measure of the smallest change in analog input that can be discriminated by an A/D converter. As an example, consider an eight-bit A/D converter that spans an input range of 10V (0 to +10). With eight bits, the input range is divided into 255 equal intervals,* each of which is 39.22 mV(=10 V/255). The resolution of this device, then, is 39.22 mV. A ten-bit A/D converter would offer considerably more resolution by dividing the 10-V range into 1023 equal intervals. In this case, the resolution would be 9.78 mV.

* In general, the resolution of an 'n'-bit A/D with voltage range of 'X' is
X/(2n-1).

You can quote a four decade old book, but not read the processor's datasheet?
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### GolamMostafa

#25
##### Mar 29, 2017, 01:32 pm
You can quote a four decade old book, but not read the processor's datasheet?
1. Processor's datasheets are prepared by the Engineers.

2. Processor's design sheets are prepared by the Academicians.

3. People still visit Morocco's thousand years old locked library to see the style of description of
gravity and geometry.

4. When one can't show the courage of denial, he must acquire patience to tolerate others.

#### AWOL

#26
##### Mar 29, 2017, 01:59 pm
A locked library?
What a terrible waste.

Quote
Processor's design sheets are prepared by the Academicians.
Bogan and Wollan were just students when they designed  the AVR processor. I'm guessing they didn't have much of a hand in designing the ADC.
"Pete, it's a fool (who) looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.
I speak for myself, not Arduino.

#### GolamMostafa

#27
##### Mar 29, 2017, 03:10 pmLast Edit: Mar 29, 2017, 03:17 pm by GolamMostafa
What a terrible waste.
1. Thousand years old documents; very very fragile; treasure of mankind; they must be
preserved under lock and key.

2. Alf-Egil Bogen and Vegard Wollan were certainly academicians; I always admire them for their
hard works for conceiving the idea of mapping 'RISC Computing Philosophy' into the
realm of 'Single Chip Microcomputer what they termed 'AVR (I knew it as Advanced Virtual
RISC Microcontroller)'.

3. I agree with you that the ADC has nothing to do with B&W. It is a peripheral, optionally, added
with ATmega line.

4. Thanks for mentioning the names of B&W; thanks Wikipedia for citing their full names. I heard
that few students developed the AVR Architecture, but I did not know their names.

#### jremington

#28
##### Mar 29, 2017, 04:31 pmLast Edit: Mar 29, 2017, 04:38 pm by jremington
The book quote adds nothing to the discussion. There are N-1 intervals between N successive values.

What do the books in Morocco's ancient library say about gravity?

#### GolamMostafa

#29
##### Mar 29, 2017, 04:57 pm
I thought that you had gone for vacation. So, I finished the discussion with AWOL.

Go Up