Compass sensor is the device whose function is to give the right directions with respect to the North and South magnetic poles of the earth. The needle present on a compass always points towards the geometric North of Earth. This device makes use of principles of magnetism for operation.
But this magnetic force of the earth is so weak that people previously used to design compass by suspending a thin magnetic strip. In the Compass present in smartphones magnet is not used as a component because it causes interference in communication.
Digital Compass Sensor is actually a magnetometer that can measure the Earth’s magnetic field. With the use of ‘Hall Effect’ and by calculating the ultralow frequency signals coming from the North or South direction, this sensor can calculate the orientation and direction.
The resistance of the magnetic sensor present in magnetometer changes in proportional to the magnetic field present in a particular direction. The magnetometer measures the magnetic field strength and orientation.
This information from magnetometer is stored by the CPU as digital data. This Sensor always points towards the Geometric North. The Compass found in electric devices is a solid-state sensor. Usually, two or three magnetic sensors are present on the device from which the microprocessor can read data and detects the orientation of the device.
Compass used to provide compass and map navigation functions to help locate positions more accurately.
How it works: A compass measures the strength and direction of a magnetic field by detecting changes in the electrical resistance of the anisotropic magnetoresistive materials inside it. Sometimes you need to shake or rotate your phone for the compass to work properly. To ensure the accuracy of measurement results, avoid placing your phone with magnetic objects.