DC Motor PWM speed control and IR tachometer

One microcontroller is responsible for regulation of DC motor speed by using Pulse Width Modulation (PWM) signal, while other MCU have responsibility for measuring that speed. Everything will be easy if there is wire connection between this two MCUs, but there are no physical connection between them. CD which contains four drilled holes, rotates between IR emitting diode and phototransistor on the opposite side. When one of the holes drilled on CD comes to the optical sensor, and IR light pass from diode to transistor, internal MCU interrupt will be triggered. Applications for both MCUs are written in C.

Here is the video of this project but because it is recorder long time ago quality is not so good.

Gallery

Here are some pictures taken in time of project realization.

GitHub repository

dc-motor-pwm-regulation