You are currently viewing Tiny Hall Sensor Module for Current Sensing

Tiny Hall Sensor Module for Current Sensing

Current and voltage are probably the most important electrical properties in any electrical circuit. They are the cornerstones of every other parameter and the first properties you look at when designing a circuit.

As you can imagine, for dynamic circuits, it is quite important to know the voltage and current at certain points in order to control the device operation or trigger certain action as well as calculate the heat dissipation.

Like voltage, current can a constant value (DC current) or a varying waveform oscillating at a certain frequency (AC current).

To measure current there are two popular ways of doing it: by measuring voltage drop on a resistor or by sensing a magnetic field in a conductor.

In this article, we will focus on how to sense a magnetic field in a conductor with the idea of measuring AC current using a tiny, cheap circuit.

What this module is good for

This module is good for measuring AC current from the mains for currents over 1A and applications that require total isolation between the measuring circuit and the measured current and low current measurement accuracy.

It was designed to be interfaced with a microcontroller that can then open a relay if the measured analogue signal is bigger than a predefined threshold value.

System design and how it works

This simple module has two main components: a hall effect sensor and a buffer/amplification/filtering stage.

Hall Effect Sensor

A Hall effect sensor is a device, in this case an IC, that can output a voltage proportional to the magnetic field passing through the component.

In this application, we are using it to measure current, as AC current creates a varying magnetic field that can be picked up by this sensor, however, it can be used in any other application that you might require to measure a magnetic field such as in electrical motors or devices that use magnetism as feedback for controlling direction and speed.

The selected IC was the DRV5053 from Texas Instruments.

This little guy comes in a SOT-23 and TO-92 package and has different sensitivities to choose from.

The only mandatory component it needs as with most ICs is a decoupling capacitor next to the Vcc pin.

Buffer/Amplification/Filtering stage

This stage is required basically because we are using this hall effect sensor without a concentrator. A concentrator is a ferrous component with a cylindrical or squared shape that goes around the conductor.

As the name implies, the concentrator concentrates the magnetic field in a smaller area. This is good in hall sensing because you get cleaner and more accurate measurements of the magnetic field of interest.

Here is a typical example of a hall sensor in combination with a concentrator taken from Allegro Application Note 296096.

In this application, we are placing the sensor into the conductor’s magnetic field without any concentrator, therefore, for low currents, the sensitivity of the sensor is not high enough to pick the magnetic field created by the current passing through the conductor.

Another important part from this stage is that we can add a filter to attenuate all frequencies above 60Hz (mains frequency) and placing a buffer between a sensor and an MCU is always good practice as it electronically separates one stage from the other, this prevents overloading the sensor and protects the MCU in case of an overvoltage event, given that an OPAMP will be more robust than an MCU.

Circuit Schematic

C1 and C5 – Decoupling capacitors for the opamp and hall sensor

U1 – Hall effect sensor

R1 and C3 – Make an initial low pass filter to attenuate frequencies above 330Hz

C4 – Removes the 1V DC offset from U1

R2 and R3 – Gain resistors for the OPAMP. These values will need to be selected according to your application gain needs

R4 and R5 – Voltage divider to create a DC offset for the output signal

U4 – Rail-to-Rail general-purpose operational amplifier

R6 and C7 – Single pole low pass filter set at a -3dB corner frequency of 72Hz

Application tips

As stated in the beginning, this module is used just to sense if the current going through a conductor has passed over a predefined threshold, it does not provide accurate current readings. If this is what you want then adding a concentrator will be the way to go.

It is important to place this module in very close proximity from the conductor and away from other magnetic field sources such as other power cables or transformers. Also, take into account sensor positioning by following TI’s application guidelines found on the datasheet:

Firmware implementation

Here’s a quick way to read the analogue signal from the sensor using the dsPIC33E ADC. This code samples the analogue signal 60 times with a 2ms break between each sample and then takes the max value from the sampled signal.

[cc lang=”c”] #define CURRENT_FS 60 uint16_t ix_CurrentADCbuff; uint16_t currentADCbuff[CURRENT_FS]; uint16_t currentPeak; void readCurrent(void) { ix_CurrentADCbuff=0; for(ix_CurrentADCbuff=0;ix_CurrentADCbuffmaxValue) { maxValue = currentADCbuff[ix_CurrentADCbuff]; } } currentPeak = maxValue; } [/cc]


In this example, I have powered the module with a 3.3V external supply and connected an oscilloscope probe to the output of the module.

I have also connected a 100ohm 200W power resistor directly into the 110VAC mains line in order to draw around 1A of current.

Finally, I placed the sensor right next to one of the AC lines.

100ohm load connected to 110VAC mains with the sensor right next to the AC wire.
The load was connected to a wattmeter to measure current.
Oscilloscope probe connected to VOUT net (referred to schematic).

Roberto Weiser

Roberto has experience in electronic embedded systems design and programming from concept to production, including: power electronics, audio electronics, automotive, battery management systems and renewable energies control systems. Roberto is interested in technology and sustainability of which he has practical experience acquired in his University degree, Master's, external courses, placement and also from volunteering in Peru. Furthermore Roberto has skills for business, leadership and teamwork from his time as Chairman of the Latinos and Spanish Society and Resident DJ in Plymouth

This Post Has 5 Comments

  1. User Avatar

    Really a good and simple explanation. Nice Graphics. Congrats!!

    1. User Avatar
      Roberto Weiser

      Thanks Santiago!

  2. Ovalwingnut

    VERY interesting 👍😁 A subject I have been interested in since discovering the (old classic) HP 547A “current probe”, which is near extinction and made from unobtainoum. I’m re-energized. You RoCk ❤

    1. User Avatar
      Roberto Weiser

      Thanks for sharing Ovalwingnut! I have never seen that HP 547A before but looks like a must-have devide for any electronics engineer! Do you know of any modern version that has not being discontinued?

  3. User Avatar
    AFTAB Alam

    Great..thats impressive..

Leave a Reply