Experiment 9 - Magnetic: Hall Sensors

For this experiment, it is necessary to use your own laptop during the experiment. You also need the Arduino IDE. In case you do not have access to a laptop, please ask the WorkINGLab staff a couple of days in advance. They are able to provide you with a PC for the experiment.

1. Context of the Experiment

In this experiment, the concept of magnetic sensing is introduced. A magnetic sensor usually refers to a sensor that converts the magnitude or the change in the magnitude of a magnetic field to an electric signal.

The concept of magnetic sensing will be used in this experiment to measure displacement.

2. Learning Goals of this Experiment

Students are able to

  • read the data sheet of a Hall sensor and discuss the contents

  • answer questions about the data sheet and properties of the referenced sensor

  • connect a sensor to an Arduino on their own

  • upload the required code to the Arduino

  • read analog measurement values from the sensor

  • understand how the analog reference of an Arduino works and can independently convert the analog measured values into voltages

  • interpret the measured values and draw conclusions about the sensor

3. Literature

[1] ABLIC Inc., "What is a Magnetic Sensor?," [Online]. Available: https://www.ablic.com/en/semicon/products/sensor/magnetism-sensor-ic/intro3/ . [Accessed: 2024-01-03].

[2] M. Soltero, "What Is a Hall-effect Sensor? - SSZT164 Technical article" Texas Instruments, [Online]. Available: https://www.ti.com/document-viewer/lit/html/SSZT164. [Accessed: 2024-01-03].

[3] J. Lenz and S. Edelstein, "Magnetic sensors and their applications," in IEEE Sensors Journal, vol. 6, no. 3, pp. 631-649, June 2006, doi: 10.1109/JSEN.2006.874493.

[4] Measurement Technology lecture slides

4. Basics / Fundamentals

The term magnetic sensor refers to a sensor that converts the magnitude, or the change in magnitude of a magnetic field, into an electric signal. Sources of magnetic fields that you may encounter everyday are the earth’s natural magnetic field, permanent magnets and coils.

There are many types of magnetic sensors, that are classified upon, for example, different phenomena to sense the magnetic field and the different proximity ranges. One type which we will use in this experiment is the Hall sensor.

4.1 Hall sensor

The Hall effect sensor is a widely used, low-cost sensor. It exploits a physical phenomenon discovered by Edwin H. Hall in 1879. He discovered that a voltage difference appears across a thin rectangle of gold placed in a strong magnetic field perpendicular to the plane of the rectangle when an electric current is sent along its length. An electron moving through a magnetic field experiences a force, known as the Lorentz force, which is perpendicular both to its direction of motion and to the direction of the field. It is the response to this force that creates the Hall voltage [4]. Figure 1 shows an illustration of the Hall effect.

4.2 Types of Hall effect sensors

There are two main types of Hall sensors: linear and switch. Linear sensors provide a signal proportional to the strength of the magnetic field, while switch sensors measure and compare the field strength with a fixed threshold level and give the output in the form of only two states, ON or OFF.

4.3 Applications of Hall sensors

There is a wide range of applications of Hall sensors, including:

  • magnetometers, or Hall probes, measure the strength of magnetic fields

  • magnetic field detection

  • current or voltage sensing, for example in the TMCS1100 series Hall effect current sensors

  • position sensing

  • ignition timing in internal combustion engines

5. Technical Basics & Preparations

Before measuring, these aspects of measuring should be considered and thought through:

  • What is supposed to be measured? What values are necessary for the calculations?

  • What measuring devices are appropriate for the measurements? Do they provide the necessary accuracy?

  • How do you need to connect the sensor? How do you configure your measurement electronics?

  • What are the possible (systemic) errors and external limitations that exist in the setup?

Preparations

The following equipment and materials are needed for this experiment:

  • Arduino Uno with USB cable

  • a laptop or PC with the Arduino IDE installed

  • short breadboard

  • single-core wires or jumper cables (red, black, yellow) - ask the staff if you need more cables

  • Hall sensor PCB (DRV5053CA)

  • 2x 200Ω resistors

For the experiment, you will use the test stand from experiment 3, which is additionally equipped with two magnets in plastic adapters (labeled #1 and #2). These magnets should stay with the test stand.

grafik-20240801-163827.png
Figure 2: Necessary parts for connecting the sensor
(not shown: your own laptop with the Arduino IDE)

You will be using the DRV5053CA Hall sensor for this experiment. Please familiarize yourself with the datasheet for this sensor:

Some of the questions in section 7 will cover information that you have to gather from the datasheet.

For further information on how to read the datasheet and apply the contained information, the following documentation may be helpful:

Additional information: ADC reference voltages

For some sensors, their output voltage range does not match the measuring range of the measurement electronics (in this case the Arduino Uno). The Arduino’s ADC (analog-to-digital converter) is able to discretize analog voltages between 0 and VCC (typically 5V) into 1024 steps (values 0 … 1023). The sensor has a different output voltage range (which you have to find out yourself!).

To accomodate this different scale, we can manually set the ADC reference voltage (marked AREF on the Arduino board) to an arbitrary value between 0V and VCC. For this experiment, you will be asked to set AREF to a voltage of VCC/2 using a very simple voltage divider consisting of two resistors with equal value.

Please keep in mind that because the voltage divider uses VCC, the analog reference voltage AREF depends on the voltage VCC. The Arduino generates VCC from the computer that it is connected to, which usually transmits 5V. However, this voltage can fluctuate as much as ±10%, even in a short amount of time! As such, you need to measure your analog reference voltage AREF together with every measurement of the sensor, as the ADC evaluates the sensor signal on a scale from 0 to 1023 relative to AREF.

6. Experiment Procedure

6.1 Connect the sensor to your Arduino

Connect the DRV5053CA sensor to your Arduino. For your convenience, we prepared a PCB (printed circuit board) with the sensor on it (marked as “U1” on the PCB). The PCB has three electrical pins:

  • VCC: positive voltage level, in this case +5V

  • OUT: output pin of the sensor

  • GND: Ground (0V)

Please refer to the sensor’s datasheet pin configuration (page 3) to connect the sensor correctly.

For the second part of the experiment, it is very important that the sensor PCB is placed in the specific place that is shown in Figure 3. Please follow this instruction!

Additionally, to set the ADC reference voltage to VCC/2, use two resistors and jumper wires to realize a voltage divider.

Please first try connecting the sensor and the resistors on your own. To check your circuit, you can expand the following tab and compare your circuit to Figure 4.

When wiring a circuit, it makes sense to use differently colored wires to connect the components. In order to get a better overview, it is usual to use certain colors for certain signals. This makes it easier to understand the circuit that another person has connected (e.g. when your tutor tries to check if your circuit is correct).

Usually, for low voltage circuits like the Arduino, the following color convention exists:

  • GND: black

  • VCC (+5V): red

If you are curious, you can find more information here.

Solution to 6.1 - only take a look after you tried it yourself!

6.2 Upload your Arduino code

The following Arduino code reads the sensor and sends the raw reading back to your PC over a Serial port connection. Please make yourself familiar with the code:

// the setup routine runs once when you press reset: void setup() { // initialize serial communication at 9600 bits per second: Serial.begin(9600); // set the analog reference source to external (supplied by the voltage divider from 5V) analogReference(EXTERNAL); } // the loop routine runs over and over again forever: void loop() { // read the input on analog pin 0: int sensorValue = analogRead(A0); // send the analog value to the connected PC via Serial: Serial.println(sensorValue); // wait 100ms for stability of the loop delay(100); }

You can download the file or copy and paste it and upload it onto your Arduino. When you open the Serial Monitor in your Arduino IDE, you will see the raw analog sensor value of the 10-bit ADC (0 … 1023):

6.3 Experiment at your workbench

After you have connected the sensor and the voltage divider, please do some experiments at your own workbench and document your observations:

  1. sensor value without any magnet present (see Figure 7)

  2. sensor values with the flat side of the magnet close to the top side of the sensor (see Figure 8). Turn the magnet around and measure each flat side of the magnet.

  3. change in sensor value when you move the magnet sideways (with its cylindrical surface) over the sensor (see Figure 9)

 

 

 

 

6.4 Measurements at test stand of experiment 3

The rest of the experiment will take place at the same test stand that was already used for experiment 3.

Carefully attach the breadboard to the test stand like shown in Figure 10 and the following video:

Open the Matlab App, enter your information and select Experiment 9 from the drop down menu. You will be greeted by the following screen:

Follow these steps, as indicated in the Matlab App:

  1. Insert your breadboard with the sensor into the breadboard holder and connect your Arduino to a PC with the Arduino IDE.

  2. Connect the multimeter to the voltage divider for the analog reference of the Arduino and set it to measure the analog reference voltage.

  3. Set the position of the moving part of the test stand to 15mm.

  4. Select a magnet from the drop down menu. Attach it to the moving part of the test stand.

  5. Reset the position of the moving part of the test stand to 0mm.

  6. Select a point using the slider. The position in the app will automatically adjust. Move the test stand to the indicated position.

  7. Read the sensor value from the Arduino IDE. At the same time, measure the voltage of the analog reference. Enter the values and add them to the table with the "Add Measurement" button.

  8. Repeat steps 5-7 until you measured the sensor value and voltage for all measurement numbers of the slider. Repeat from step 3 for the other magnet.

You will need these values later for the Vips questions. After you have done all measurements as requested in the Matlab App, please save the data.

7. Evaluation of Experiment Results

1. Matriculation Number

Please enter your matriculation number, so we can assign the results to you.

2. Minimum output pin voltage

When the sensor is saturated with a strong magnetic field, what is the highest minimum value that the sensor will output, according to the datasheet? Please use the decimal point and give only numerical values in Volt [V].

3. Maximum output pin voltage

When the sensor is saturated with a strong magnetic field, what is the lowest maximum value that the sensor will output, according to the datasheet? Please use the decimal point and give only numerical values in Volt [V].

4. Typical sensitivity - value

What is the typical sensitivity of the sensor? Enter the numerical value only, the exact same way it is given in the datasheet.

5. Typical sensitivity - unit

What is the typical sensitivity of the sensor? Enter the unit only, the exact same way it is given in the datasheet.

6. Quiescent output - analog value

During the experiment at your booked workbench (see section 6.3), you measured the analog sensor value when no magnet was present. Please enter the measurement value!

7. Quiescent output - voltage

In the previous question, you were asked to give the analog output value of the sensor when no magnet was present. What is the sensor voltage corresponding to this measurement? Assume that the analog reference was set to exactly 2.5V by the voltage divider! Please use the decimal point and give only numerical values in Volt [V].

8. Maximum analog output value at test stand

What is the maximum analog output value of the sensor that you measured during the experiment at the test stand? Use your recorded data from the test stand.

9. Maximum output voltage at test stand

In the previous question, you were asked to give the maximum analog output value of the sensor during the experiment. What is the sensor voltage corresponding to this value, considering the actual voltage at the analog reference pin?

Please use the decimal point and give only numerical values in Volt [V].

10. Minimum analog output value at test stand

What is the minimum analog output value of the sensor that you measured during the experiment at the test stand? Use your recorded data from the test stand.

11. Minimum output voltage at test stand

In the previous question, you were asked to give the minimum analog output value of the sensor during the experiment. What is the sensor voltage corresponding to this value, considering the actual voltage at the analog reference pin?

Please use the decimal point and give only numerical values in Volt [V].

12. Magnetic flux density

The following circumstances are given for a measurement with the sensor:

  • the Arduino measures an analog output value of 261

  • the Arduino is powered with a USB cable from a computer, resulting in a voltage at the “5V” pin of 4.86V

  • the resistors for the voltage divider have perfectly equal resistance values

What is the magnetic flux density that the sensor senses? Please use the decimal point and give only numerical values in the unit mT.

13. Real sensitivity of sensor

For the calculation of this answer, you need the results that you entered in questions 8 - 11.

Due to influences during the manufacturing process of the sensor as well as usage conditions such as the ambient temperature, the sensor has characteristics that differ from those stated in the datasheet. This is particularly relevant for the sensitivity, which is given with a broad range of 10 … 35 mV/mT (refer to datasheet page 6).

You already calculated the minimum and maximum voltages that you encountered during your experiment time at the test stand (questions 9 and 11). Assume that at these voltages, the typical input saturation field (given in the datasheet) was present. Assume a linear behavior between the minimum and maximum saturation field.

What is the real sensitivity of the sensor? Please use the decimal point and give only numerical values in the unit mV/mT.

14. Change in magnetic flux density for one ADC step

Again, assume that the typical input saturation field given in the datasheet was present at the minimum and maximum voltages that you calculated previously. Assume a linear behavior between the minimum and maximum saturation field.

For a change in the analog output value of 1 (e.g. from 500 to 501), what is the change in the magnetic flux density? Please use the decimal point and give only numerical values in the unit mT.

15. Plateaus in measurement graph

You are given the following plot of two measurements that were recorded using the test stand. Please note that the scales and offsets of the x- and y-axes are arbitrary and not important for the answer.

What are the plateaus (circled in red) called?

select one from:

  • saturation

  • remanent flux density

  • hysteresis

  • Hall effect region

16. Negative slope

Consider the following measurement plot that was recorded using two magnets at the test stand. Please note that the scales and offsets of the x- and y-axes are arbitrary and not important for the answer.

Why is the measurement of magnet B flipped (in comparison to magnet A), showing a negative slope instead of a positive slope with increasing position?

select one from:

  • For the second measurement, magnet B has twice the remanent flux density ("is twice as strong") as magnet A

  • For the second measurement, magnet B has the opposite polarity of magnet A, but the same remanent flux density

  • For the second measurement, the direction of movement of the magnet was opposite (away from the sensor instead of closer to the sensor)

  • For the second measurement, the polarity of the voltage to the sensor was reversed (-5V instead of +5V)

17. Magnet polarity

During your experiment, you measured the magnetic flux density of two magnets. When you attached them to the test stand, which poles faced the sensor during the measurements? Hint: Refer to the datasheet for help.

select one from:

  • Magnet 1 had its north pole facing the sensor and magnet 2 had its south pole facing the sensor.

  • Magnet 1 had its south pole facing the sensor. Magnet 2 is actually not magnetized.

  • Both magnets were magnetic monopoles; they do not have a north and south pole.

  • Magnet 1 had its south pole facing the sensor and magnet 2 had its north pole facing the sensor.

Institut für Mechatronik im Maschinenbau (iMEK), Eißendorfer Straße 38, 21073 Hamburg