Interfacing Hall magnetic sensor to Bharat Pi

INTERFACING HALL MAGNETIC SENSOR USING BHARATHPI

 

Introduction of BHARATPI:

 




A single board architecture with compute, network and storage designed to build any IoT idea into a product. The board comes with a ESP32 Wroom 4MB memory + WiFi + Bluetooth + SD card slot. You can program the board using Arduino IDE or microPython. All ESP programs are compatible with Bharat Pi boards.

Introduction of Hall Magnetic Sensor:

 


A Hall effect sensor or Hall sensor is a magnetic non-contact sensor that generates an electrical signal proportional to the magnetic field applied to it. Hall effect sensors are widely used in industrial applications like current-sensing, position detection, and contactless switching. They are basically like a small reed switch, and when a magnetic field is around, the output voltage will vary according to the magnetic flux. Hall effect sensors are used in BLDC applications because they are robust, accurate, and low failure rate.


STEP 1:How Hall Magnetic Sensor Works?

Hall effect sensors work on the principle of the Hall effect.hen the device is placed within a magnetic field, the magnetic flux lines exert a force on the semiconductor material which deflects the charge carriers, electrons, and holes, to either side of the semiconductor. This movement of charge carriers is a result of the magnetic force they experience passing through the semiconductor material. As these electrons and holes move sidewards a potential difference is produced between the two sides of the semiconductor material by the build-up of these charge carriers.

 Then the movement of electrons through the semiconductor material is affected by the presence of an external magnetic field that is at right angles to it and this effect is greater in a flat rectangular shaped material. The effect of generating a measurable voltage by using a magnetic field is called the Hall Effect.

 

STEP 2:Hall Magnetic Pinout

 





Vcc – Connect to the 3.3v or 5v

Gnd – Connect to the Gnd

Signal – Any GPIO pin (pin 33)

 

 STEP 3:Requirements

  •     Hall Magnetic Sensor
  •    Connecting wires
  •    Bharathpi board
  •    Ardunio IDE


STEP 4:Interfacing Hall Magnetic Sensor with Bharathpi

 

 

Steps to Interface Hall Effect Sensor with Bharatpi:

  • Connect the Hall Effect Sensor
  • Connect the sensor's VCC pin to 5V on the Bharatpi.
  • Connect the sensor's GND (Ground) pin to the Bharatpi GND.
  • Connect the sensor's OUT pin to one of the Bharatpi digital input pins
  • upload the Arduino code
  • Connect Arduino to Bharat Pi:
  • Connect the Arduino to the Bharat Pi board using a USB cable.
  • Ensure that the Bharat Pi has appropriate drivers for the Arduino if necessary.


STEP 5:Source Code and Programming

 

// Include the necessary libraries

#include <Arduino.h>

 

// Define the analog pin to which the LM35 sensor is connected

const int analogPin = 15; // You can use any available analog pin on your ESP32

 

void setup() {

  Serial.begin(115200); // Initialize serial communication for debugging

}

 

void loop() {

  // Read the analog value from the LM35 sensor

  int rawValue = analogRead(analogPin);

 

  // Convert the raw analog value to temperature in Celsius

  float voltage = (rawValue / 4095.0) * 3.3; // Convert to voltage (3.3V is the ESP32 reference voltage)

  float temperatureC = (voltage - 0.5) * 100.0; // LM35 has a scale factor of 10 mV/°C

 

  // Print the temperature value to the serial monitor

  Serial.print("Temperature (Celsius): ");

  Serial.println(temperatureC);

 

  delay(1000); // Delay for 1 second before taking the next reading

}

 

GitHub link:https://github.com/PuneeethG/Sensor-Interfacing/blob/main/hallmagnet.ino

 

STEP 6:Application

 

Automotive: Used for speed detection, gear position sensing, and throttle position monitoring.

Proximity Sensing: Detect objects and determine their position in industrial machinery and automation.

Current Sensing: Measure current flow in conductors for motor control and power management.

Rotary Position Sensing: Determine the angle of rotating shafts in encoders


VIDEO:


Comments

Popular posts from this blog

Interfacing Analog temperature sensor with Bharat Pi

Interfacing Waterflow sensor with Bharat Pi