Non-contact Direct Current Measuring from a Solar System With a HALL-sensor

DC Current measure with Arduino

The solar energy system at my house delivers all the energy back to the electricity grid. In the Netherlands you will receive money back from the energy company for this. On the one hand because this is only a small amount per kW and because it is expected that this return payment will stop, the idea is to use the generated energy yourself.
The problem with using it yourself is that electrical energy is there when it is not so needed, namely during the day. So we have to find something to store electrical energy. You can do this with batteries, but that is very expensive to purchase. It can also be done by heating water in a boiler and using that water at a time of your choice.
I chose this option.

The boiler is a so-called flow boiler. That is to say, when you tap hot water, cold water flows back into the other side.
The boiler is included in a central heating system, which works on natural gas and which has tap water option. The installation is designed in such a way that if there is no or insufficient hot water in the boiler, the water is heated by the central heating installation.
In other words, even if the sun does not provide enough energy, there is enough hot water. In my case, I use the hot water for shower.

My solar energy system is of the type SolarEdge SE4000H. The important data for the project are:
Max DC voltage 480 Vdc
Operating voltage Range 270 – 480Vdc
Max input current 11.5 Ampdc
Max output power 4000VAac
Installed solar energy is 4.5 kW peak

User experience is that of the 4.5kW peak installed power we generate a maximum of 3.5kW.

A warning is in order here !! Direct current is a very dangerous type of current. Although the danger of electrocution is many times lower than with alternating current, it can cause a fire much easier. A slight corrosion on the link or bridging contacts can be sufficient for disintegration and eventual fire. It is very important to have your installation checked regularly by a professional !!

The above was also the reason to measure the direct current generated by the solar cells without contact.

How the system works
My boiler has a consumption of 800 W. This means a current of about 3.5 Amp. At DC level this will be about 4 Amp if you take into account conversion loss. So what we want is to determine a direct current of about 4 Amp or higher and let switch a relay on it. They relay is used to switch the boiler element “on”. This prevents the boiler from being switched “on” when there is too little sun. In the Netherlands, electricity per Kwh is 3.5 times as expensive as the equivalent of gas. Hence this exercise.
And ofcourse that need to be done contactless for the aforementioned reason.

There are four mainparts of design:
+ The Hall-sensor (HSTS16L20A)
+ The Display voor result (WC1602A 2 rows 16 Charachters)
+ The central processing unit (Arduino Nano V3)
+ Relay and control (Arduino module HW-307)

One possibility to measuremend contactless is to do this is by using a HALL sensor.
Fortunately, there is also a HALL-effect sensor type with split core transformer that can do the job (as picture on right). It is the Hall-Effect Split-Core Sensor HSTS16L module. With split core current sensor type, not alteration on the existing system is required. In our case, we use the HALL sensor HSTS16L/20A.

The HALL sensor is not a common component for the radio amateur, therefore a short explanation.
It utilizing HALL-effect phenomenon which voltage is produced from the movement of current within the region of magnetic field. The voltage produced by HALL-effect is directly proportional to the applied current making it suitable to estimate the applied current from the voltage sensed.
The HALL-sensor can measure current in 2 direction. Reverse current will not damage the sensor but the voltage produced will be in reduced.
If you want to know more, visit the WIKI page.

The supply voltage of the HALL-sensor  HSTS16L/20A is 5V and the output voltage 2.5 V center and +/- 625 mV deviation.  This means that a current of 20 Amp max, gives a voltage deviation of max + or – 625mV. This means that 1 Amp is 625/20 = 31.25 mV/Amp.!! And that around the center voltage of 2.5 V. This is certainly a challenge to measure that!
The reasult of 31.25mV/Amp is needed for the float ‘mVperAmpValue’ in the software program.

Be Aware!!
The HALL-sensor is magnetic sensitive and has a small deviation of +/- 625 mV. This means that current result measured can affected by magnetic radiation. So the measured current result will be not exact. Even when no measurement is made there can be a result!!
Therefore a “NUL” offset is needed. In the writen software program it will be done automatically. In ‘SetUp’ part of the software, when no current flows true the HALL-sensor, a measure is made. The result (+ or -) will be stored in ‘currentOffset’. In measure current the offset will be substract or count by the measured result and then displayed.

The HALL-sensor has 5 wires. To connect I used a DIN-connector 5 pole with pins spaced over 240 degrees.
pin 1 = Black = 0 V
pin 2 = White = Vref
pin 3 = Cable shield = Gnd
pin 4 = Yellow = Vout
pin 5 = Red = +5 V

The Display
I chose a standard display that has 16 characters and two rows. It is known under type number WC1602A. For this project I chose for a separate Display-PCB. You can find the drawing here.

The display module has 16 contacts. Ten contacts of these are used in this project, which are connected to the main board via a 10-pin connector. The display is equipped with LED background lighting. A 100 Ω resistor is included in the anode line to damp it slightly. The contrast is adjusted with a 10-turn trim pot of 10KΩ.
The display inputs DB0 – DB3 are fed out through a connector that is not used in this project. With these display inputs, special actions can be performed with the display, including dimming the display, allowing a character to run in, for example.

How the program works
Standard for the arduino is a program flow that starts with initialization, followed by the setup routine and then the main loop.
In the initialization phase, the fixed values are assigned, such as those for the display, the Hall sensor and so on. Then comes the setup phase. The one-time variable settings are programmed here, such as the start screen and the the force to start with the ‘offset’ routine. Then in the mainloop [void loop()] the first thing done is testing of the “Offset Buton” is pressed. When the button is pressed or set in SetUp part of the program, the ‘offsetRead’ selector is set. This means that main routine is continued with the -DC current Measurement- (sub)routine. The result in ‘currentResult’ is then used in the -Offset calculate- (sub)routine. The loop wil be now -Calculate DC-current –> Offset calculate –> for at least 2.5 sec. After 2.5 sec, the measured result is placed in “currentOffset” and the program go back to central part where it displayed the result.

Current sensor is a sensitive sensor. The output reading of the sensor produces electrical noises or fake current values even when there is no current detected. It is more obvious if the measurement is in a smaller time frame. In order to greatly reduce this phenomenon, multiple samples must be taken for averaging and initial offset sometimes must be done. Our code is designed to display a value which is derived from averaging 1000 samples in every second. Each sample is recorded every 1 milli second (0.001 second). The single averaged value is then to be displayed at LCD Display. With this, the fluctuation of value is way lesser compare to taking 1 sample reading every second.

The second problem could be the false signal and accuracy problem. Each sensor has its own deviation error. When there is no current sensed, the sensor might not be 100% at middle point of voltage value. Some might be remaining at few milli voltages above / below the middle point even though after averaging. This might be due to voltage supplied not in exact 5V or due to the sensor itself.

The central processing unit
As earlier mentioned the Arduino Nano has been used. Arduino has the ability to measure current by voltahe swing in the ADC analog input pin. Arduino NANO has 8 input pins. 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 / 1024 units).
All sensors that connected to analog input must be measured by voltage value. In order to provide the current value, the sensor actually providing voltage value that related to measured current value.

The drawing from the central processing unit you find here.
In the schematic you will find 4 connectors namely:
J1 = for the push button
J2 = for the HALL sensor
J3 = for the Display
J4 = for the relay connection

If you short the contacts 3 – 4 of connector J1, the software program will forcibly go into the “Offset” level (sub) routine. The rest of the connectors are clear.

The built-in ADC is sensitive to supply voltage variation. If the supply voltage varies due to load, the ADC will also vary accordingly (bias offset). With a voltage variation due to load 4.95 V – 5.05 V, which is 100mV, the ADC output also fluctuates in the same order. If you try to measure a very small voltage of 625 mV a deviation of 100 mV is about 16% !!!! That is far too much for an accurate measurement. The only solution is either to connect an extremely stable power supply or split up the power supply in one for the NANO and one for the load, so I have done.

Relay and control
Used is the Arduino HW-307 Relais module with optocoupler for voltage separation. Type 5V and one changeover contact. Trigger current 5mA. Max load AC 250V/10A or DC 30v/10A. When trigger voltage is HIGH the relay is in rest.

Software Codes
The final step would be adding source code onto Arduino board. I assume you have installed the Arduino IDE Software. Once you have downloaded and install the IDE software, you may download the code file ‘Measure DC-current Solar system” (.ino). The source code are fully explaind in the code itselfs.

Drawing sheet Display Unit
Gerber file Display_Unit 
  Pay attention!! The PCB-layout is for the display HY1602E and not for the described display WC1602A. The effect of both is the same.
Drawing sheet Processor unit
Gerber file Central processor unit
– Software for the Measure DCcurrent Solar system.

The developed software is sufficient for the first experiments, but adjustments still need to be made for definitive use. These will follow as soon as possible.

Henny, PA3BYB

DC Solar Current measure system Developt by PA3BYB in according to the idea of Solarduino HTTPS://