Project 7.24—Closed-Loop DC Motor Speed Control—On/Off Control

This project is about closed-loop speed control of a DC motor using a microcontroller. In the project, an optical encoder is used to detect the motor speed and feedback is applied to achieve the desired speed. The motor control signal is in the form of a PWM waveform.
PWM waveform is frequently used in power control applications, such as motor control, pump control, and heating control. By changing the duty cycle (ON time), we can control the average voltage (or power) applied to the load.
If Vi is the amplitude of the PWM signal, the average voltage supplied to the load is given by

Averagevoltage=tONtON+tOFFVi=tONTVi.

The relationship between tON and the average load voltage is linear, ...

Get PIC Microcontroller Projects in C, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.