Lab report arduino
Lab report arduino
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
Introduction:
Apparatus:
➢ Arduino Uno microcontroller
➢ Hall Effect sensor (.........)
➢ Breadboard
➢ Jumper wires
➢ Laptop with Arduino IDE
➢ Multimeter (for current measurement)
Circuit Diagram:
Procedure:
We will set up all of the circuit and things according to our code so firstly let me show you our code:
Program Code:
// Magnetic Field Measurement Using Hall Effect Sensor
const int sensorPin = A0; // Analog pin connected to Hall sensor
const float sensorSensitivity = 1.3; // Sensor sensitivity in mV/G (for A1302)
const float VCC = 5.0; // Arduino supply voltage in volts
const int ADCResolution = 1024; // 10-bit ADC resolution
void setup() {
Serial.begin(9600); // Initialize serial communication
}
void loop() {
int sensorValue = analogRead(sensorPin); // Read analog value
float sensorVoltage = (sensorValue * VCC) / ADCResolution; // Convert to voltage
Voltage Control:
➢ We varied the voltage applied to the Hall Effect sensor. For this experiment, the
applied voltage was controlled by adjusting the input power supply.
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.
Data Collection:
➢ We changed the voltage supplied to the Hall Effect sensor at different points and recorded the
corresponding current and magnetic field values.
➢ 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
B=μ0 N I /L
Where
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.
Graph:
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.