Position Control of a DC Motor with MATLAB using a Raspberry pi



Objective



Circuit Diagram




Motors Pins GPIO pins
C1 (Encoder Pulse A) 6
C2 (Encoder Pulse B) 5
IN1 23
IN2 24
ENA (PWM PIN) 21


Setup




Simulink Model






Output Graph







Working Video