Introduction: Arduino Ampermeter (ZXCT IC's)

About: I like Electronics, Robots and Arduino!

In this article, I will use the current monitor based on the ZXCT series IC for measuring current voltage and watts.

Part list:
Arduino-compability board
High side current sense monitor ZXCT1010 (Datasheet)
0.1R 1W 1% shunt resistor
1K resistor
2.4K resistor
500R Trimmer Potentiometer
Nokia 5110 (optional)
Plastic enclosure (optional)

Step 1: Theory

In my task needed measure the load current of not more than 2A, the range of 200 mA to 1.5 A. Load power supply voltage: 12 volts.

Voltage drop across the shunt with a maximum load current of 2A: Vsense = RS * ILOAD, where RS - resistance of the shunt, ILOAD- the load current. Vsense = 0.1 * 2 = 0.2V.

Heat loss in the shunt with a load of 2A amount: PD = I2R = 22 * 0.1 = 0.4 Watts.

IC output current: Iout(max) = Gt x Vsense(max), for ZXCT1010 value Gt is 0.01. Therefore Iout(max) = 0.01 * 0.2 = 0.002 A.

Calculate the resistance at maximum load current of 2A. RG = Vout / Iout = 5 V / 0.002 A = 2500 kOhm. The closest value of the resistor: 2.4K. For given value the output voltage of the IC is: Vout = RG * Iout = 2400 * 0.002 = 4.8 V.

If the resistance RG = 2.4K and the minimum current of load will be 200 mA, the voltage from the IC is: Vout = RG * (Gt * RS * ILOAD) = 2400 * (0.01 * 0.1 *0.2) = 0.48 V. Thus with a load current of 200 mA, the voltage supplied to the ADC is 0.48V, when the load current of 2 A, respectively, 4.8V.

To measure the voltage used voltage divider. To get the output voltage of 4V with 12V input, we use the calculator voltage divider, divider values to be 1K and 500 Ohms.

Step 2: Assembly

The scheme is connected between power supply and the load of the High-side. For package SOT23-5, I used the adapters that are bought on ebay

The output "voltage" of the circuit connect to pin A0 Arduino board. The output "current" of the circuit connect to pin A1 Arduino board



Source Code:
// Article http://english.cxem.net/arduino/arduino7.php

#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

#define VoltPin A0  // Voltage pin
#define CurrPin A1  // Current pin

float kVD = 5;  // Divider Ratio
float kI = 1;   // Current Ratio - value of Rg resistor

// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);

int VoltageValue;
int CurrentValue;
float voltage;
float current;

void setup()   {
  display.begin();
  display.setContrast(40);
  delay(1000);
  display.clearDisplay();     // clears the screen and buffer
  display.setTextSize(1);     // set text size
  display.setTextColor(BLACK);
  delay(1000);
}

void loop() {
  VoltageValue = analogRead(VoltPin);
  CurrentValue = analogRead(CurrPin);
  voltage = VoltageValue * (5.0 / 1023.0) * kVD;    // voltage calculation
  current = (CurrentValue * (5.0 / 1023.0)) / kI;   // current calculation

  display.clearDisplay();              // clears the screen and buffer
  display.setCursor(0,0);

  display.print("Voltage=");
  display.println(voltage);
  display.println();

  display.print("Current=");
  display.println(current);
  display.println(); 

  display.print("Power=");
  display.println(current * voltage);  // power calculation

  display.display();

  delay(500);
}
Arduino Contest

Participated in the
Arduino Contest