Everyone saying it’s a motor spinning an unbalanced weight is a few years behind the curve.
Most modern phones use a linear actuator. The simplest explanation is it’s a magnet that can move back and forth on a spring in a straight line. It then has an electromagnet that can turn off and on at a harmonic frequency causing each oscillation to be a bit bigger than the one before. (Like pushing someone on a swing). Anytime the magnet changes directions it has to push back on the body of the phone which we feel as a vibration.
Latest Answers