According to an embodiment, this detection mechanism is provided with a case, a rotation unit, a magnet, a magnetic sensor, and a control unit. When an object subject to detection is inserted between the case and the rotation unit, the rotation unit rotates about a base end side thereof fixed to the case. The magnet is fixed to the rotation unit. The magnetic sensor is accommodated in the case and detects a magnetic field formed by the magnet. The control unit detects the insertion state of the object on the basis of the detection result from the magnetic sensor.Selon un mode de réalisation, ce mécanisme de détection est pourvu d'un boîtier, d'une unité de rotation, d'un aimant, d'un capteur magnétique et d'une unité de commande. Lorsqu'un objet soumis à la détection est inséré entre le boîtier et l'unité de rotation, l'unité de rotation tourne autour d'un côté d'extrémité de base de celui-ci fixé au boîtier. L'aimant est fixé à l'unité de rotation. Le capteur magnétique est logé dans le boîtier et détecte un champ magnétique formé par l'aimant. L'unité de commande détecte l'état d'insertion de l'objet sur la base du résultat de détection provenant du capteur magnétique.実施形態によれば、検出機構は、ケースと、回動部と、磁石と、磁気センサと、制御部とを備える。回動部は、ケースとの間に検出対象が挿入されることで、ケースに取り付けられる基端側を中心に回動する。磁石は、回動部に取り付けられる。磁気センサは、ケースに収容され、磁石により形成される磁界を検出する。制御部は、磁気センサによって検出された検出結果に基づいて検出対象の挿入状態を検出する。