In this post, we ‘ll learn the DC motor control using PWM signal. We learned how to generate PWM signal using PIC 16F84 Microcontroller.

Hardware :

The PWM signal drives a 2N2222 transistor which acts as an electronic switch. The transistor switches the motor driving current on and off at high rate.

In the following figure, there are two circuits. The control circuit ( the microcontroller ) and the driving circuit ( the motor and the transistor ).

The DC motor draws relatively high current than the current in the microcontroller circuit. The transistor isolates the two circuits.

By changing the duty-cycle of the PWM signal, we get different average DC voltage
for each duty-cycle value . The result is the change of the motor speed corresponding to that duty-cycle.


We use the PWM routine with two defined duty cycle values. The duty cycle value duty1 is the larger value which drives the motor faster than duty2 value. When the Boost button is pressed, the first duty cycle value is selected. When the button is released, the second value is selected.

The software routine is very simple. As usual, you can download the Proteus 7 model from here.

If you need any help or have any feedback, just let me know.


Leave a Reply

Your email address will not be published.