A sensor comprising: a first electrode; a second electrode comprising a bottom portion and a wall portion; the first and second electrodes (6, 8) defining a sensing plane that denotes the plane connecting the end of the wall portion of the second electrode and the surface of the first electrode, which are flush with each other; a magnet positioned between the first electrode and the bottom portion of the second electrode; an attracting portion arranged in a gap between the first electrode and the second electrode, the attracting portion having an insulation property and the attracting portion being configured to attract conductive particles smaller than the gap between the first electrode and the second electrode to cause a change in electrical resistance between the first electrode and the second electrode; the sensor further comprises: a short circuit preventing portion configured for preventing a large-diameter conductive piece from causing a short circuit between the first electrode and the second electrode, the large-diameter conductive piece having a larger dimension than the gap between the first electrode and the second electrode, characterized in that the short circuit preventing portion is provided on at least one of the first electrode and the second electrode and extends along the inner edge of the wall portion, where the wall portion is in contact with the attracting portion and/or extends along the outer edge of the first electrode, where the first electrode is in contact with the attracting portion. a first electrode; a second electrode comprising a bottom portion and a wall portion; the first and second electrodes (6, 8) defining a sensing plane that denotes the plane connecting the end of the wall portion of the second electrode and the surface of the first electrode, which are flush with each other; a magnet positioned between the first electrode and the bottom portion of the second electrode; an attracting portion arranged in a gap between the first electrode and the second electrode, the attracting portion having an insulation property and the attracting portion being configured to attract conductive particles smaller than the gap between the first electrode and the second electrode to cause a change in electrical resistance between the first electrode and the second electrode; the sensor further comprises: a short circuit preventing portion configured for preventing a large-diameter conductive piece from causing a short circuit between the first electrode and the second electrode, the large-diameter conductive piece having a larger dimension than the gap between the first electrode and the second electrode, characterized in that the short circuit preventing portion is provided on at least one of the first electrode and the second electrode and extends along the inner edge of the wall portion, where the wall portion is in contact with the attracting portion and/or extends along the outer edge of the first electrode, where the first electrode is in contact with the attracting portion. a short circuit preventing portion configured for preventing a large-diameter conductive piece from causing a short circuit between the first electrode and the second electrode, the large-diameter conductive piece having a larger dimension than the gap between the first electrode and the second electrode, characterized in that the short circuit preventing portion is provided on at least one of the first electrode and the second electrode and extends along the inner edge of the wall portion, where the wall portion is in contact with the attracting portion and/or extends along the outer edge of the first electrode, where the first electrode is in contact with the attracting portion.