I am making a project based on Industrial automation using arduino in which I have to check whether the object on my circular conveyor belt is faulty or not. For that I used a 12 Volt DC motor 200 RPM and controlled its speed using arduino (PWM) and TIP122 and potentiometer. Also I am making an arrangement placing an IR sensor so that when the object is detected the conveyor stops but the thing is when the object is detected by the sensor it takes time to turn off the motor and also the speed of the motor is not constant and even if I set it at a specific value, it get changed at will. How can I control the speed of the motor properly and the motor should be low immediately when the object is detected by the IR sensor. Please help its urgent.