ESP32 Hall Effect Sensor


MOHAMMAD SAIFIQUL AIMAN B MOHAMMAD ALI

192011145

R2427-MICROELECTRONIC ENGINEERING

A hall effect sensor is included in the ESP32. A hall effect sensor can detect magnetic field differences in its environment. The output voltage is proportional to the magnetic field strength. To operate as a switch, a hall effect sensor can be paired with a threshold detector. The majority of the time, Hall effect sensors are utilized to : 

- Detect proximity; 

- Calculate positioning; 

- Count the number of revolutions of a wheel; 

- Detect a door closing; 


Here’s a list of parts you need to assemble the circuit

 ESP32 DOIT DEVKIT V1 Board


Read Hall Effect Sensor 

Reading the hall effect sensor measurements with the ESP32 using the Arduino IDE is as simple as using the hallRead() function. In your Arduino IDE, go to File > Examples > ESP32 > HallSensor: 



Copy the source code below

Source code :

// Simple sketch to access the internal hall effect detector on the esp32.

// values can be quite low. 

// Brian Degger / @sctv 

int val = 0;

void setup() {

Serial.begin(9600);

}

// put your main code here, to run repeatedly

void loop() {

// read hall effect sensor value

val = hallRead();

// print the results to the serial monitor

Serial.println(val);

delay(1000);

}



Uploading the Sketch :

Before clicking the upload button, go to Tools  Board, and select the board you’re using. In my case. It’s the DOIT ESP32 DEVKIT V1 board. Also don’t forget to select your ESP32’s COM port.



Now, press the upload button.

Then, wait for the “Done uploading.” message: 


Testing your project :










The value shown in serial monitor change according to analogue rotation, 



Comments

Popular posts from this blog

MINI PROJECT - AUTOMATIC WATERING PLANT USING BLYNK

ESP32 TOUCH SENSOR