Embedded Programming Tutorials for Beginners with Step By Step Guide.

Friday, July 10, 2015

Digital Voltmeter project Using Microcontroller

Digital Voltmeter measure voltage between two point in circuit . Now we are going to make a digital voltmeter which can measure 50 volt maximum . We will use pic18f2550 microcontroller and it's ADC pin . Remember that an ADC channel of pic18f2550 can count from 0 to 1023 . Because it's ADC channel register is 10bits. As we like to  measure 50 volt , we need to apply a simple technique . So we have to convert 50 volt to 5 volt  and we get reading 1023 at adc channel  for 50 volt .
For converting we will connect 68k ohm, 22k ohm and 10k ohm resistors in serial so that during applying 50 volt it makes 5 volt drop at 10k ohm resistor . It's the main theme .

ADC(Analog to Digital Converter ) :

We need a basic knowledge about ADC . Let's  take a look at here :
Thief Detector using PIC Microcontroller & PIR Motion SensorThief Detector using PIC Microcontroller & PIR Motion Sensor
Thief Detector using PIC Microcontroller & PIR Motion Sensor
ADCON1 Register

Basically ADC is like as voltage divider . According to voltage It produce output .

bit 5 : VCFG0: Voltage Reference Configuration bit (VREF- source)
1 = VREF- (AN2)
0 = VSS or 0 volt

bit 4 :VCFG0: Voltage Reference Configuration bit (VREF+ source)
1 = VREF+ (AN3)
0 = VDD or 5volt

We will set  VCFG0[bit 5]=0and VCFG0[bit4]=0 . So we will get highest value 5volt[1023] and lowest value 0volt[0].The ADCON1 is a 10 bit register that means  2 to the power 10  is it's highest counting capacity and result is 1024 . So this register can count from 0 to 1023 . When 0 volt , we get reading at RA0 pin  0 .When 5 volt , we get reading at RA0 pin 1023. It means 5volt equivalent to 1023 .

 If  1023 reading value    equal   to 50 volt.
So 1      reading value    equal   to  50/1023 volt
So 'read_val'  reading  value   equal  to (50/1023)*read_val .

 Source Code :

sbit LCD_RS at LATB7_bit;
sbit LCD_EN at LATB6_bit;
sbit LCD_D4 at LATB5_bit;
sbit LCD_D5 at LATB4_bit;
sbit LCD_D6 at LATB3_bit;
sbit LCD_D7 at LATB2_bit;

sbit LCD_RS_Direction at TRISB7_bit;
sbit LCD_EN_Direction at TRISB6_bit;
sbit LCD_D4_Direction at TRISB5_bit;
sbit LCD_D5_Direction at TRISB4_bit;
sbit LCD_D6_Direction at TRISB3_bit;
sbit LCD_D7_Direction at TRISB2_bit;
      char volt[]="        ";
        char mv[]="v";
void main() {
 double source=0;
 float calv=0;
 float sum=0;
 float mult=0;
  ADCON1=0x0E;                 // Configure RA) pin as input
  ADC_Init();                        // Initialize ADC
  Lcd_Init();                        // Initialize LCD
  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Out(1,1,"Volt Meter");

Circuit :

Simply Just click on the "Skip Ad" and you will get the download option.

Thank You!


  1. Nice post. I find out some thing harder on distinct blogs everyday. It will always be stimulating to study content using their company writers and exercise something from their website. I’d would rather apply certain using the content in my weblog regardless of whether you do not mind. Natually I’ll provide you with a link with your web weblog. Many thanks for sharing. Flow Meter LC

  2. I was more than happy to uncover this great site. I need to thank you for your time due to this fantastic read!!
    I definitely enjoyed every bit of it and I have you bookmarked to see new information on your blog.
    humidifier dehumidifier combo

  3. I was more than happy to uncover this great site. I need to thank you for your time due to this fantastic read!!
    I definitely enjoyed every bit of it and I have you bookmarked to see new information on your blog.
    WordPress Chat Plugin

  4. Keep it easy and even impressive. Many clients are worried about the design elements in the logo that if the expert web designer is easy, then it will be boring and will give a lazy impression to the customers winners. Logo Cravings recommends that you choose a 3D logo design service in the United States as the ideal solution to these problems. Services for 3D logo design will remain simple and provide depth and detail about logo design in general. This makes 3D logo design one of a kind and makes your brand stay fresh and alive.


Course by The University of Texas at Austin

(FREE Edx Course) Embedded Systems - Shape The World: Microcontroller Input/Output. Offered by The University of Texas

Become a Robotics Software Engineer- Udacity Course

Ain't getting any visitors!
Please Share and Bookmark posts.


: (1) 18F2550 (1) 36KHz (3) and (1) arduino (1) Based (1) battery (1) Bipolar (1) Blinking (1) blinks (1) Bluetooth (1) bluetooth device interfacing (1) bluetooth module (1) button (1) circuit (1) clock (1) control (1) crystal oscillator (3) Db9 (1) DC Motor (2) digital (2) Digital Voting Machine (1) digital voting machine using pic (1) display (2) DS1307 (1) electronic (1) embedded c programming tutorial (11) embedded c tutorial (11) experiment kit (4) external interrupt (4) flash (1) flashing (1) Gas Leakage detector (1) HC-06 (1) home (1) how (1) How to (10) i2c tutorial (1) in (1) indicator (1) infrared Connection (3) interface (8) interfacing (3) Interrupt (3) Introduction (1) IR Connection (3) IR Receiver (4) IR Transmitter (4) key pad (1) keyboard (1) keypad (1) lavel (1) Lcd 16x2 (2) lcd 2x16 (2) led (1) lm35 (2) LPG (1) machine (1) make (1) Make bootloader (1) making (1) matrix (1) max232 (1) membrane keyboard (2) meter (2) Micocontroller (1) microchip (4) microchip pic (2) microchips (3) microcontroller (9) microcontroller based (3) microcontroller programming (3) Microcontroller Project (4) Microcontroller Projects (1) microcontroller_project (2) microcontrollers (4) Microprocessor (2) mikroC (5) mikroc code to start and stopstart and stop dc motor (1) mikroc pro for pic (2) Motion detector (1) MQ-9 Gas Sensor (1) musical (1) NEC Protocol (4) pcb (5) PIC (3) pic controller (11) pic microcontroller (11) pic microcontroller tutorial (11) pic programming (1) pic programming in c (12) pic proteus (1) Pic Tutorial (12) pic18 (2) pic18f2550 (11) picmicrocontroller (4) picRFモジュール (1) PIR Motion Sensor (1) printed circuit board (1) proteus (6) pulse width modulation (1) push (1) push button (1) PWM (1) real (1) rf transmitter (3) Rs 232 (1) Rs232 (1) scroll (1) scrolling (1) Serial communication (1) Serial Connection (1) Serial Port (1) serial port rs232 (1) Servo Motembedded c programming tutorial (1) simulation (2) Soil Moisture Meter (1) speed control (1) step by step (7) step bystep (1) Stepper Motor (2) text (2) Thief Detector (1) time (1) timer (4) timer0 (4) tone (1) TSOP38236 Receiver (4) tutorial (2) Unipolar (1) USART Connection (1) USB (1) usb 1.0 (1) USB bootloadere (1) USB HID (1) using (9) voltmeter (1) voting (1) water level indicator (3) with (2) work (1)

Traffic Feed

Live Traffic Feed
Visitor Tracking

Leave Your Message Here


Email *

Message *

Like on Facebook