October 2012 | Arrogance Gizmo

PC Based Voltmeter Using C#

Friday 26 October 2012
Voltmeter C# Arduino, PIC, AVR



This program is developed in C# (C sharp). It needs .NET framework 4.0 to work.  For the circuit and other details of the project go to the Link. Click on the image to download the program.










Code modification of existing project





/**********************************************/
/*
  
 http://www.facebook.com/EmbeddedProjects

 http://microcontrollerprojects00.blogspot.in/

 Author: Vishal K M

 uC:16F877A
 Compiler: mikroC
 Crystal freq: 4MHz


                                              */
/**********************************************/





unsigned long temp;
unsigned int i;
char digit[]="0.000";

void main() {


TRISA=0xFF;

ADCON0=0x01;
ADCON1=0x0E;
UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize
 
   UART1_Write_Text("Embedded Projects");
   UART1_Write(0x0D);

  do {
    temp = ADC_Read(0);   // Get 10-bit results of AD conversion
    temp=temp*5000/1023;   //Convert ADC value to mV
   
   

    digit[0]=(temp/1000)+48;
    digit[2]=((temp%1000)/100)+48;
    digit[3]=(((temp%1000)%100)/10)+48;
    digit[4]=(((temp%1000)%100)%10)+48;
   
    UART1_Write_Text(digit);

      //Carriage Return
    Delay_ms(1000);

  } while(1);
}

PC Based Digital Voltmeter Using PIC 16F877A

Saturday 13 October 2012
Voltmeter C# .Net PIC, Arduino, AVR






This is a simple voltmeter which measures 0-5V at a precision of 4.8 mV. This is a simple design using inbuilt ADC of PIC 16F877A. PIC 16F877A have 8 channel 10bit ADC.  This is a computer interfaced project. Measured voltage is output in serial interface software in computer. There is a serial interface circuit (MAX232) is necessary for interfacing with computer, which is not included in the circuit. Please check     PIC Serial Communication Tutorial (UART)  for the circuit and more details.





Using one of the most popular 8 bit PIC 16f877A, for instance, reading the datasheet, we'll find that the ADC modules (10 bit) are controlled by four different registers. The first two, ADCON0 and ADCON1, are used to set and start the ADC module. When high level language is used, the programmer doesn't need to care a lot of the register connected to the results because they are normally stored in a variable by a routine of the language itself (adc_read, for instance, using mikroc).

The ADCON0
As we can see this registers are 8 bit registers where.
- bit6 and bit 7 are used to set the frequency of the conversions.
- bits 3, 4 and 5 are used to select the pins of the microcontroller enabled to the adc conversions.
- bit 2 represents the status of the conversion procedure.
- bit 0 starts the conversion.


ADCON1










Regarding the second register, ADCON1, it must be set for two reasons: to select the format of the result value (bit 7), to select (bit0...bit3) the reference voltage and to set the port configuration control bits according to the following table





ADCON1








This circuit uses AN0 channel of ADC. The voltage conversion is employed in a logic, 16F877A have 10 bit ADC. That is, it can have 1024 levels. Reference voltage is fixed at
0 – 5 V Analog I/P is mapped to one of the 1024 levels (0-1023 Digital Count)
Resolution = 5/(1024)   (as it is 10 bit ADC)
= 5/1024
= 4.8828 mV   It  means that for a change in 4.8828mV, the binary output changes by 1.

ADC module of PIC Microcontroller converts the Signals on its analog pin to 10 bit binary data and it has software selectable high and low voltage reference input to some combination of VDD, VSS, RA2 and RA3. The analog input to PIC is limited to 0 to 5.


The converted value is in mV. It is then converted to volts and characters to send to serial port.
Normal hiperterminal application can be used for reception. Comments are given in program to easy understanding.

Click here for the PC program



PIC 16F877A Voltmeter

Code

/**********************************************/
/*
  
 http://www.facebook.com/EmbeddedProjects

 http://microcontrollerprojects00.blogspot.in/

 Author: Vishal K M

 uC:16F877A
 Compiler: mikroC
 Crystal freq: 4MHz


                                              */
/**********************************************/





unsigned long temp;
unsigned int i;
char digit[]="0.000-VOLTS ";

void main() {


TRISA=0xFF;

ADCON0=0x01;
ADCON1=0x0E;
UART1_Init(9600);               // Initialize UART module at 9600 bps
  Delay_ms(100);                  // Wait for UART module to stabilize
 
   UART1_Write_Text("Embedded Projects");
   UART1_Write(0x0D);

  do {
    temp = ADC_Read(0);   // Get 10-bit results of AD conversion
    temp=temp*5000/1023;   //Convert ADC value to mV
   
   

    digit[0]=(temp/1000)+48;
    digit[2]=((temp%1000)/100)+48;
    digit[3]=(((temp%1000)%100)/10)+48;
    digit[4]=(((temp%1000)%100)%10)+48;
   
    UART1_Write_Text(digit);

    UART1_Write(0x0D);   //Carriage Return
    Delay_ms(500);

  } while(1);
}
Copyright @ 2013 Arrogance Gizmo |

Follow Us On Facebook

Labels

.Net (2) 1 KM Range Wireless (1) 16x2 Character LCD (9) 2 UART (1) 4x3 Keypad (1) 4x4 keypad (1) 8051 (5) 8051 Project (2) 8051 Projects (1) 8051 Tutorial (3) 89C51 (4) 89C51 Project (2) 89S51 (1) 89S52 (1) Additional UART (1) Android (3) Android AVD (1) Android Programming Tutorial (1) Android Tutorial (2) Arduino Board (1) ARM Projects (1) Atiny (1) Atmega8 (1) AVR (5) AVR Projects (1) Build From Scratch (1) C# (1) C# Serial Port (2) C# serial Terminal (1) C# Voltmeter (1) Camera (1) Clock (1) Digital Voltmeter (2) Digital watch (1) DIY (2) EEPROM (2) Electronic code lock (1) Embedded (16) Embedded Project (9) Embedded Projects (2) Embedded Tutorial (12) Embeded (4) Extra UART (1) Flutter (1) Getting Started With Android (2) Home Security (1) Internet Based Device Control (1) Java of Things (1) Keypad (1) Keypad Tutorial (1) LCD (6) LCD Tutorial (4) Linux (1) Lock (1) LPG Sensor (1) MAX232 (3) Microcontroller (14) Microcontroller generates sound (1) Microcontroller Interrupt (1) Microcontroller Project (5) Microcontroller Tutorial (11) Microcontroller Tutorial. 8051 Tutorial (1) Mikoc 4 Bit LCD (3) MikroC (14) MikroC AVR (3) MikroC AVR Tutorial (3) MikroC EEPROM (2) MikroC for 8051 (4) MikroC Getting Started (1) MikroC PIC Tutorial (6) MikroC Tutorial (3) Motor Control (1) NETMF (1) New Embedded Boards (2) Optical Mouse (1) Optical Mouse To Camera (1) Password Lock (1) PC Based Voltmeter (1) PIC (7) PIC Based Electronic Lock (1) PIC 12F629 (1) PIC ADC (2) pic interrupt (1) PIC Music (1) pic project (1) PIC Projects (1) PIC sound melody (1) PIC Tutorial (3) PIC UART (1) PIC Voltmeter (2) Project (8) Quadcopter (1) Real Time Monitoring (1) RF (1) Robotic Projects (1) RS 232 (1) Run Android On PC (1) Security System (1) Serial Communication (3) Single Bord Computer (1) Smart home (1) Smart Home Project (1) STM32 (4) STM32F4 (3) STM32F4 Discovery (3) STM32F4 Project (1) STM32F4 Tutorials (3) STMicroelectronics (1) Temperature Sensor (2) Timer (1) Tutorial (8) UART (6) Udoo (1) USB (1) USB to RS 232 (1) USB to UART (1) VISUAL STUDIO (1) Water Level Control (1) WiFi (1)

Search This Blog

Popular Posts