Let’s make an Ammeter. Yes, in this article we are going to make an Ammeter for DC circuits. After reading this article you’ll be able to make one for yourself too. I hope it will help you a lot. So let’s start our DC Ammeter with PIC16F73 microcontroller.

Disclaimer: Electricity is always dangerous. Proper skill is required to work with electricity. Do work at your own risk. The author will not be responsible for any misuse or harmful act or any mistake you make. The contents of this website are unique and copyright protected. Kindly don’t do any nonsensical act copying and claiming it as yours. Most of the articles published here are kept as open-source to help you. Take the knowledge for free and use it, but if you are interested you can buy the ready resources offered here. If you need any help or guide feel free to comment below, the author will try to help you. Thanks.

What is an Ammeter?

An ammeter is a measuring instrument used to measure the current in a circuit. Electric currents are measured in amperes, hence the name. Instruments used to measure smaller currents, in the milliampere or microcomputer range, are designated as milliammeters or microammeters. _Wiki.

Simply it is an Ampere meter. Like our voltmeter, it can be both analog or digital type.

DC Ammeter with PIC16F73
An analog ammeter

Although it is very common to find an analog ammeter, here we are going to make our own digital Ammeter.

Working mechanism of a DC Ammeter:

Keep in mind that, we can not use current reading directly in any circuit or components. All we need to convert the current signal into a voltage signal first then we can use that signal for any purpose.

In Ampere meters, a shunt resistance is used. When current flows through that shunt resistance, a voltage is generated across that shunt resistance according to the equation, V=IR.

You should read this: DC Current measurement using Shunt resistor and Op-Amp Circuit

Sensing circuit of DC current:

For the DC ammeter, we can use a shunt resistor if the current rating is low. Depending on the position of this shunt resistor, the sensing circuit will be different.

current sensing circuit
Configuration 1: Low side shunt resistor based sensing circuit
current sensing circuit
Configuration 2: High side shunt resistor based sensing circuit

In both of the cases, the load current will be:

I = Op-Amp Output/(Gain x Rshunt)

We can use any configuration from these two in our Ammeter. All we need to do is sensing the output voltage of Op-Amp and print that on display.

DC Ammeter with PIC16F73 circuit diagram with Low side shunt resistor:

Here is the circuit diagram of our DC Ammeter with PIC16F73.

DC Ammeter with PIC16F73
Circuit diagram with a low side shunt resistor

Coding with mikroC pro for PIC for Low side shunt resistor based Ammeter:

/*******************************************************************************
* Program for "DC Ammeter with PIC16F73"                                       *
* Program written by_ Engr. Mithun K. Das                                      *
* MCU:PIC16F73; X-Tal:8MHz; mikroC pro for PIC v7.6.0                          *
* Date:09-05-2020                                                              *
*******************************************************************************/
char segment_array[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};//cmmon cathode_non dot

sbit digit0 at RC0_bit;
sbit digit1 at RC1_bit;
sbit digit2 at RC2_bit;
sbit digit3 at RC3_bit;

char digits[5];
void display_7segment(int number)
{
   digits[3]=number/1000u;
   digits[2]=(number/100u)%10u;
   digits[1]=(number/10u)%10u;
   digits[0]=(number/1u)%10u;
}

void InitTimer0()
{
  OPTION_REG     = 0x85;
  TMR0           = 100;
  INTCON         = 0xA0;
}

int position=0;
void Interrupt() iv 0x0004 ics ICS_AUTO
{
  if (TMR0IF_bit)
  {
    TMR0IF_bit   = 0;
    TMR0         = 100;

    digit0 = 1;
    digit1 = 1;
    digit2 = 1;
    digit3 = 1;
    if(position>3)position=0;

    if(position==2)PORTB = segment_array[digits[position]]+128; //dot point
    else PORTB = segment_array[digits[position]];

    if(position==3)
    {
        digit0 = 0;
        digit1 = 1;
        digit2 = 1;
        digit3 = 1;
    }
    else if(position==2)
    {
        digit0 = 1;
        digit1 = 0;
        digit2 = 1;
        digit3 = 1;
    }
    else if(position==1)
    {
        digit0 = 1;
        digit1 = 1;
        digit2 = 0;
        digit3 = 1;
    }
    else if(position==0)
    {
        digit0 = 1;
        digit1 = 1;
        digit2 = 1;
        digit3 = 0;
    }
    position++;
  }
}



unsigned long adc_rd0=0;
unsigned int dc_amps=0;
int k=0;
void main()
{
 TRISA=0xFF;//all in
 TRISB=0x00;//all output
 TRISC=0x00;//all output
 PORTB=0x00;
 PORTC=0x00;//clear ports
 ADCON1=0x00;//all analog in
 InitTimer0();//5ms timer
 while(1)
 {
      ADCON0 = 0b00000001;//select AN0
      adc_rd0 = 0;//clear data
      for(k=0;k<10;k++)
      {
         adc_rd0+=ADC_Read(0)*1.7857;
         Delay_ms(10);
      }
      adc_rd0/=10;
      dc_amps = adc_rd0;

      display_7segment(dc_amps);
 }
}//

Here, we used our previous voltmeter code and modified it a little bit to make our DC Ammeter. You can check my other article as the basic.

How to make a DC voltmeter using 7-segment & PIC16F73‘.

Test result with low side shunt resistor:

Test result with Low side shunt resistor

Ammeter circuit diagram with High side shunt resistor:

DC Ammeter with PIC16F73
High side shunt resistor based ammeter circuit diagram

Coding with mikroC pro for PIC for High side shunt resistor based Ammeter:

/*******************************************************************************
* Program for "DC Ammeter with PIC16F73"                                       *
* Program written by_ Engr. Mithun K. Das                                      *
* MCU:PIC16F73; X-Tal:8MHz; mikroC pro for PIC v7.6.0                          *
* Date:09-05-2020                                                              *
*******************************************************************************/
char segment_array[]={0x3F,0x06,0x5B,0x4F,0x66,0x6D,0x7D,0x07,0x7F,0x6F};//cmmon cathode_non dot

sbit digit0 at RC0_bit;
sbit digit1 at RC1_bit;
sbit digit2 at RC2_bit;
sbit digit3 at RC3_bit;

char digits[5];
void display_7segment(int number)
{
   digits[3]=number/1000u;
   digits[2]=(number/100u)%10u;
   digits[1]=(number/10u)%10u;
   digits[0]=(number/1u)%10u;
}

void InitTimer0()
{
  OPTION_REG     = 0x85;
  TMR0           = 100;
  INTCON         = 0xA0;
}

int position=0;
void Interrupt() iv 0x0004 ics ICS_AUTO
{
  if (TMR0IF_bit)
  {
    TMR0IF_bit   = 0;
    TMR0         = 100;

    digit0 = 1;
    digit1 = 1;
    digit2 = 1;
    digit3 = 1;
    if(position>3)position=0;

    if(position==2)PORTB = segment_array[digits[position]]+128; //dot point
    else PORTB = segment_array[digits[position]];

    if(position==3)
    {
        digit0 = 0;
        digit1 = 1;
        digit2 = 1;
        digit3 = 1;
    }
    else if(position==2)
    {
        digit0 = 1;
        digit1 = 0;
        digit2 = 1;
        digit3 = 1;
    }
    else if(position==1)
    {
        digit0 = 1;
        digit1 = 1;
        digit2 = 0;
        digit3 = 1;
    }
    else if(position==0)
    {
        digit0 = 1;
        digit1 = 1;
        digit2 = 1;
        digit3 = 0;
    }
    position++;
  }
}



unsigned long adc_rd0=0;
unsigned int dc_amps=0;
int k=0;
void main()
{
 TRISA=0xFF;//all in
 TRISB=0x00;//all output
 TRISC=0x00;//all output
 PORTB=0x00;
 PORTC=0x00;//clear ports
 ADCON1=0x00;//all analog in
 InitTimer0();//5ms timer
 while(1)
 {
      ADCON0 = 0b00000001;//select AN0
      adc_rd0 = 0;//clear data
      for(k=0;k<10;k++)
      {
         adc_rd0+=ADC_Read(0)*0.8884;
         Delay_ms(10);
      }
      adc_rd0/=10;
      dc_amps = adc_rd0;

      display_7segment(dc_amps);
 }
}//

Test result with High side shunt resistor based Ammeter:

Test result with High side shunt resistor

Summarizing:

We have seen two types of shunt resistor-based DC ammeter designs. Now, you can be able to make anyone for you as per your requirement. In two types, the code is almost the same. Just the value of constant is different as the gain is different in two types of circuits. If you need to measure higher current, use a suitable shunt resistor then design the Op-Amp circuit.

Shunt resistor selection is very important in this circuit. You should not lose too much power across the shunt resistor. Otherwise, it will burn and will affect the total current flow.

Tips: Sometimes, you can use the PCB truck as a shunt resistor. In that case, design the op-amp circuit then gradually increase the gain. Once you start getting good output, set the gain in a suitable range. After that, simply use the coding.

I hope, you have enjoyed this article and this article will be very helpful to you. Now make one ammeter for yourself and share your experience here in the comments section. If you need any help, let me know that. Thank you, Enjoy!

Loading

JLCPCB – Only $2 for PCB Prototype (Any Color)

24 Hours fast turnaround, Excellent quality & Unbeatable prices

$18 Welcome Bonus for new registrations Now!!! https://jlcpcb.com


Check this out: 5 coolest multimeters you can buy


MKDas

I'm Mithun from Bangladesh. Electronics is my passion, love to work with electronics. This is my personal blog. Besides my regular works, I write some articles here. Most of them are open-source and everything is presented in the easiest way so that anyone can understand and learn it. Thanks.

2 Comments

Abhinav · September 20, 2020 at 6:51 am

What is the maximum Ampere it can show??

    Mithun K. Das · September 20, 2020 at 7:15 am

    You can get different ranges using this concept. If you understand the concept, then design as you need.

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *