The Classroom

The UGN3503 Hall Effect Sensor

Daniel Koch

Issue 28, November 2019

Learn how magnets and hall effect sensors can be used in projects.

This month’s The Classroom introduces another sensor of interest to, but possibly unknown to, the maker. Hall Effect sensors are used to detect changes in a magnetic field, and can be used for limit control, revolution counting, and current sensing.

What is the Hall Effect?

The hall effect is a phenomenon first published by Edwin Hall in 1880, as part of his doctoral thesis. His original experiments involved laying a thin layer of gold leaf on a sheet of glass, with connections at each end and along its length. A current was passed from end to end, and the connections on the sides measured. Hall discovered that when a magnetic field was applied perpendicular to the gold leaf and the current, a potential difference was generated between the two sides.

Since this initial discovery, Hall and then others continued to investigate and explore this effect. It can be measured in most conductors and semiconductors carrying a current, but its magnitude varies with material. Modern sensors designed to exploit the effect are made with carefully chosen materials. While the hall effect itself is a little hard to visualise from reading text, we have provided a diagram to help. However, the Wikipedia page for the Hall Effect, despite the fact that we don’t really like referring you to user-editable, potentially unverified information, has a great animation that really helps.

The Hall Effect Sensor

Hall Effect sensors are used in a variety of applications and come in a variety of forms. All exploit the fact that the strength of the magnetic field passing perpendicular to the sensor varies the output by a calculable amount. This means that the direction of the magnetic field must be a known value, or else other variables have to be known. Hall Effect sensors find themselves used as current sensors, mounted in a gap in a ferrite toroid which focuses the magnetic flux. By the voltage changes so measured, both the size of the current and its direction can be determined.

Other applications can include pipe inspections. A pipe is exposed to a magnetic field, and the hall effect device used to look for any changes which indicate voids, impurities, or other issues in the metal. Hall Effect sensors are also used to sense proximity, as all moving metals will interact with magnetic flux. In these cases, the sensor is often biased with a permanent magnet. Applications for this can be limit sensing, rotation or speed sensing, contactless/harsh environment switches, and even automotive ignition systems. Hall Effect sensors are also used as magnetometers, measuring the strength and direction of a magnetic field. This includes being the basis for some electronic compasses.

The UGN3503U

The Hall Effect sensor as you buy it on the retail market, is an integrated circuit consisting of a piece of semiconductor material that a current is passed through, with connections to its sides to sense the potential difference. This is connected to an internal amplifier with an output stage. In the case of the UGN3503, the output is an emitter-follower transistor. The entire assembly is in a three-pin package with the sensor element very close to the amplifier to minimise errors.

When a magnetic field is passed through the sensor in a perpendicular plane, the output voltage changes. Ordinarily, the output with no magnetic influence sits at around 2.5V. With a perpendicular face south pole magnetic field, the voltage increases to a demonstrated maximum of around 3.9V. A north pole will cause the output voltage to fall to around 1.2V demonstrated. These workshop tests were conducted with a supply voltage of 5.0V.

In use, the UGN3503 can be powered from 4.5 to 6V, making it ideal for microcontroller applications. It draws around 10mA constantly, the current needed to pass through the semiconductor and run the amplifier. The three-pin package has the same lead spacing as TO92 transistors, but the package itself is a thinner Single Inline Package (SIP). The three connections, when viewed from the printed face, are supply at the left. Ground in the middle, and output on the right.

The datasheet states an output sensitivity centred on 1.3mV per Gauss, a unit of measurement of magnetic flux. An upper and lower limit of 900G is stated, that being a 900G magnetic field facing either south or north. The tolerance of this sensitivity is relatively high, with a lower limit of 0.75mV/G, and an upper limit of 1.75mV/G. Any individual UNG3505 could be anywhere in this range, meaning that any sensor would need to be calibrated with a known field strength if it were to be used as such. However, most uses of interest to makers will not need to be so precise.

Practical Applications

Maker applications may include: Sensing the position of an armature; counting revolutions of a motor shaft; sensing the position of a servo motor; flow rate counters which involve a rotary vane in fluid (essentially a revolution counter where each revolution is a known volume of fluid); proximity sensors such as a ‘door closed’ indicator.

For sensing the position of an armature, a magnet needs to be fixed to the armature so that the magnetic poles are parallel to the device. As soon as the armature moves away from its centre position, the UGN3503 is exposed to the magnetic field and returns either a low or high reading, depending on which way the arm is moving. We tested this with a small super magnet and discovered that the readings were at their most extreme when the magnet had just left is home position, but were not full scale as the magnetic field was not completely perpendicular to the sensor. This configuration would suit linear or rotary armatures.

For counting revolutions, and by extension, flow sensing, a magnet is generally attached to a shaft or rotary vane. In the case of flow sensors, this allows total corrosion-proofing as the magnet can be encased in plastic and all other parts made from plastic. The circuit or code reading the sensor can then look for the peaks in the signal, each one constituting one revolution.

When sensing proximity, the UGN3503 is biased with a magnet. The presence of ferrous metal (iron or iron alloys, including some oxidised states) concentrates the magnetic flux, taking the output higher or lower than the magnet on its own. The magnet is placed behind the package and often glued on. Our workshop tests showed the device reading 1.8V with a bias magnet, and 0.9V with a pair of scissors held to the front face. With the polarity reversed, standing voltage was 3.2V, rising to 3.5V with the steel scissors present.

The datasheets recommend the north pole face of the magnet be glued to the device to sense an absence of ferrous metal, while the south pole glued to the device is for sensing the presence of ferrous metal. If this is the case, the UGN3503 can be used as a gear tooth sensor. With a set of notches around a shaft, the same technique can be used as a servo position sensor, by counting the steps involved in one rotation.

The proximity sensor could also be used to monitor a door closed scenario, or the travel of something like a gate, either swinging or sliding. The rising and falling voltage can be used as an analogue input for a microcontroller to slow the motor down accordingly as something nears the end of its travel, rather than abruptly turning it off.

Current Sensing can also be achieved with the UGN3503. To do so, a gap is cut in a ferrite toroid, and the sensor placed in the gap. The conductor to be measured is wrapped around the toroid so that a passing current induces a magnetic field in the toroid, which passes through the sensor. This field will be proportional to the current, and polarised by it.

While we're on the subject of magnets, it's worth remembering that there is a magnetic field associated with every electrical current, and the average workbench is full of them. The environment that you are designing your sensor for may need to be factored in to the sensitivity of your circuit, and the strength of the magnet you use.

Hands On:

UGN3503 Hall Effect Sensor Test Circuit

Rather than an actual build, we are going to assemble the same test rig we used for our workshop testing of the UGN3503. As-is, this rig feeds a varying voltage between 0.5V at one extreme, and 4.5V at the other, while fed from 5V. This makes it suitable to feed to either an analogue measuring circuit or a microcontroller such as an Arduino or a Raspberry Pi. For development purposes, we were mainly interested in voltage readings and so did not connect our rig to anything. However, the output from the device can be easily taken to a comparator, amplifier, or microcontroller from exactly the same points that we connected our multimeter.

On that note, you may notice in the photos that our multimeter is not connected by regular probes. We have found that measuring from a constant point like this while changing variables is not easy with probes. Instead, we have made our own lead with a length of speaker wire, two banana plugs, and the ends of a piece of breadboard wire link. In this way, the connections stay in the breadboard and we can go about our work.

A NOTE ABOUT MAGNETS: We did discover something very interesting when experimenting with the UGN3503. Attaching a super magnet to the back as the bias magnet means that the magnetic field through the device is so strong, that the presence of ferrous metal generates very little change. In fact, we measured differences of around 20mV. This contrasts to the 900mV differences we were able to achieve with ferrite magnets. We did not have any of the very small rare earth magnets used by gamers for figures. These can be found as small as 1mm cylinders, and may not overwhelm the sensor as much, but we cannot verify this.

Where To From Here?

Because of the centred measuring scale used by the UGN3503, where one magnetic pole sends the output below the centre, and the other pole sends it higher, this sensor would be an ideal companion for the LM3614 we presented in Issue 26. While our circuit there was for an end-to-end scale, the datasheet describes circuits for centred metering as well. This would be an ideal analogue display. However, many makers will want to use this device as an input for a microcontroller. If you do not, then perhaps a comparator-based control circuit is your next port of call. Otherwise, you may like to consider a hardware analogue-to-digital converter (ADC) so that your code can simply gain the data from a general I/O pin. Your application will determine this.