Controlling DC Motor with Microcontroller

Controlling DC Motor with Microcontroller

PID without PhD Cover

Here’s a quick article to create a digital controller without too many theories: “PID without PhD” 

The article writes a fairly complete digital handbook, discussing from digital control theory to source code, minus Rotary Encoder & PWM. Tim Wescott, Applied Control Theory for Embedded Systems, Newnes 2006

Some problems:


Yesterday I had tinkering a few hours, the summary as follows. Some things that might make the problem:

1. Specifications Rotary Encoder, able to how many rpm?

2. Interfacing encoder into a microprocessor. Is the signal from the encoder well received in the microprocessor?

3. External interrupt settings, is it correct?

4. Time to interrupt: Does the CPU quite quickly process the data before the next interrupt comes? Is lower interruptions a priority CPU allowance?

5. Is there any other process in the microprocessor that rebutted the CPU ration?



Use of interruptions in STM32:


Alternative Motor Driver

Alternative Motor drivers:

– TB6612FNG

– L293

– L298

-Discrete MOSFET

-Discrete BJT



DigitalWrite Slow



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.