You are on page 1of 10

ECE 416T2L ACTIVITY NO.

3
xV DC VOLTMETER

At the end of this activity, the student should be able to:


1. To design a basic single range digital instrument capable measuring voltages greater
than 5V DC.
2. To use a calibrated voltmeter to tune/calibrate the single range digital instrument
capable measuring voltages greater than 5V DC.
3. To use excel or any similar software in selecting the “best fitted” equation to represent
a set of voltage measurements which will then be integrated in the design of the single
range digital instrument capable measuring voltages greater than 5V DC.
4. To design a multi-ranged digital instrument capable measuring 5V and voltages greater
than 5V DC.
NOTE: This activity covers all TLOs of the course since it is including all parts of a basic
instrumentation and digital system.

I. INTRODUCTION:
In this activity, a digital voltmeter using a microcontroller will be designed. The
digital voltmeter using a microcontroller can read voltages higher than 5 volts DC.
Digital AC voltmeter can also be designed using microcontrollers. Voltage divider
circuit is used to divide voltage into two parts to prevent more than 5 volt appearing
across the built-in analog input of the microcontroller because microcontroller can
only read voltages not more than 5 volts DC directly. Liquid crystal display is
interfaced with the microcontroller to display measured voltage value.

II. EQUIPMENT/MATERIALS NEEDED:


Instrumentation and digital controls experiment board,
Wire connectors,
10kΩ potentiometer/trimmer,
Resistors: 6.8kΩ, 4.7kΩ, 18kΩ, 1kΩ,
Variable power supply,
Voltmeter (preferably digital)

III. PROCEDURES
1. Construct the circuit shown in figure 1 on your experiment board. This circuit is
basically the same circuit you constructed in activity #1 except that the input
voltage is 12V DC (instead of 5V DC) and R1 and R2 are connected as a voltage
divider circuit (VDC) at the input.
Do not connect the output of the potentiometer circuit to the analog input of
your microcontroller board. Instead, connect a digital voltmeter set to measure
DC voltage at the output of the potentiometer circuit.
2. Turn ON the supply of the circuit.
3. Vary the setting of the shaft of the potentiometer as you monitor the voltage indicated
on your voltmeter.
What is your minimum voltage reading?

Minimum voltage = 0V
What is your maximum voltage reading?

Maximum voltage = 3.94V


4. Turn OFF the supply of your circuit.
5. Connect a DC voltmeter at the wiper/center terminal of the potentiometer circuit to
measure the voltage inputted to your experiment board. Set the shaft of the
potentiometer to input the minimum voltage to your circuit. Record the readings on the
table shown below. Set the shaft of the potentiometer to at least 10 other settings.
SETTING NO. 1 2 3 4 5 6 7 8 9 10 11
LCD READING 2 72 139 239 310 385 485 572 651 739 839
(DECIMAL)
VOLTMETER 0 0.34 0.66 1.13 1.47 1.82 2.31 2.73 3.11 3.53 3.94
READING
6. Use EXCEL or any available software to derive the linear equation to represent your
results.

7. Integrate this equation in your program. Download your compiled program to your
MCU. Rotate the shaft of the potentiometer. Describe its effect on the value displayed
on the LCD in your experiment board. Compare the displayed value on the LCD and the
values indicated with the voltmeter reading.
8.
#include <LiquidCrystal.h> int sensorValue=analogRead(A0);
LiquidCrystal lcd(12,11,5,4,3,2); float val=0.0048*sensorValue-
0.0041;
void setup(){ lcd.setCursor(0,1);
lcd.begin(16,2); lcd.print(val);
lcd.print("5V DC VOLTMETER"); lcd.print("");
} lcd.print("V");
}
void loop(){

The LCD reading on the experiment board displays almost the same as the
reading on the voltmeter, but not as accurate when the voltage is adjusted to
maximum, as they have a difference in first decimal place.
9. Repeat steps 1-4. Instead of representing your voltage measurements with a linear
equation, consider a polynomial in the 2nd degree.
#include <LiquidCrystal.h> float val=-8E-
LiquidCrystal lcd(12,11,5,4,3,2); 08*pow(sensorValue,2)+0.0048*se
nsorValue-0.0123;
void setup(){
lcd.begin(16,2); lcd.setCursor(0,1);
lcd.print("5V DC VOLTMETER");
} lcd.print(val);
lcd.print("");
void loop(){ lcd.print("V");
int sensorValue=analogRead(A0); }

As we rotate the potentiometer shaft, the LCD reading displays almost the
same as the voltmeter reading. Unlike the first one, the difference between the LCD
reading and the voltage value occurs mostly when the potentiometer is adjusted to
minimum voltage.
10. Compare your readings when representing with the 2nd degree polynomial with your
voltage measurements when representing your results with a linear equation.

Using a linear equation displays a value in the LCD that has a small difference
compared to the voltmeter reading. Using a 2nd degree polynomial equation, the LCD
will display a reading that is very similar with the voltmeter reading, though it has also
an error but much smaller compared to when we are using a linear equation.

11. Use the other trend line options in EXCEL to represent your voltage measurements.
Which trend line option “best fitted” your voltage measurements? Explain why?

Based on the observations that we had gathered, we chose the 2nd order
polynomial equation in obtaining the exact voltage reading, because most of its values
have a very small difference when compared to the true value. Using other trend line
option will result to an accurate result in minimum voltage, but has a large scale of
error in the maximum point.

12. Turn OFF the power supply of your experiment board.


13. Repeat procedures 1 to 10. Instead supply the potentiometer circuit with 24V DC,
R1=18kΩ and R2 as is (4.7KΩ).

The minimum voltage is 0V

The maximum voltage is 2.47V

Setting the shaft potentiometer to at least 10 settings and recording the LCD and
voltmeter reading

SETTING NO. 1 2 3 4 5 6 7 8 9 10 11
LCD READING 0 48 97 129 168 209 269 319 373 429 528
(DECIMAL)
VOLTMETER 0 0.1926 0.455 0.612 0.795 0.986 1.274 1.49 1.765 2.026 2.478
READING
Recording the values to excel and deriving its linear equation trend line.

Y=0.0047x-0.0058

Integrating the equation to the program


#include <LiquidCrystal.h> int sensorValue=analogRead(A0);
LiquidCrystal lcd(12,11,5,4,3,2); float val=0.0047*sensorValue-0.0058;
lcd.setCursor(0,1);
void setup(){ lcd.print(val);
lcd.begin(16,2); lcd.print("");
lcd.print("5V DC VOLTMETER"); lcd.print("V");
} }

void loop(){
The LCD reading on the experiment board displays almost the same as the reading on
the voltmeter, but not as accurate when the voltage is adjusted to maximum, as they have
a difference in first decimal place.

Deriving the 2nd order polynomial trend line and then integrating it on the program

Y = -2E-07x2+0.0048x-0.0158
#include <LiquidCrystal.h> int sensorValue=analogRead(A0);
LiquidCrystal lcd(12,11,5,4,3,2); float val=-2E-
07*pow(sensorValue,2)+0.0049*sensorValue-0.0158;
void setup(){ lcd.setCursor(0,1);
lcd.begin(16,2); lcd.print(val);
lcd.print("5V DC VOLTMETER"); lcd.print("");
} lcd.print("V");
}
void loop(){

As we rotate the potentiometer shaft, the LCD reading displays almost the same as
the voltmeter reading. Unlike the first one, the difference between the LCD reading and
the voltage value occurs mostly when the potentiometer is adjusted to minimum voltage.
Using a linear equation displays a value in the LCD that has a small difference compared to
the voltmeter reading. Using a 2nd degree polynomial equation, the LCD will display a
reading that is very similar with the voltmeter reading, though it has also an error but
much smaller compared to when we are using a linear equation. Based on the
observations that we had gathered, we chose the 2nd order polynomial equation in
obtaining the exact voltage reading, because most of its values have a very small
difference when compared to the true value. Using other trend line option will result to an
accurate result in minimum voltage, but has a large scale of error in the maximum point.

PROBLEMS:

1. Design the circuit to set-up your instrumentation and digital controls experiment board to be
switched to 5V, 12V or to 24V DC voltmeter ranges.
This set-up will work for measuring 5V, 12V, and 24V at the same time.

int sum=0; //sum of samples taken


unsigned char sample_count=0; //current sample number
float voltage=0;

void setup()
{
lcd.begin(16,2);
lcd.print("VOLTMETER");
Serial.begin(9600);
}

void loop()
{
//take a number of analog samples and add them up
while (sample_count<NUM_SAMPLES)
#include <LiquidCrystal.h>
{
LiquidCrystal lcd(12,11,5,4,3,2);
sum+=analogRead(A0);
sample_count++;
#define NUM_SAMPLES 10
delay(10); Serial.println("V");
} lcd.setCursor(0,1);
//calculate the voltage lcd.print(voltage*11);
//use 5.0 for 5.0V ADC reference voltage lcd.print("");
//5.0V is the calibrated reference voltage lcd.print("V");
voltage=((float)sum/(float)NUM_SAMPLES*5.2)/1023.0; sample_count=0;
//send voltage for display on Serial Monitor sum=0;
//voltage multiplied by 11 when using voltage divider that
//divides by 11. 11 is the calibrated voltage divide value }
Serial.print(voltage*11);

2. Set-up your instrumentation and digital controls experiment board to measure DC voltages up
to 10000V. Unit shifts to mV, to V or to kV depending on the magnitude of the voltage being
measured.
Voltage measured Unit
< 1V MV
>= 1 but < 1000V V
>= 1000V Kv

{
sum+=analogRead(A0);
sample_count++;
delay(10);
}
voltage=((float)sum/(float)NUM_SAMPLES*5)/1023.0;
v=voltage*2001;
Serial.print(v);
if (v<1){
Serial.println("mV");
lcd.setCursor(0,1);
lcd.print(v*1000);
lcd.print("");
lcd.print("mV");
}
if (v>=1000){
#include <LiquidCrystal.h>
Serial.println("kV");
LiquidCrystal lcd(12,11,5,4,3,2);
lcd.setCursor(0,1);
#define NUM_SAMPLES 10
lcd.print(v/1000);
int sum=0; //sum of samples taken
lcd.print("");
unsigned char sample_count=0; //current
lcd.print("kV");
sample number
}
float voltage=0;
else{
float v=0;
Serial.println("V");
void setup()
lcd.setCursor(0,1);
{
lcd.print(v);
lcd.begin(16,2);
lcd.print("");
lcd.print("VOLTMETER");
lcd.print("V");
Serial.begin(9600);
}
}
sample_count=0;
void loop()
sum=0;}
{
while (sample_count<NUM_SAMPLES)
3. Design an attenuator circuit using void setup()
operational amplifiers. This circuit will {
lcd.begin(16,2);
reduce a 50V DC input to 5V DC. Use lcd.print("VOLTMETER");
this as the input circuit of your Serial.begin(9600);
instrumentation and digital controls }
experiment board to measure DC
void loop()
voltages up to 50V instead of the
{
voltage divider circuits used in this //take a number of analog samples and add them up
work. while (sample_count<NUM_SAMPLES)
{
sum+=analogRead(A0);
sample_count++;
delay(10);
}
//calculate the voltage
//use 5.0 for 5.0V ADC reference voltage
//5.0V is the calibrated reference voltage
voltage=((float)sum/(float)NUM_SAMPLES*5.2)/1023.0;
//send voltage for display on Serial Monitor
//voltage multiplied by 11 when using voltage divider that
//divides by 11. 11 is the calibrated voltage divide value
#include <LiquidCrystal.h> Serial.print(voltage*11);
LiquidCrystal lcd(12,11,5,4,3,2); Serial.println("V");
lcd.setCursor(0,1);
#define NUM_SAMPLES 10 lcd.print(voltage*11);
lcd.print("");
int sum=0; //sum of samples taken lcd.print("V");
unsigned char sample_count=0; //current sample number sample_count=0;
float voltage=0; sum=0;
}

IV. DISCUSSION (observation/interpretation of results)


In the construction of the potentiometer circuit, we observed that the input voltage is
being reduced to 5.1V because it will be the maximum test input allowed by the
microcontroller and beyond that will destroy it. In actual, it produces less than 5.1V
because of the voltage divider circuit, where the other potential drop is. We also saw that
increasing the resistance R1 will gradually decrease the output voltage of the
potentiometer circuit. We also observed that the polynomial with a highest order can be
used in a program to display a value of voltage in the LCD accurately as the voltmeter.
Overall, we have observed that the Arduino microcontroller can be useful for prototyping
a voltmeter that can measure voltages higher than 5V.

V. CONCLUSION
Based on the obtained data, we therefore conclude that in constructing a voltmeter,
we should consider that the input impedance must be infinity to prevent possible errors in
measuring a voltage. Also, we also proved that the Arduino UNO microcontroller can be
used to design a basic single range digital instrument capable of measuring voltages
greater than 5V.