Digital Ammeter Circuit Diagram Using Microcontroller
“Digital Ammeter” is actually designed for dc current measure. In the project “digital ammeter circuit diagram using micro-controller”, you will get to know how we can measure dc-current using pic micro-controller? how to convert current into voltage from using the shunt-resistor? how to design low resistance shunt-resistor using simple wire? How we can display current value on LCD. Digital AC-Ammeter can also be designed using the pic micro-controller. Digital-Ammeter circuit project has many applications in electronics & power electronics projects. Current measurement is also used in micro-controller based projects for over & under current protection in circuits. Other than this application, it can be used as digital Ammeter circuit for current measurement in the electronics experiments.
Digital ammeter circuit diagram using pic micro-controller (Schematic):
Digital Ammeter Circuit Diagram Using Microcontroller is given below. In this schematic, 30 volt dc source is applied to 40ohm load. Current passing through this load can be measured with the help of shunt-resistor & PIC16F877A micro-controller. Now the question is that why the shunt-resistor is needed to measure current?
Why we need shunt-resistor?
Micro-controllers or any micro-computer system can’t read current directly. Micro-controllers can only sense voltage. Micro-controllers’ logic (high & low) is also based on voltage level. That is why, micro-controllers don’t sense the current directly. Therefore, we need the current in voltage form. The shunt-resistor can be used to convert current into voltage form. When the current passes through shunt-resistor, voltage appears across shunt-resistor. This voltage can be easily measured with the help of analog to digital converter channel of PIC16F877A micro-controller. This voltage (measured) value can be then converted back into current in programming using ohm’s law formula:
V = IR;
The shunt-resistor’s value is known & voltage is measured with pic micro-controller. So current can be easily calculated with the help of Ohm’s law formula.
I = V/R
In this digital-ammeter circuit project, 0.47 ohm shunt-resistor is used. Now you must be amazed how to design this low-resistance value-resistor? The simplest solution to this problem is to take a piece of wire & makes it few turn. After making few turns, measure its resistance with the help of ohm meter. You can easily design .47 ohm resistor with the help of simple wire. It is a hit & trail method. Keep trying until you succeed to get a value close to .47 ohm. Other option is to used hall effect current sensor which converts current into voltage directly. Magnitude of voltage depends on magnitude of current.
100K ohm resistor at the input of analog to digital converter is used to protect micro-controller from high current. because current follows a low resistance path. If you don’t use any resistor there, the current will start to flow towards micro-controller instead of shunt-resistor. It will then damage micro-controller permanently. 1N4733A zener diode is used to protect micro-controller from over voltage appearing across it. Because voltage more than 5 volt may damage micro-controller permanently. LCD is interfaced with PIC16F877A micro-controller to display current value. If you don’t know how to interface LCD with PIC16F877A micro-controller, check following article first:
- LCD interfacing with PIC16F877A micro-controller
Video lecture on Ammeter design & code
Program for digital ammeter circuit using pic microcontroller:
Now lets discuss how to write code for digital ammeter using pic micro-controller? program for digital Ammeter is written using Mikro C pro compiler for pic. It is very easy to use to compiler for pic micro-controller. It has huge arrangement of libraries which makes micro-chip micro-controller simple to utilize.
Following programming directions characterize that LCD is associated with PORTB of PIC16F877A micro-controller. PORTB is used to send data to LCD. These are simple lines like an english sentences, tell micro-controller that LCD is connected to PORTB pins & these lines also specified the pin numbers as shown in figure below:
Complete code for digital ammeter circuit diagram using microcontroller is below. In this code TRISA is used to define port A as input because voltage is measured with pin number AN0 of port A. TRISB instructions defines PORTB as an output PORT. It is used to send data to LCD. LCD_Init() funtion initialize LCD libraries and ADC_Init() initialized ADC libraries functions. “current = ADC_Read(0); “statement used to read voltage across shunt-resistor & “current = (current * 4.89 )/ (0.47); ” statement converts voltage back into current according to ohms law formula. Rest all the lines in below given code is self explanatory, but if you still need any help. You are welcome to comment on this post.Read Also>> Simple Digital LED Ammeter Using ICL7107