Digital Voltmeter Using PIC Microcontroller 16F877A and Seven Segments Display (0-30V)

We are all aware of about voltmeters (voltage meter), which is nothing but a device used to measure voltage between given two terminals. Apart from the basic usage digital voltmeters are also employed as panel meters for automation systems and robotics. There are analog and Digital voltmeters are available in the market. Have you ever thought about building a PIC microcontroller based digital voltmeter with seven segment display output? Here I’m explaining the constructional details of digital panel voltmeter using PIC16F877A microcontroller. It can measure voltage between 0V to 30V DC. Seven segment units are provided for digital voltmeter display which gives clear visibility of digits from long distance comparing to LCD display.

Digital Voltmeter Using PIC Microcontroller 16F877A and Seven Segments Display

The program for digital voltmeter using pic microcontrolle is compiled using Mikro C. We are providing the .HEX file for this simple voltmeter absolutely free!

Circuit Schematics of Digital Voltmeter Using PIC Microcontroller

The following figure shows digital voltmeter panel circuit diagram with microchip PIC.
Digital Voltmeter Using PIC16F877A Microcontroller Circuit Diagram

Components Required for Digital Voltmeter Using PIC Microcontroller

  1. PIC16F877A Microcontroller
  2. Transistor (BC548 x4)
  3. Resistor (1KΩ x 5; 10KΩ; 100KΩ; 22KΩ)
  4. Seven segment Display x8
  5. Crystal (20MHz)
  6. Capacitor (10µF, 33PF x2)

Working of Digital Voltmeter Using PIC Microcontroller

  • PIC programming is quite easy if you have a perfect C compiler like Mikro C pro, MPLAB Hi-tech C etc.
  • PIC16F877A has inbuilt ADC (Analog to Digital Converter) Module, I used ADC to read input voltage value.

Measuring Voltage and Design of Voltage Divider Circuit

  • First of all let I discuss how do we measure voltage? Actually PIC’s ADC can measure 0V to +5V, but here our voltage range is 0V to +30V.
  • Hence we can’t feed the input voltage directly to the controller’s ADC pins. Instead of feeding directly, input voltage is reduced by a combination of voltage divider resistors.

Maximum allowed drop will be 5V.
Potential divider for digital voltmeter circuit
Digital Voltmeter Potential Divider design
We got R1=110KΩ, but 110KΩ standard value resistor is not available, so use series combination of 100KΩ and 10KΩ.
Potential divider for digital voltmeter PIC circuitNote: – If you want to increase the input range, let’s say 0V to 100V change the above equations accordingly.

Calculating Actual (Real) Input Voltage from Voltage Divider Circuit

  • As per our circuit diagram PIC microcontroller reads voltage across 22KΩ resistor. So calculate voltage across 22KΩ resistor by voltage divider rule.
    Design Digital Voltmeter circuit

Mapping ADC Values to Input Voltage

  • PIC microcontroller ADC is a 10 bit ADC, that means the output of ADC can be vary from 0 to 1023 maximum while input varies from 0 to 5V.
  • That is when the input voltage is +5V then ADC value is 1023, when input voltage is 0V ADC value will be 0.
  • We have to map 0 → 1023 to 0 → 5; it can be done by multiplying ADC value with a constant K.
  • This will be a 5 digit mille volt value, to get real value put period (.) after 1st two digits. We have 4 seven segment display units, to remove the last digit just divide by 10.

For example let’s say ADC value is 1023

Vactual=1023*4.89*6 milli volt=30014 millivolt

This number is displayed on the LCD screen after dividing by 10 that is 3001. We are enabling the DP (dot) pin of 2nd unit to get real voltage.

Converting Number to Seven Segment Data

  • I separated this value to four digits by modular division i.e., 3001 is converted to 3, 0, 0, 1.
  • That is 4th Digit = value%10, 3rd Digit = (value/10)%10, 2nd Digit = (value/100)%10, 1st Digit = (value/1000)%10.





Hence 3001 is separated to 3, 0, 0, 1 and it is displayed by 30.01 on seven segment unit.

  • These individual values are converted to corresponding seven segment data and displayed by the technique Seven segment multiplexing.

Digital Voltmeter Mikro C Program

Our developers spend hours to yield the program code. Hence we are charging a reasonable amount for our program, buy the way as an offer we are providing .HEX file absolutely free!

  • CG-Program_StoreMikro C program for this Digital Voltmeter is available at CG_Program_Store (no: 17) and .HEX file is free of coast.

Download .HEX file from the link →  Download Digital Voltmeter Using PIC Microcontroller .HEX file

Well, did you build the project? Engineering and diploma students can submit this project as an academic mini project. If you found this post is useful please like our facebook page and share the circuit.

In my next article I will be posting Digital Ammeter using PIC Microcontroller.