DC Current Measurement Using Shunt Resistor

The method we are going to discuss in this portion is by using “shunt resistor” but this method has  limitations itself. The biggest one is we cannot measure the high currents through this method. In this method we apply a resistor in the series of load so that whole current should flow through the resistor and the voltage drop across the resistor will be directly proportional to current. I’ll illustrate this example with 8 watt load. The measurement will be done through the ATmega8 micro-controller which displays the results on computer through serial communication. To study about serial communication click the link below:

Serial Communication through Atmel AVR Micro-controllers

The resistors in markets are available in different wattages like ¼ watt, 2 watts, 5 watts etc which tells us the current bearing capacity of resistor. In DC voltage Measurement we can use any wattage of resistors for measurement because we apply resistor in parallel with load. But in current measurements we apply resistor in series and if apply a resistor of 2 watts and passed the 3 Amps with 12 volts, it will fry the resistor. So, you should carefully take care of wattage of the shunt resistor according to your load.

Some persons still prefer the use of shunt resistor in current measurement due to its low cost. But it is not a good choice because things get pretty messy and heat up at high currents.

DC current Measurement
Figure 1: Complete Circuit Diagram of Ammeter

The whole circuit diagram of the project is shown in the figure 1. There are two shunt resistors present in the circuit. The reason behind using two resistors is to increase the wattage and decrease the resistance of the shunt. Both resistors are of 0.1 ohm. If we apply resistor parallel formula then we will get 0.05 ohms. At a load of 1 ampere according to ohms law:-

V = I * R
 V = 1amp * 0.05 ohms
 V = 0.05 volts

0.05volts is basically the voltage drop across the shunt which can easily neglect. I used ATmega8 for the coding which I’ll explain later.  We will get 0.05 volts at 1 ampere but at milli-amperes even more less voltage drop will occur. This much less voltage is not possible to detect through the micro-controller. So I applied a difference amplifier to amplify the voltage as shown in the figure1. The variable resistor R1 is present here to set the reference voltage of the amplifier. It should be set in such a way that a reasonable voltage will generate at the output of the amplifier.


Components for DC Current Measurment
Figure 2: Components needed for the project

I used a 4Ah 12 volt battery as a voltage source and the load is two LED bulb of rating 3 watts and 5 watts. As my total load is 8 watts so I used two 5 watt shunt resistors in parallel which gave me 10 watts range for the load.

Breadboard Implementation of DC current Measurement
Figure 3: Implementation on bread board


Complete Setting for DC current Measurement
Figure 4: Whole System

Coding part:

As I told before that we will display our results on computer so I used UART registers of ATmega8.  To learn that how to communicate your micro-controller with computer study the links below:

We will not get much voltage at the output of amplifier due to small load so I used the internal reference voltage of the ADC which is 2.56 volts.

// initialize adc
void adc_init()
ADMUX = (1<<REFS0) | (1<<REFS1);  // To use the internal reference voltage 2.56volts
ADCSRA = (1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0); //Enabling ADC and setting prescalar

The function mentioned above is to initialize the ADC of micro-controller. ADMUX register is used to set the reference voltage. We have option to set externally the reference voltage which should be maximum of 5v.

// 10 Samples per second            
for (int j=0; j <= 9; j++) {
 v[i] = adc_read(0);
 volt = volt + v[i];

volt = volt /10; // to take the average of voltage
conv = (double)volt * 2.56/1024; //to convert the sample into voltage
// here 2.56 is the reference voltage

string_transmit("Current = "); // Transmitting to the computer

The above code is to get the 10 samples  of voltage at the output of the amplifier.

Results on Putty
Figure 5: Final results on putty

To download the whole code click the button below:

Complete Code



If you need any help regarding code or circuit feel free to contact us and don’t forget to like our facebook page 🙂

Want something more to learn?


Electrical engineering is my profession, my hobby and my passion. I completed bachelors of electrical engineering in 2015. Currently I am working with a utility company which provides electricity to its consumers. Power Electronics, Embedded Systems and Energy Metering are my fields of specialization. In free time I listen music and watch movies.

What do you think?