Digital Ammeter using Arduino. How To?

Programming, Tutorial, Coding, New Design, and/or any project for your Arduino and Raspberry Pi can post your topic /suggestion here.
User avatar
dondon pramis
Location: Philippines
Posts: 54
Joined: Sun Feb 12, 2017 8:28 am

Digital Ammeter using Arduino. How To?

Sun Jun 24, 2018 3:56 pm

arduino-based-digital-ammeter.jpg (24.69 KiB) Viewed 1138 times
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 (Ω).

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.

Required Components:
Arduino Uno.
Resistor 22Ω.
LCD 16x2.
10K pot.
Jumper cables.

Circuit Diagram and Connections:
The schematic diagram of the Arduino Ammeter Project is follows
The schematic diagram shows the connection of the Arduino Uno with LCD, resistor and LED. Arduino Uno is the power source of 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.jpg (52.91 KiB) Viewed 1138 times
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

The voltage value from the ADC of Arduino 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);
The Complete Code for this Project:

Code: Select all

LiquidCrystal lcd (7,8,9,10,11,12);
void setup() {
// put your setup code here, to run once:
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);
 lcd.print("current value=");
 lcd.print (current_value);



In total there are 6 users online :: 1 registered, 0 hidden and 5 guests
Registered users: Bing [Bot]
Most users ever online was 19 on Mon May 20, 2019 11:06 pm
Total posts 527
Total topics 406
Total members 73
Our newest member Kelly
No birthdays today