It detects and controls the rotational speed of the motor. When lower than the specification speed, it increases a control electric current.
When higher than the specification speed, it reduces a control electric current. It is possible to use when wanting to keep constant speed even if the load to the motor changes.
With the circuit this time, I used a motor for the speed detection apart from the main unit motor. The speed can be detected in the other way, too. LEDs are lit up to confirm the control situation of the motor.
The PWM(Pulse Width Modulation) function of PIC is used for the electric current control to drive a motor.PWM can change the duty of the pulse to output into CCP1 by the data. When the time which is made the H level of the pulse of CCP1 is short, the time of ON (the L level) becomes long in TR2. That is, the drive electric current of the motor increases. Oppositely, when the H level time of the pulse of CCP1 is long, the ON time of TR2 becomes short and the drive electric current of the motor decreases.
The duty of the pulse of CCP1 is controlled in the voltage (the control voltage) which was taken in with the control voltage input circuit. When the control voltage is higher than the regulation value, the H level time of the CCP1 pulse is made long and the number of rotations of the motor is lowered. When the control voltage is lower than the regulation value, the H level time of the CCP1 pulse is made short and the number of rotations of the motor is raised.
I used N-channel MOS FET for the drive of the motor. The P-channel MOS FET can be used, too. In the case, the duty control of the CCP1 pulse becomes opposite. It becomes low-speed when the H level of the pulse is short and when long, it becomes high-speed. The way of connecting between the motor and the FET becomes opposite. In this case, the power of the transistor for the FET drive should be connected with the source terminal of P-FET.
http://www.hobby-elec.org/e_pic6_9.htm