Data input ;
values = analogRead(A0)
values = analogRead(A0)
Configures the reference voltage used for analog input (i.e. the value used as the top of the input range). The options are:
- DEFAULT: the default analog reference of 5 volts (on 5V Arduino boards) or 3.3 volts (on 3.3V Arduino boards)
- INTERNAL: an built-in reference, equal to 1.1 volts on the ATmega168 or ATmega328 and 2.56 volts on the ATmega8
- EXTERNAL: the voltage applied to the AREF pin (0 to 5V only) is used as the reference.
Scaling values ;
0 to 5V give as 0 to 1023 digital values
minimum voltage that can read is 5/1023 = 4.88mv
when you give power supply to the board through Diode, voltage will reduced up to 4.4V
then the correction must be 4.4/1023= 4.3mv
further, it is required sampling of those analog values in for loop at least few hundred
for ( int i; i<100; i++) { values = analogRead();
voltage += 4.441*values/1023;}
then average the voltage by dividing the number of samples
output = voltage/100;
furthermore, gain must be adjust as per the requirement ;
( you have to get few values and read the values with external meters and add the gain)
real Volatge = Arduino read voltage values *gain ;
calculate the gain as per the above equation and put the gain to above output ;
output = voltage*gain/100;
No comments:
Post a Comment