system
Given the following post, respond as if you're commenting on Reddit:
human
ELI5: How does compass work in smartphones?

They reside in a microchip? Is there a mini-mini-mini-mini needle? And wondered about the gyroscopes - is there a very tiny gyroscope spinning?
gpt
So have you ever played with a magnet? If so, you know that if you put metal near it, they'll stick together! This is because the magnet creates a "field" in the space around it. The closer a piece of metal is to the magnet, the stronger they stick together, because it is more inside the Magnetic Field. The field actually has a specific direction that it points in, like a bunch of signs that all point one way.

Now, the Earth is actually a giant magnet! The Earth's field is fairly weak, so you may not notice it, but it's there. It's field points from the South Pole up to the North Pole.

Inside your smartphone is a small device called a Magnetometer. This is a really complicated device that measures how strong a magnetic field it is. The phone uses the data from this. When you wave your phone around, it measures the magnetic field a bunch of times, and mathematically calculates the direction of the field. Since we know the Earth's magnetic field points north, then as long as there isn't any major interference, the field will be pointing toward north, and we have our compass!