1. Solution Introduction
Linear Hall can be used to conveniently detect magnetic field strength and direction. Linear Hall can respond proportionally to magnetic flux density and can be used for current detection, motor control, position detection and other applications. This solution uses the output characteristics of linear Hall, detects the output voltage through an 18-bit ADC, and calculates the magnetic field strength and magnetic field direction through linear formulas.
The linear Hall uses Quintiles' KTH5641-A1, which can detect magnetic fields within the range of +/-1600Gs.
2. Solution description
1. Linear Hall application circuit diagram

The circuit is relatively simple and only requires two bypass capacitors.
2. The ADC sampling part

MCP3421 adopts the IIC serial communication protocol and has a single-channel, high-precision (up to 18bits), differential input A/D converter; the on-chip precision reference voltage is 2.048V. Powered by a single power supply (2.7V-5.5V).
3. The power supply part
is powered by lithium batteries, and can be charged through the charging management chip TP4065.

When an external power supply is connected, the circuit will automatically switch to the external power supply.

The main power supply part uses the HX4002B inductorless electric pump boost circuit. The HX4002B is a low noise, constant frequency (1.2MHz) switched capacitor voltage doubler. It produces a regulated output voltage from 1.8V to 5V input, with a maximum output current of 100mA. With a low external parts count (1 flying capacitor and two small bypass capacitors at VIN and VOUT), the HX4002B is suitable for small, battery-driven applications.

4. The display part
adopts Zhongjingyuan's 0.96' OLED and communicates through SPI. The relevant information is in the attachment.
3. Result display
1. After powering on, the battery power will be displayed in the upper right corner of the screen, which can be detected through the ADC built in the microcontroller.
2. After just starting up, the system will have some errors, causing the displayed value to be not 0. You can clear it by pressing the 'clear' button on the top of the module.
3. Use a magnet to approach for detection.

4. You can press the "Unit" button to switch units (Gs and mT to switch), or you can press the "Lock" button to lock the current value for easy viewing.