This paper demonstrates how a classical detector that collects non-interacting individual classical massive free particles can generate a quantum interference pattern. The proposed classical picture requires that particles carry the information of a phase equal to an action integral along their trajectory. At the point of their detection, a special type of detector collects the phases from all individual particles reaching it, adds them up over time as complex numbers, and divides them by the square root of their number. The detector announces a number of detections equal to the square of the amplitude of the resulting complex number. An interference pattern is gradually built from the collection of particle phases in the detection bins of the detector after several repetitions of the experiment. We obtain perfect agreement with three solutions of the Schrödinger equation for free particles: a Gaussian wavepacket, two Gaussian wavepackets approaching each other, and a Gaussian wavepacket reflecting off a wall. The main conclusion of the present work is that the interference of quantum mechanics is basically due to the detectors that collect the particles when there are macroscopic detectors operating as proposed. Finally, a simple physical experiment with a single-photon detector is proposed that will be able to test our theory.