Patent ID: 7701157

Claim:
A motor controller for controlling a motor that drives an opening-and-closing member, the motor controller comprising: an operation member; a relay circuit connectable to the motor and when connected switching contact states in accordance with movement of the operation member; a switching element connected to the relay circuit; a detection circuit for detecting rotation speed of the motor and generating a detection signal; and a control circuit, connected to the switching element and the detection circuit, for generating a duty signal having a duty ratio that is in accordance with a waveform of the detection signal generated by the detection circuit, providing the switching element with the duty signal, and controlling the driving of the motor in accordance with the waveform of the detection signal, wherein: the detection circuit is a pulse sensor and the detection signal is a pulse signal having a pulse length that is in accordance with the rotation speed of the motor; and when the opening-and-closing member is in a fully closed deceleration range or a fully open deceleration range, the control circuit monitors the pulse length of the pulse signal and gradually increases the duty ratio of the duty signal every time the pulse length of the pulse signal exceeds a threshold; and wherein the control circuit has a plurality of thresholds and sets a greater threshold as the threshold every time the pulse length of the pulse signal exceeds a previous smaller threshold.