Simple Current Sensor for Arduino and PIC

Last time I have posted a simple Current sensor for Arduino using only a resistor here in this post. But there are some problems on this kind of simple circuit and they are 1)  very lossy due to the big voltage drop on the resistor 2) if you decrease the voltage drop on the resistor, it will decrease the resolution 3) There is a significant voltage drop on the load at higher load current which is not good. The allegro current sensor ACS7xx series is a good alternative but it cost too much for my project so I search for another option.  Then I found this ZXCT1008 that is just right for my application.

Features:

  • Low cost
  • 1% accuracy
  • Up to 500mV sense voltage
  • 4uA quiescent current
  • 2.5V to 20V supply voltage
  • High side current sensing





About the Circuit

The circuit uses a ZXCT1008 high side current sensor monitor IC. Inside this IC is just a differential OPAMP that amplifies the voltage drop of the resistor current sensor.

Example Application

Rsense is a resistor for sensing current, ZXCT1008 can allow the Rsense to have a voltage drop up to 500mV. But for lower power loss, just use lower voltage drop, say 100mV.

For example we want to design a current sensor for solar charger with the following specs:

Max charge Current: 2A
Max solar Voltage: 19V
Max Vout: 5V

To compute for Rsense:
Rsense = (Vrsense)/Imax

where:
Vrsense – Voltage accross Rsense at Max charge current
Imax – Max charge current

Let’s use 100mV for Vrense for lower power loss and voltage drop:
Rsense = 100mV/2

Rsense = 0.05 ohm

Prsense = (2A^2)^0.05 ohm

Prsense =  0.2W (Note: always use double power to make sure it will not heat up too much, in this case use at least 0.5W resistor)

Rlim is optional and is only needed if the input voltage is greater than 20V. Since the input max is only 19V, we will not be needing the Rlim.

The output current at 100mV Rsense drop is 1mA so the output current can be computed as:

Iout = 0.01 * Vrsense

Compute for R:

R = Vout/(Vrsense*0.01)

For safety, we will just use 50% of the Max Voltage input of the Arduino’s analog input. This is to make room for the over current condition. You can use 70%  if you want. Maximum input voltage of arduino nano is 5V if you are using the VDD as a reference. This is different on other arduino, for example Arduino Due operates on 3.3V instead of 5V. Check the datasheet of the micrcontroller you are using.

R = 2.5V/(0.1 * 0.01)

R = 2.5k (use standard value 2.7K instead)



Final Circuit

Computing for output current on the Arduino:

First compute for the voltage output Vout:

Vout = ((ADC_value)/(ADC_max)) * ADC_reference

Derive Iout equation:

R = Vout/(Vrsense * 0.01)

Vrsense = Iout * Rsense

combine equation, you will get Iout:

Iout = (Vout)/(R * Rsense * 0.01)