10.4. CIRCUIT DIAGRAM 339
new_cap - old_cap [clock pulses]
motor speed [RPM]
Figure 10.10: Motor speed calculation.
As shown in Figure 10.11, the microcontroller is not directly connected to the motor. The
PWM control signal from P4.0 is fed to the motor through an optical solid state relay (SSR). This
isolates the microcontroller from the noise of the motor. The output signal from the SSR is fed to
the MOSFET, which converts the low-level control signal to voltage and current levels required by
Motor speed is monitored via the optical encoder connected to the motor shaft. The index
output signal of the motor encoder provides a pulse for each motor shaft rotation. The signal is
converted to a MSP430 compatible digital signal via the LM324 threshold detector. The output
from this stage is fed back to P8.5 CCR0 to trigger a Timer A input capture interrupt on channel
1. An interrupt service routine captures the time since the last interrupt. This information is used to
speed up or slow down the motor to maintain a constant speed.
• Generate an approximately 2 kHz PWM signal.
• Vary the duty cycle from 50% to 100 %, which is set by the external potentiometer i.e., the
50% duty cycle needs to 0 VDC and the 100% duty cycle is equal to 3.3 VDC.
• Display the motor RPM and duty cycle on an LCD.
• Load the motor and perform compensation to return the RPM to the original value.
10.4.2 STRUCTURE CHART
The structure chart for the motor speed control project is shown in Figure 10.12.