In this tutorial we build a Linear Magnetic Hall sensor to measure magnetic fields using NodeMCU based Web Server. Here to measure the strength of magnetic fields range from 0 to 1 Gauss or 1000 milliGauss.
What is the Hall Effect?
If electric current flows through a conductor, a magnetic field is employed perpendicular to the current direction. This magnetic field exerts a diagonal force on the moving charge carriers which tends to push them to one side of the conductor. Because there is a potential difference due to the pushed outwards charge carries a measurable voltage between the two sides of the conductor is produced, the so called Hall voltage. This effect is called the Hall Effect after E. H. Hall who discovered it in 1879. The effect is depending on the thickness of the conductor. Therefore the conductor should be very thin.
Components Required
ESP8266 NodeMCU Dev Board
KY-024 - Linear Magnetic Hall sensor
Circuit diagram
KY-024 - Linear Magnetic Hall sensor
A magnetic field is detected by the sensor and will be printed as an analog voltage value. You can control the sensitivity of the sensor with the potentiometer.
Digital out: If a magnetic field is detected by the sensor, a signal will be printed here
Analog out: Direct measurement of the sensor unit
LED1: Shows that the sensor is supplied with voltage
LED2: Shows that the sensor detects a magnetic field
NodeMCU
NodeMCU ESP8266-12E MCU is a development board with one analogue and many general-purpose input output (GPIO) pins. It has 4MB flash memory, and can operate at a default clock frequency of 80MHz. In this project, analog pin A0 of NodeMCU is used to read analog signal of KY-024 Linear Hall sensor.
Arduino Code
Subscribe and Download code.
Then, upload the code to your NodeMCU board. Make sure you have selected the right board and COM port. Also, make sure you’ve inserted your WiFi Credentials in the code.
After a successful upload, open the Serial Monitor at a baud rate of 115200. Press the “EN/RST” button on the ESP8266 board. Now it should print its IP address
Comments