A compass points toward the Earth’s weak magnetic field until a magnet is placed nearby. The Earth’s magnetic field is too weak to affect the compass, so the compass needle lines up with the magnet’s field.
When two magnets are present, the magnetic field experienced by the compass is the vector sum of the two individual fields. This is the principle of superposition.
You will also learn about stepper motors.
Over 1,000 resources