The present invention discloses a device based on an atomic force microscope. The device is capable of measuring surface force, electrical, magnetic and thermal properties of sample materials in a special wave band light irradiation condition in real time. The device system is mainly formed by an irradiation device, an external light source and light-guide fibers. The irradiation device is formedby a housing, a point light source, a lens and a lens hood. When used, the irradiation device portion is installed under an objective table for cooperation with the atomic force microscope, the external light source emits an incident beam with special wavebands (ultraviolet, visible light and infrared), the beam is conducted to the point light source in the irradiation device through the light-guide fibers and is diffused upwards in the point shape, and divergent light is restrained by the lens to become parallel light to irradiate the surface of a material sample. The device system is independent of a laser system of the atomic force microscope and has no interference with the laser system of the atomic force microscope, the device employs different external light sources or modes of installing optical filters to regulate the irradiation wavebands, and real-time detection of a plurality of property indexes such as force, electrical, magnetic and thermal properties of samples is achieved through replacement of an atomic force microscope scanning probe module and a mode of a software scheme. Compared to a current test method, the device provided by the invention can accurately reflect the change conditions of the correlation property indexes of the materials in the irradiation process.