User manual

Example Projects
© 2006 Microchip Technology Inc. DS51557C-page 31
FIGURE 2-11: PROJECT 5: SCHEMATIC
Instructions
Use POT1 to adjust the speed of the motor. Turn the potentiometer counter-clockwise
to reduce speed; turn it clockwise to increase motor speed. Multiply the LCD display by
1000 to obtain speed in RPM.
Discussion
With the CCP module operating with 8 bits of resolution, the module can output a PWM
signal at a frequency of 31.2 kHz. This is sufficiently high frequency that motor whine
is outside of the audible frequency for humans. This is especially important in applica-
tions where the motor may turn at slow speeds.
Using an optical sensor to gather feedback from a motor is an integral part of many
mechatronic systems. Some systems require a constant speed over varying loads. An
optical encoder is similar to the optical interrupter circuit used in this project. The
difference is that an optical encoder uses more than one optical sensor (as many as
four) to deduce speed and shaft position.
Q6
PIC16F917
VDD
AN0
V
SS
VDD
1 kΩ
R10
11/32
2
12/31
D12
RC5
POT1
10 kΩ
VDD
24
C26
1000 pF
COMX
SEGX
Common pins
Segment pins
LCD1
VIM-332-DP
VDD
470 Ω
R22
VDD
R20
470 Ω
R11
20 kΩ
U11:B
U10:A
10 kΩ
10 kΩ
VDD
Simplified circuit shows
equivalent functionality
RD7
30
CCP2
21
Motor
Note: The optical interrupter circuit is susceptible to interference from outside
infrared light sources (i.e., incandescent lights, sunlight, etc.). It may be
necessary to cover the optical sensor to obtain an accurate reading.