want to convert rotary encoder pulses into angle for DC motor

9 views (last 30 days)
I'm using an rotary encoder to read the rotation of a DC motor with gearbox
i want to use Simulink to read channel A and B convert it to angle and then adjust control to the motor
unfortunately there is no block in Simulink to do that
i had the idea to read the 2 channels positive edge into edge triggered counter but I don't know how to create the condition statement in Simulink to increment and decrement the counter

Answers (1)

Joel Van Sickel
Joel Van Sickel on 5 May 2022
Hello Yousif,
this example has an implementation in Simulink for decoding a pulse stream. It's in the hall effect sensor subsystem.
You can use a switch to add a positive or negative value depending on the value's detected: https://www.mathworks.com/help/simulink/slref/switch.html
Regards,
Joel

Community Treasure Hunt

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

Start Hunting!