Arduino Based Digital Ammeter

Published  September 20, 2017   9
Arduino based Digital Ammeter

Ammeter is used to measure current flow through any load or device. Here in this Arduino Ammeter, we will explain about measuring of current by using ohm’s law. It will be quite interesting as well as a good application of basic science that we studied in our school days.

All of us are well known of ohm’s law, It states that “the potential difference between two poles or terminals of an conductor is directly proportional  to the amount of current pass through the same conductor” for constant of proportionality we use resistance, so here it comes the equation of ohm’s law.

V = IR

  • V = voltage across the conductor in Volt (v).
  • I = current pass through the conductor in Ampere (A).
  • R = resistance constant of proportionality in Ohm (Ω).

In order to find the current pass through the device we just rearrange the equation as below, or we can calculate with ohm's law calculator.

I = V / R

 

So in order to find out the current, we need some data:

  1. Voltage
  2. Resistance

We are going to build a series resistance along with the device. As we need to find voltage drop across the device, for that we need voltage readings before and after the voltage drop, that is possible in the resistance because of no polarity.

calculating current using ohms law

Like in the above diagram, we have to find the two voltages that are flowing across the resistor. The difference between the voltages (V1-V2) at the two ends of resistors gives us voltage drop across the resistor (R) and we divide the voltage drop by the resistor value we get the current flow (I) through the device. That is how we can calculate the Current value passing through it, let’s gets into it practical implementation.

 

Required Components:

  • Arduino Uno.
  • Resistor 22Ω.
  • LCD 16x2.
  • LED.
  • 10K pot.
  • Breadboard.
  • Multimeter.
  • Jumper cables.

components for arduino based digital ammeter

 

Circuit Diagram and Connections:

The schematic diagram of the Arduino Ammeter Project is follows

arduino based digital ammeter circuit diagram

The schematic diagram shows the connection of the Arduino Uno with 16x2 LCD, resistor and LED. Arduino Uno is the power source for the all other components.

The Arduino has analog and digital pins. The sensor circuit is connected to the analog inputs from which we get value of the voltage. The LCD is connect with the digital pins (7,8,9,10,11,12).

The LCD has 16 pins the first two pins (VSS,VDD) and last two pins(Anode, Cathode) are connected to the gnd and 5v. The reset (RS) and enable (E) pins are connected to the Arduino digital pins 7 and 8. The data pins D4-D7 are connected to the digital pins of Arduino (9,10,11,12). The V0 pin is connected to the middle pin of pot. The red and black wires are 5v and gnd.

meauring current using arduino digital ammeter

 

Current Sensing Circuit:

This Ammeter circuit consists resistor and LED as load. Resistor is connected in series to the LED that current flows through the load and voltage drops is determined from the resistor. The terminal V1, V2 are going to connect with the analog input of the Arduino.

In the ADC of Arduino that coverts the voltage into 10 bit resolution numbers from 0-1023. So we need to covert it in voltage value using the programming. Before that we need to know the minimal voltage that ADC of Arduino can detect, that value is 4.88mV. We multiply the value from ADC with the 4.88mV and we get the actual voltage into the ADC. Learn more about the ADC of Arduino here.

arduino based digital ammeter testing

 

Calculations:

The voltage value from the Arduino ADC is ranges between 0-1023 and the reference voltage is ranges between 0-5v.

For example:

The value of the V1= 710, V2= 474 and R=22Ω, the difference between the voltages are 236. We convert it into voltage by multiply with 0.00488, then we get 1.15v. So the Voltage difference is 1.15v, by dividing it by 22 here we get the current value 0.005A. Here we have used the low value 22ohm resistor as current sensor. This is how we can measure the current using Arduino.

 

Arduino Code:

Complete code for arduino based ammeter to measure current, is given at the end of this article.

Arduino programming is almost same as like c programming, first we declare the header files. The header files call the file in the storage, like for the calculation I get the voltage values by using analogread function.

int voltage_value0 = analogRead(A0);
int voltage_value1 = analogRead(A1);

 

A temporary float variable is declared for holding voltage value like float temp_val. The value is multiplied with 0.00488 to get actual voltage difference then it is divided by resistor value to find the current flow. 0.00488v is the minimal voltage that the ADC of Arduino can detect.

int subraction_value =(voltage_value0 - voltage_value1) ;
float temp_val = (subraction_value*0.00488);
float current_value = (temp_val/22);

 

Check the full demonstration Video below. You can also check the Arduino Digital Voltmeter.

Code
#include<LiquidCrystal.h>
LiquidCrystal lcd (7,8,9,10,11,12);
 
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
lcd.begin(16,2);
lcd.clear();
}
 
void loop() {
// put your main code here, to run repeatedly:
int voltage_value0 = analogRead(A0);
int voltage_value1 = analogRead(A1);
 
 int subraction_value =(voltage_value0 - voltage_value1) ;
 float temp_val = (subraction_value*0.00488);
 
 float current_value = (temp_val/22);
 Serial.print(current_value);
 lcd.setCursor(0,0);
 lcd.print("current value=");
 lcd.setCursor(0,1);
 lcd.print (current_value);
 lcd.print("A");
 delay(1000);
}
Video

Have any question realated to this Article?

Ask Our Community Members

Comments

Submitted by Alien on Thu, 09/21/2017 - 15:23

Permalink

Some powerful led you have there! Drawing 2Amp? Ridiculous! Maybe if you test it with good multimeter...
Also, the 0.08 amp on your lcd display .... tooooo much for led. Way too much!
By the way, to test if your multimeter leads are good or not, switch your multimeter to resistance measurement, to the lowest possible value, and then put the 2 leads together and see what the multimeter displays. If it's a value of more than 5 ohm, your leads are bad and will cause wrong measurements. For example, a battery that has 1.2V with good multimeter will show 1.3 or 1.4 with a bad one. I am telling you this only because in the video, your multimeter is one of the cheapest with bad leads. DT830D is produced by many company - actually, it's produced in China and sold to whoever wants to put his name on it. It comes in yellow and black. Maybe just the test leads are of poor design, don't know since I never bought them, but did tested the leads and they show 1 ohm which is bad. Good leads are in the range of 0.1 ohm.

Submitted by AMAL MOHAN on Thu, 09/06/2018 - 12:06

Permalink

sir,
i need specifications like sensitivity, range of this circuit etc.