DAQ in Matlab with incremental encoder

6 views (last 30 days)
mahmoud
mahmoud on 7 Aug 2025
Answered: Simon on 11 Aug 2025
HALLO;
How can one calculate the speed of an incremental encoder in Simulink?

Answers (1)

Simon
Simon on 11 Aug 2025
Hi Mahmoud,
You can calculate incremental encoder speed in Simulink using the pulse counting method as follows:
1. Encoder Pulse Input – Read channel A (or B) via Digital Input, this is your DAQ input.
2. Detect Rise Positive – Output a single pulse for each rising edge.
3. Counter – Count pulses between resets using a Discrete-Time Integrator or counter logic. 
4. Triggered Subsystem – Trigger every second to read and reset the counter. Read the current count and subtract it using a unit delay.
5. First Gain block – Convert to rad/s (Converts encoder counts difference to counts per second)
Value can be 1/(PRR*Interval), create the variables and values accordingly
PRR - Pulses per Revolution
Interval: This is the time between your measurements.
This gain converts the change in encoder counts per sample into a real-world rotational speed (rad/s)
6. To get RPM – multiply second gain block value as 60
7. Display/Scope – Show or log speed.
This method is simple and works well for medium–high speeds. For very low speeds, consider period measurement.
There’s some information available to refer:
Hope it helps!

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!