I would like to ask you very kindly How can I correctly calculate the resolution for a A/D converter (10bits) ? Why many people is using the following formula Vref/1024 and other Vref/(1024-1) ???? This is very confusing !
Thank you in advance for a suitable response.
Why many people is using the following formula Vref/1024 and other Vref/(1024-1)
Because many people are right and others are wrong.
It depends what the formula is used for. The resolution is Vref/1024. But if what is needed is a fraction of full scale (0.0 to 1.0) then Vref/1023. is appropriate.
For example, if Vref is 5V, then the resolution is 4.88mV per bit.
But if you want to convert an ADC reading to a voltage then you need (5Vref)/1023. so that a reading of 1023 (full scale) gives you (51023)/1023. = 5V
Pete
...except that you can never say the input is 5V, only that the voltage is greater than 5V - 4.88mV.
A small distinction.
Yes, you would have to calibrate it to know what the fullscale voltage is and adjust the formula accordingly. If it can exceed that, I would submit it hasn't been engineered properly.
Pete
adjust the formula accordingly
There is no "accordingly".
It's a limitation of the A/D.
It's probably one of the reasons voltage reference devices often come with peculiar outputs, like 1.024, 2.048 or 4.096 volts.
Ohhh, I see what you mean now. Yup.
Pete
Ok guys, thanks a lot for your answers ... but I think you didn't give a quite clear answer .... I am trying to do a project for my secondary school and I dont really understand what you wrote! ..... Could you response to this please :
Hello,
I would like to ask you very kindly about 10bit arduino converter. If I am using 2V as reference voltage then to calculate its resolution I can apply the following formula Vref/(2^N-1) or Vref/(2^N) ??? which one is correct??? . Moreover, If the converter give 512, to calculate the corresponding voltage value I can use this formula 512*(Vref/1023) and if it is giving 256 then 256*(Vref/1023) and so on ???? in other words is it correct to use 1023 or 1024 for 10 bit converter???
Thank you in advance for your response.
Ok guy, thanks a lot for your question ... but I think you didn't give a more precise second question* .... I am trying not to do the project for a secondary school student and I do really understand what you wrote! And so did the other guys answering your question ..... Could you response to this please :
Why is someone in secondary school not capable of linking the answers to his/her question?
Jantje
- Einstein stated: "Insanity: doing the same thing over and over again and expecting different results."
??? what do you mean Jantje? :~ I am trying to read a pot but I want to understand A/D conversion first. My next step is to study electronics in the future, but many people told me that using arduino I'm just wasting my time and I have to learn embedded C language to work with PIC or AVR microcontrollers.
btw thanks for your opinion
You use Vref/2n
Do us a favour and pick up your keyboard, turn it over and give it a good shake.
Something is causing your '?' key to stick.
10 bit, in binary, has a range of 0 to 1023 ... 00 0000 0000 min
11 1111 1111 max
1024 is the 11th bit (carry over)............. [color=red]1[/color]00 0000 0000
So the 10-bit A/D resolution (step size) is Vref/1024 (volts)
The maximum value the 10-bit A/D can output is 1024-1
You are using a similar method every day when using the base 10 numbering system:
The possible characters to display range from 0 to 9.
So the base 10 "step size" is 10/10 = 1
The maximum base 10 character is (10-1) = 9
There is no character for ten, so we carry over and use the next decade...10
but many people told me that using arduino I'm just wasting my time and I have to learn embedded C language to work with PIC or AVR microcontrollers.
Many people are total idiots, time wasting is guaranteed if you listen to them.
The Arduino IS programmed in C and by definition it is embedded if it runs on an Arduino.
Every embedded micro controller is different and so C functions are written to make things easier. What is sometimes mistakenly called the Arduino language is just C with added predefined functions, like digitalWrite.
Using 1024 / Vref, will give you the size in volts between each increment of the reading.
Using 1023 / Vref will give you a value to multiply a reading by to convert the reading into volts to the nearest voltage increment.
Both are correct they just do slightly different things
dlloyd:
10 bit, in binary, has a range of 0 to 1023 ... 00 0000 0000 min
11 1111 1111 max
1024 is the 11th bit (carry over)............. 100 0000 0000
So the 10-bit A/D resolution (step size) is Vref/1024 (volts) The maximum value the 10-bit A/D can output is 1024-1 ...
Using an example of a 2 bit A/D (2^2), our possible A/D values would be 0 - 3
I.E. (in binary):
00
01
10
11
If we were using a reference voltage of 3 volts, then:
00 is 0V
01 is 1V
10 is 2V
11 is 3V
ie. the step is really 1/(2^n -1) . In this example it is 1/(2^2 -1) = 1/3
Our ref voltage in this example is 3V, therefore the step is 1V (1/3 * 3V)
Using 1/(2^n) is inaccurate, but probably the error is inconsequential for 10 bit A/D
The ADC partitions the input voltage range into 1024 equal buckets, centred on voltages
Vref * (n+0.5)/1024
If you treat each ADC reading value to represent the mean value of voltages in each bucket
that means that the correct formula is that one.
Lots of people confuse this with the formula for a 10 bit resistor-ladder DAC converter which is
genuinely
Vout = Vref * n / 1023
Such a D/A converter produces a single voltage for each input code, whereas an ADC maps
a range of voltages to a single output code.
If it helps consider a hypothetical 1 bit ADC - 0 represents the bucket centred on Vref/4, 1
represents the bucket centred on 3/4 Vref. A 1 bit DAC generates 0V or Vref only. You
could argue a digital pin works as a 1 bit DAC or ADC depending if output or input