labreport6

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

Applied Physics Lab( PH-111L)

BS-AI-F-24-B
Lab Report .
Experiment-05:
Using Arduino for
Magnetic Field Measurement with
Hall Sensors

Submitted By:
Group C

Group Members:
Ayesha Siddiqa (241419)
Dua Mehmood (241391)
Muattar Imam (241451)
Mahnoor (241453)
Muhammad Waqas ur Rehman (241441)
Sohaib ul hassan (241377)
Sayyam Khalid Satti (241431)
Abdullah Ghaffar (241423)

Submitted To:
Muhammad Farooq Wasiq

Submission Date:
/11/2024
1. Introduction:

 Arduino is an open-source platform widely used for interfacing with sensors and other
hardware components.
 Hall Effect sensors detect and measure magnetic fields by producing a voltage
proportional to the magnetic field strength.
 Magnetic field:
A Magnetic field is an invisible force field around magnets or electric currents that exerts
a force on other magnetic materials or moving charges.
 The magnetic field (B) is a vector field and can be calculated using the following laws:
 Biot-Savart Law:
This law states that the magnetic field at a point due to a small current element is directly
proportional to the current and inversely proportional to the square of the distance.

B=μ0 I/4πr2 B

 Ampere’s Law:
This law relates the integrated magnetic field around a closed loop to the current passing through

∮B⋅dl=μ0I
the loop.
-7
Here, μ0=4π×10 is the permeability of free space.
 In the case of a solenoid, the magnetic field is created by the electric current flowing
through its coils.
In this experiment, we will use Arduino and a Hall Effect sensor to measure the magnetic field
of solenoid and then we will analyse its behaviour

2.Apparatus:
2.1 Arduino Board
The Arduino board is a small, programmable computer (microcontroller) used to build electronic
projects. It connects to sensors and other small devices allowing them to interact.

Arduino software (IDE) is used to write and upload code to the board, making it easy to control
connected components with simple instructions.

2.2 Hall Effect Sensor


 Model:
 Working Principle:
The Hall Effect Sensor measures the magnetic field by detecting the voltage generated when a
magnetic field is applied perpendicular to the current flow in the sensor.

 Measuring Range:
The sensor can measure fields between

 Conversion Factor:
Based on the sensor’s datasheet, the conversion from voltage (V) to the magnetic field (B) is
given by:

 Voltage Output Range:


 Sensitivity:
so,
B(Tesla)=Voltage Output (V)/Sensitivity (V/Tesla)
For this sensor, the sensitivity is
Therefore: Sensitivity = mV/Gauss.

2.3 Solenoid Coil


A solenoid is a coil of wire wound tightly into a helical shape.

2.4 Jumper wires

2.5 DMM

3.Schematic Circuit Diagram:

(a) To measure the magnetic field of a coil


as a function of the current (I):
4(a).Procedure:
We will set up all of the circuit and things according to our code so firstly let me show you our
code:

4.1Program Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

4.2 Explanation:
4.2.1 Circuit Setup:
 Firstly, we connected the VCC pin of the Hall Effect sensor to the 5V pin on the Arduino.
 The GND pin of the sensor was connected to the GND pin on the Arduino.
 The OUT pin of the sensor was connected to analog input pin A0 on the Arduino.
 We connected the solenoid to a variable power supply to control the current passing
through it.

4.2.2 Code:
 We wrote a program in Arduino IDE to read the sensor's analog output and calculate the
magnetic field strength in Gauss (G) based on the sensor's voltage. The code
continuously measured and displayed the magnetic field values in real time.

4.2.3 Voltage Control:


 We varied the current through the solenoid by adjusting the output of the power supply.
The Hall Effect sensor detected the resulting changes in the magnetic field.

4.3 Data Collection:


 So, By changing the current supplied to the solenoid at different points, we recorded the
corresponding current (I) and magnetic field (B) values. These were plotted on a B-I
graph to analyze the relationship and calculate the permeability of free space (μ0).

Current (mA) Applied Voltage (V) Magnetic Field (mT)

Plot:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

Calculation of μ0:
Using the slope of the graph, μ0 can be determined as:
B=μ0NI/L
Compare the calculated value of μ0\mu_0μ0 with the actual value (4π×10−7 T\cdotpm/A).

(b) Magnetic Field Measurements for


Different Lengths (L):
4(b).Procedure:
4.1Program Code:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

4.2 Explanation:
4.2.1 Circuit Setup:
 We reuse the same setup from Part (a), ensuring the Hall Effect sensor remains at the
center of the solenoid. The solenoids used in this part were prepared beforehand, with
varying lengths (L) and numbers of turns (N).

4.2.2 Code:
 We used the same Arduino code from Part (a) to measure the magnetic field strength, as
the sensor setup and measurement principle remained unchanged.

4.2.3 Voltage Control:


 We supplied a constant current to all solenoids using the variable power supply. This
ensured consistency in measurements across different solenoid configurations.

4.3 Data Collection:


 So, For each solenoid, we measured the magnetic field (B) using the Hall Effect sensor
and recorded its length (L), number of turns (N), and calculated turns per unit length
(n=N/L).
 We plotted two graphs: B-n and B-1/L, analyzing the data to confirm the theoretical
relationship between the magnetic field and solenoid properties.

Length (L) [cm] 1/L [1/cm] n=N/L [1/cm] Voltage (V) Magnetic Field (B) [mT]

 Plot 1:
Plot B (y-axis) vs n=N/L (x-axis).
//////////////////////////////////////////////////////////////////////////

 Plot 2:
Plot B (y-axis) vs 1/L (x-axis).
//////////////////////////////////////////////////////////////////////////////////////////////////

Verification:
We can verify these answers manually as well using these formulas

 Current (mA):
The current is calculated using Ohm’s Law, assuming a fixed resistor in the circuit. The current
increases as the applied voltage increases. In this setup, the current is directly related to the
voltage change.
I=V/R

 Magnetic Field (G):


To calculate the magnetic field inside a solenoid,we will use the formula:
B=μ0 N I /L
Where
μ0 is is the permeability of free space (4π×10−7 T.m/A)
N is the number of turns of the coil
L is the length of the solenoid (in metres)
And now to convert that magnetic field in Gauss (G) to Tesla (T)
B(G)=B(T)×10,000
And through it we verified that the calculated magnetic field values were accurate, and the
experiment was successful in determining the magnetic field strength inside the solenoid.

Conclusion:
This experiment successfully told us how to measure the magnetic field using an Arduino and
Hall Effect sensor.
We found that Higher Voltage results in Higher Current (if resistance remains constant), and
Higher Current leads to a Stronger Magnetic Field.

You might also like