Patent ID: 8278920

Claim:
A magnetic sensor comprising: a Hall element; and a control device passing a current through the Hall element and measuring a voltage in the Hall element, passing a current through the Hall element along a first direction and measuring a first voltage in a second direction orthogonal to the first direction, passing a current through the Hall element along the second direction and measuring a second voltage in the first direction, passing a current through the Hall element along a third direction opposite to the first direction and measuring a third voltage in the second direction, passing a current through the Hall element along a fourth direction opposite to the second direction and measuring a fourth voltage in the first direction, performing calculation which strengthens effects of Hall voltage mutually and weakens effects of offset voltage mutually based on a value of the first voltage and a value of the second voltage by obtaining the sum of the first voltage and the second voltage when the polarity of the first voltage is same as the polarity of the second voltage or by obtaining the difference of the first voltage and the second voltage when the polarity of the first voltage is opposite to the polarity of the second voltage, and comparing a result thereof with a reference value, and performing calculation which strengthens effects of Hall voltage mutually and weakens effects of offset voltage mutually based on a value of the third voltage and a value of the fourth voltage by obtaining the sum of the third voltage and the fourth voltage when the polarity of the third voltage is same as the polarity of the fourth voltage or by obtaining the difference of the third voltage and the fourth voltage when the polarity of the third voltage is opposite to the polarity of the fourth voltage, and comparing a result thereof with the reference value.