
- Suggested Learning Resources
- ACE-Lab Shop
- …
- Suggested Learning Resources
- ACE-Lab Shop
- Suggested Learning Resources
- ACE-Lab Shop
- …
- Suggested Learning Resources
- ACE-Lab Shop
DC Motor Speed PI Control Exercise | ACE-Lab DC Motor Speed PI Control
This exercise demonstrates discrete-time PI control for DC motor speed regulation using Arduino, Simulink, and encoder feedback. The controller regulates the motor to a 30 RPM reference, with performance assessed using settling time, overshoot, steady-state error, and disturbance rejection when a load is applied.
Introduction video for the DC Motor Speed PI Control exercise.1. Learning Outcomes
After completing this exercise, learners should be able to configure the motor hardware, explain PI speed control, implement the controller in Simulink, and evaluate the closed-loop response.
✓Configure the DC motor control circuitUse an Arduino Uno, Maker Drive motor driver, external power supply, and encoder feedback to prepare the speed control hardware.
✓Explain PI speed regulationDescribe how a proportional-integral controller can regulate DC motor speed against a target reference.
✓Implement a discrete-time PI controllerConfigure gain values, sample time, integral implementation method, and explain why PI control is suitable for speed regulation.
✓Evaluate speed-control performanceAssess settling time, overshoot, steady-state error, and load disturbance rejection.
2. Hardware Set-Up
This exercise builds on the encoder speed-measurement hardware. The arrangement is repeated here because the PI controller uses measured encoder speed as feedback for closed-loop motor speed control.
Required hardware:
- Arduino Uno
- Maker Drive motor driver board
- DC motor with encoder feedback
- 9V battery and clip
- Breadboard
- Breadboard wires, various
- USB cable
Set-up guidance
Connect the motor to the Maker Drive output terminals and connect the 9V battery to the motor power input. Add the Arduino control wires to the Maker Drive input pins so that the Arduino can set motor direction and apply PWM for speed control. Keep the Arduino and Maker Drive connected to a shared ground reference.
Figure 1: Hardware set-up for DC Motor Speed Measurement using Encoder, reused for the PI control exercise. 1Connect the DC motor wires to the Maker Drive motor output terminals. Use one motor channel, such as M1A and M1B.
2Connect the 9V battery positive wire to the Maker Drive motor power input, usually labelled VIN, VM, or +.
3Connect the 9V battery negative wire to the Maker Drive GND terminal.
4Connect a GND pin on the Arduino to the Maker Drive GND so both boards share the same reference voltage.
5Connect the Arduino 5V pin to the Maker Drive logic supply pin if required by the board.
6Use the breadboard to organise shared 5V and GND connections if needed.
7Connect the Arduino control pins to the Maker Drive input pins for direction and speed control.
8Connect the Maker Drive motor input pins for the selected motor channel to suitable Arduino digital or PWM pins.
9Check that the motor is connected only to the Maker Drive output terminals and not directly to the Arduino.
10Connect the Arduino to the computer using the USB cable.
3. Simulink Set-Up and Results
The Simulink model implements a discrete-time PI controller for DC motor speed control. The controller type, gains, sample interval, and integral implementation method are configured inside the PID Controller block.
Configure the controller type
Set the controller to operate as a PI controller in the discrete-time domain.
Set the sample time
Use a sample time of 0.01 seconds for the discrete-time controller implementation.
Use trapezoidal integration
Configure the integrator method as trapezoidal within the PID Controller block.
Apply the PI gains
Use the selected PI gains: proportional gain Kp = 0.1 and integral gain Ki = 0.05.
Scale the controller output
Use a gain block to scale the control signal to the 0 to 255 PWM range used by the 8-bit microcontroller output.
Figure 2: PI Control Algorithm Design. Figure 3: Block Parameters: PID Controller. 4. Performance Evaluation
The initial control requirements are used to judge whether the motor speed response meets the expected closed-loop behaviour.
Requirement 1: settling time of less than 2 seconds.Requirement 2: no overshoot.Requirement 3: zero steady-state error.Figure 4: PI Control Algorithm Design Outputs. Ramp improvement
A ramp could be applied initially to prevent the maximum control output from being applied immediately. Matching the ramp duration to the initial low-pass filter delay, just under 2 seconds, would reduce the initial power surge.
Load disturbance test
A load is applied to the DC motor for a period to test disturbance rejection. Visual inspection shows that the PI controller maintains the 30 RPM reference well, with only a slight drop in speed while the load is applied.
Figure 5: PID Control Algorithm Design Reference and Measured Output when a load is applied to the DC motor. Testing video for the DC Motor Speed PI Control exercise.5. Concluding Remarks
This exercise demonstrated the implementation of a PI controller for DC motor speed control using Arduino, Simulink, and encoder feedback. The controller was configured to regulate the motor speed to a reference value of 30 RPM while meeting the required performance criteria, including no overshoot and zero steady-state error.
The effect of applying a load to the motor was also examined, showing how feedback control helps maintain the desired speed under disturbance conditions.
Advancing automatic control engineering (ACE) education through global collaboration


