Welcome to Solarduino , A blog about DIY Solar PV and Arduino projects

How to measure DC and AC current using HSTS016L Hall Effect Current Transformer

Arduino Starter Kit

It is a complete set which include most of the components you need to start Arduino Projects. Kindly support us by grabbing one set at our affiliate link here !!!

Today’s blog is about how to use HSTS016L Hall Effect Current Transformer to measure AC and DC current. As you may know, standard Current Transformer (CT) is a step down transformer used to measure high AC current flow without needing physical connection or any modification wiring to the measurement circuit. Typical Current Transformer has an output of 5A rating but it is not suitable to be used in Arduino Micro Controller which requires voltage as output measurement. Standard Current Transformer is also unable to measure DC current as transformer works with the principal of induced current due to electromagnetic changes. However, Current Transformer is very important sensor especially dealing with dangerous and high voltage AC circuit.

As to measure DC current, typically Hall Effect module such as ACS712 module is commonly used in Arduino Micro Controller. The module has output measurement value of less than 5V which is suitable to be applied in Arduino DIY projects. Although ACS712 module is relatively cheap, it requires physical connection to the measurement circuit making it only suitable for DC electronic projects but not suitable to be used in AC circuit. 

By mixing up the Hall Effect and Current Transformer, we have a sensor called Hall Effect Current Transformer which physically looks like a standard Current Transformer but internally it utilizes Hall Effect measurement component. YHDC has a model called HSTS016L and able to measure current values ranges from 10A up to 200A. With split core current sensor type, not alteration on the existing system required and we can open and close the CT to put the measurement cable inside the CT with just its clip. The output voltage of this sensor is 2.5V +/- 0.625V with decent accuracy. Although the sensor has voltage output range within 1.875V to 3.125V,  it is also suitable for 3.3V analog sensor especially for Arduino Nano and NodeMCU micro controller.

This is the Hall-Effect Split-Core Sensor HSTS016L module. The model ranges from 10A up to 200A. With split core current sensor type, not alteration on the existing system required. You can get it via our affiliate link here !!! The output voltage of this sensor is 2.5V +/- 0.625V with decent accuracy. I highly recommend this sensor for measuring AC & DC current.

Warning ! You are now dealing with high power source ! We assumed that you have the basic electrical knowledge and know what you are dealing with. You may need guidance from experienced guys if you are new to electrical work. Safety and Precaution must be always have in mind. We shall not be responsible for anything happening to you.

Arduino UNO (compatible board)

If you still not yet own an Arduino Micro-controller Board, you can get it cheap at our affiliate link here !!!

Although the sensor is slightly expensive, the main advantage of the sensor is it support AC and DC current measurement. It can measure 2 direction of current flow while using the same sensor can measure AC and DC current values. In this project, we will be using only 1 Hall Effect Current Transformer to measure AC and DC current using Arduino UNO and display on the LCD Shield.

The sensor has 4 output pins: RED (5V input), BLACK (0V Gnd), YELLOW (Analog Output), and WHITE (Analog for Calibration). Sometimes the supply voltage may not be exact 5V thus we will need additional Analog Pin to measure the exact middle point from the White Pin. For Arduino UNO, there are 6 analog input pins (A0-A5) where we can use one of the pins to measure AC current and 1 more to use for calibration purpose. The analog input pins will map input voltages between 0 and 5V into integer values between 0 and 1023 with resolution of 4.9mV per unit (5.00V / 1023 units). 

For this project, we will be connecting Red to 5V input, Black to Ground, Yellow to Analog Pin A1, and White to Analog Pin A2. It is highly recommended to power Arduino Uno and the sensor using 12V power adapter. Using 5V power supply via USB will have initial deviation value which you may need to manually add the offset value during code uploading. 

I recommend you to add a 16X2 LCD Display Shield which can be directly fit on to the top of the Arduino board without the need of extra wiring for the LCD Display. Without the LCD Display, you can only monitor the measured current value on PC via Serial Monitor. You can get the LCD Display board at our affiliate link here !!!. 

Our code is designed to display a value which is derived from averaging 1500 samples in nearly a second. Each sample is recorded every 500 micro second (0.0005 second). Technically 1 complete cycle of AC current that operating at 50Hz can have 40 sample readings. Each single sample value is being measured and squared individually and once the 1500 sample values are accumulated, the average value from the 1500 samples is then being square-rooted in order to come out the RMS current value which is to be displayed at Serial Monitor and LCD Display.

RMS value is more accurate compared to just averaging for DC current measurement. Besides, RMS value allows us to measure AC current at the same time. To prevent initial ghost value, the code has offset any current less than 1% of the sensor. For example, if you use a 50A sensor, any values lower than 0.5A will become 0.0A automatically. If you want to use to measure small current, kindly select smaller current rating.

Technically 500 micro second for 1500 samples only requires 0.8 seconds per value. However, the micro-controller processing will be slowed down from 0.8 second to nearly 1 second thus this setting is suitable for a 1 second display value duration while providing high accuracy for AC current waveform. RMS value for AC and DC current are equivalent thus same program code and sensor can be used to measure either AC and DC current. 

Previous posts I was using LCD button to initially offset the setting because I have neglected the White Calibration Pin. In this project, we will be using the White Pin to calibrate the initial offset thus no button is needed to be pressed upon startup. However, additional Analog Pin for calibration is required compared to my previous method on previous post.

Screw Shield / Expansion Shield

When there are a lot of wiring around, sharing pins will be difficult as existing pins (ground and 5V) are limited. This shield provides a lot of convenient terminals for each of the input and output pins. The shield can be mounted directly on top of the Arduino Uno board or in between the shields which made it very convenient to use. You can get it at our affiliate link here !!!

Ferrule Lugs and Crimper Set

Ferrule lugs are used at terminals for tight and secure connection. Besides, it also prevent stranded cables accidentally touching adjacent power line that may cause short circuit. Grab 1 at our affiliate link here !!!

Before we end, we would like to give gratitude to you for taking the time to read the post. We would need readers like you to support us in order to keep growing. You can support us in the following ways :

Donate & Fund Raising

If you like my work, please send me a donation to encourage me to do more. Thanks


Aliexpress Affiliate

We are the member of Aliexpress affiliate marketing. Do support us by clicking the affiliate product links if you do wish to purchase them.

Like and Share

If you like our post, we need your support to like and share our posts or videos so that it can reach more and more people like you !!

Terminals Crimping Plier Set

This is a crimping tool with interchangeable jaw for crimping many types of terminals. It is a must have for DIY electronic and electrical for professional installation work. You may choose at out affiliate link here !!!

AC & DC Current using HSTS016L Hall Effect CT.ino

2 thoughts on “How to measure DC and AC current using HSTS016L Hall Effect Current Transformer

  1. Hi,
    For the HSTS016L Hall Effect Current Transformer, are there any changes for the AC and DC code?
    Thank you

Comments are closed.