· Module 04

DC Motor Control 04 | ESP32 Firmware, PWM and Encoder Feedback

Dr. Redmond R. Shamshiri
Assistant Professor of Robotics · University of Southern Denmark (SDU)

Study DC Motor Control 04 | ESP32 Firmware, PWM and Encoder Feedback. Use the accompanying model, numerical example and practical task to connect the topic to a measurable engineering result. Notes are original supplemental material, not a transcript.

Lecture video: https://www.youtube.com/watch?v=2JThvmugvzc

Learning Objectives

  • Explain the role of encoder measurement and speed in the engineering system.
  • Calculate the worked quantity with consistent units.
  • Design a measurement that can reveal an implementation failure.

Study guide

Original companion notes. These notes support the topic of this lesson. They are not a transcript or a claim about the exact contents, hardware settings or examples in the video.

Lesson focus: DC Motor Control 04 | ESP32 Firmware, PWM and Encoder Feedback

Define the input, measured output, units and pass/fail condition before running the experiment.

Encoder measurement and speed

An encoder produces discrete position increments. Speed is estimated from counts over a known time window or from time between edges. The term counts per revolution must include the selected quadrature decoding and any gearbox ratio.

Model, units and assumptions

\[\omega=\frac{2\pi\Delta N}{N_{rev}\Delta t},\qquad n_{rpm}=\frac{60\Delta N}{N_{rev}\Delta t}\]

ΔN is the signed decoded count difference, Nrev is effective decoded counts per output-shaft revolution, and Δt is elapsed time in seconds. The finite window trades quantization noise against delay.

Worked engineering example

An effective 2,048-count/revolution encoder records 512 counts in 0.25 s. Speed is 60 rpm, or 2π rad/s. A single-count change over that window corresponds to approximately 0.117 rpm.

Practical task and evidence

Apply the following procedure to the topic of this lesson: DC Motor Control 04 | ESP32 Firmware, PWM and Encoder Feedback.

  • Turn the output shaft exactly one revolution to verify effective count resolution and direction.
  • Log counts with monotonic timestamps; test rollover handling and zero-speed behavior.
  • Compare a short-window estimate with a longer window during acceleration.

Submit: a diagram or interface table, a short timestamped dataset, the calculation with units, and a paragraph explaining the largest observed limitation.

Check your understanding

Question. With 1,000 effective counts/revolution and 250 counts in 0.1 s, find speed.

Show worked answer

150 rpm. Ensure the 1,000 value already includes quadrature decoding; multiplying it again would introduce a factor-of-four error.

Extension. Change one assumption in the model and explain which measurement would reveal that it no longer holds.

Summary

Encoder measurement and speed: keep units, assumptions and timing explicit. Check the numerical model against an independent observation before using it in a larger system.

Lectures: DC motor control · Dr. Redmond R. Shamshiri · University of Southern Denmark (SDU)