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 ⚠️

Working with electricity involves serious risk. Ensure you have the necessary skills and take proper safety precautions before attempting any electrical projects. Proceed at your own risk — the author assumes no responsibility for any damage, injury, or issues resulting from the use or misuse of the information provided.

Advertisements

All content on this website is original and protected by copyright. Please do not copy or reproduce content without permission. While most of the resources shared here are open-source and freely accessible for your learning and benefit, your respect for our intellectual effort is appreciated.

If you find our tutorials helpful, consider supporting us by purchasing related materials or sharing our work — it helps keep the content flowing.

Need help or have questions? Leave a comment below — the author is always happy to assist!

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!

Liked this article? Subscribe to our newsletter:

Loading

or,

Visit LabProjectsBD.com for more inspiring projects and tutorials.

Thank you!

Check this out: 5 coolest multimeters you can buy


MKDas

Mithun K. Das. B.Sc. in Electrical and Electronic Engineering (EEE) from KUET. Senior Embedded Systems Designer at a leading international company. Welcome to my personal blog! I share articles on various electronics topics, breaking them down into simple and easy-to-understand explanations, especially for beginners. My goal is to make learning electronics accessible and enjoyable for everyone. If you have any questions or need further assistance, feel free to reach out through the Contact Us page. Thank you for visiting, and happy learning!

4 Comments

Abhinav · 20/09/2020 at 6:51 am

What is the maximum Ampere it can show??

    Mithun K. Das · 20/09/2020 at 7:15 am

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

Djalltra · 18/05/2022 at 8:25 pm

Hello even reading through all the tutorials I still can’t work out how you arrived at 1.7857 factor for instance let’s say I want to measure currents of up to 10A for a battery charger and I do not know the battery load resistance. How do I go about calculating my factor I understand I have to keep my gain small so as not to exceed the microcontroller adc voltage,I tried to apply the formula to get the factor in you code but I’m getting something else.

    MKDas · 18/05/2022 at 8:52 pm

    Check the other article as the basic Then you’ll understand.

Leave a Reply

Avatar placeholder

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