DC Motor Closed Loop Control - Neel Mehta

Summary:

The objective of the experiment is to control both position and speed DC motor using a PWM signal from Arduino microcontroller in conjunction with an H-bridge circuit and also using closed loop PID control algorithm from which program or user would select either of the modes for closed loop position or speed control mode to operate. This includes controlling the speed of a DC motor using Pulse width modulation signal which is generated from Arduino microcontroller and then DC motor is driven by H Bridge which consists of various components to produce the output. Home-made low resolution encoder is prepared with slots on a solid disk made of tin is passed through 2 opto-interrupters which sends electrical signals to the microcontroller for controlling the position and speed.

Description of experiment:

Direct current (DC) motors have been used in variable speed drives for a long time. The versatile characteristics of dc motors can provide high starting torques which is required for traction drives. Control over a wide speed range, both below and above the rated speed can be very easily achieved. The methods of DC Motor speed control are simpler and less expensive than those of alternating current motors.

In this experiment, speed control is attained using PWM (Pulse Width Modulation) technique and PWM generation is done using microcontroller.

PRINCIPLE

Pulse width modulation (PWM) is a method for binary signals generation, which has 2 signal periods (high and low). The width (W) of each pulse varies between 0 and the period (T). The main principle is control of power by varying the duty cycle. Here the conduction time to the load is controlled. Let for a time t1, the input voltage appears across the load i.e. ON state and for t2 time the voltage across the load is zero.

  • The average voltage at output is given by

Va = Vmax.*    

Where,

TON      =Time period for Pulse ON,

TOFF     =Time period for Pulse OFF

  • The average load current Ia= Va/R = kVs/R where, T is the total time period =t1+t2, k = t1/T is the duty cycle.
  • The duty cycle can be varied from 0 to 1 by varying t1, T or f. Therefore, the output voltage V0 can be varied from 0 to Vsby controlling k, and the power flow can be controlled.
  • As the time t1 changes the width of pulse is varied and this type of control is called pulse width modulation (PWM) control.

For better understanding of PWM these diagrammatic representations can be used. These figures represent the waveforms obtained as output at different voltage requirements.

High Speed Signal (90%): The green part of the signal represents the ON time and the white part of it represents time when it is not receiving any voltage

Signal with half voltage (50%):

Signal with low voltage (10%):

In this way the average value of resultant voltage is varied. When PWM technique is used to control the speed of dc motor, the average value of voltage given to motor is varied in similar manner, hence varying the speed of the motor.

WORKING

Pulse width modulation is implemented using a microcontroller, dependent on an input value for generating variable pulse widths, for driving motor at variable speed. Therefore, the input value used is given with the help of potentiometer.

The 2 terminals of potentiometer are connected to Vcc & GND, resulting in variable voltage in range of 0-5V, in the terminal W of potentiometer. This pin serves as the input for microcontroller. The ATmega8L has inbuilt 10 bit ADC (Analog to Digital Converter), which means it can convert any analog value between 0-5V to digital value of 10 bit resolution. The program for generating results for pulse width is written into Arduino microcontroller. The variable output (between 0-5V) goes to the A (Analog Input) pin of the ADC (Analog to Digital Converter) of the microcontroller and gets converted into 10 bit binary value. This 10 bit binary value gets converted into corresponding decimal value of range 0-1023 (as 210=1024), which is responsible for triggering the output pin of microcontroller, for particular time duration, which further triggers the MOSFET for same duration.

Opto-isolator The Opto-isolator PS2501-2 is optically coupled isolators containing a GaAs light emitting diode and an NPN silicon phototransistor. The PS2501-1, are in a plastic DIP (Dual In-line Package) and the PS2501L-1, -4 are lead bending type (Gullwing) for surface mount. Features:

  • High isolation voltage (BV = 5 000 Vr.m.s.) •
  • High collector to emitter voltage (VCEO = 80 V)
  • High-speed switching (tr = 3 μs TYP., tf = 5 μs TYP.) •
  • Ordering number of tape product: PS2501L-1-F3: 2 000 pcs/reel • Safety standards • UL approved: No. E72422

H-bridge:

The DC motor is driven using the H-bridge circuit comprising of four MOSFET power transistors (two of them are p-channel (IRF9520) and the other two are n-channel (IRF511/IRF510) MOSFET transistors), four diodes (1N4003) and the motor itself. Each MOSFET pair on each side of H-bridge consists of a p-channel on the top and an n-channel on the bottom as shown in the circuit diagram. The motor connects in between the two legs. The p-channel sources terminal are connected to 9 V and the drain terminals are connected to motor leads, whereas the sources terminals of n-channel are connected to ground and drain terminals are connected to motor leads. The gate terminals of left side MOSFET pair are connected to PWM1 and right side MOSFET pair is connected to PWM2.

IRF510 and IRF9520 (MOSFET)

The IRF510 Power MOSFETs provide the designer with the best combination of fast switching, ruggedized device design, low on-resistance and cost-effectiveness. The TO-220AB package is universally preferred for all commercial-industrial applications at power dissipation levels to approximately 50 W. The low thermal resistance and low package cost of the TO-220AB contribute to its wide acceptance throughout the industry.

Encoder: A low-resolution homemade incremental encoder disk is made with evenly spaced holes such that it will block and pass the light alternately. The logic is higher the number of holes, the better the position sensor resolution, but more difficult to mechanically assemble the experiment. So, we made 3 slots on the disk made up of tin. Two Opto-interruptors are placed such that the disk passes in-between opto-interruptor. As disk rotates, the light path is interrupted by or not interrupted by the holes and solid sections of the disk. If we use only one opto-interruptor, we can detect the change of position, but we cannot detect the direction of position change, that is we cannot detect direction of speed. So, the second opto-interruptor is used for that purpose. The second opto interruptor is mechanically placed at a 90-degree mechanical phase angle relative to the first opto-interruptor position over the hole-solid sections of the disk. Note that 360 degree is considered a complete cycle of the whole solid section of the disk. If the disk is rotating in clockwise direction (forward), the digital output signal from opto-interrupter #1 would lead the signal from the opto-interrupter #2 by 90 degree phase angle. If the disk is rotating in counter clockwise direction (reverse), the opposite would happen.

Components:
Item Quantity
DC Motor 1
Optoisolator 1
Potentiometer (200 Ω) 1
IRF510 (MOSFET) 2
IRF9520 (MOSFET) 2
IN4003 Diode 4
Arduino UNO R3/Connectors     1 set
Opto-interrupter 2
Encoder (Disk with holes) 1
Procedure:
  1. Constructed circuit on the breadboard using required components shown in circuit diagram.
  2. Home-made low resolution encoder is prepared with solid disk with 3 slots on it and 2 opto-interrupters which sends electrical signals to the microcontroller
  3. The motor current control and PWM circuit is same as in the previous experiment that is DC Motor Open Loop Control, which consisted of H-bridge amplifier (power stage) and the Arduino microcontroller interface to it via PWM output channels.
  4. The circuit of previous experiment and encoder is combined for this experiment
  5. The code is written and uploaded to on arduino microcontroller to measure the actual position and speed
  6. In this case, as we have to control both position and speed hence, a closed loop PID control algorithm is suitable so, we programed a closed loop PID control algorithm which is used either for closed loop position control or closed loop speed control. Program or user should select which mode (closed loop position or speed control mode) to operate.
  7. The desired position and speed control trajectories are programmed as a function of time in the control algorithm and tests the closed loop position control. For instance, command 1/4 rev rotations in forward and reverse directions, command slow and fast speeds in forward and reverse direction.
  8. In closed loop position control mode, while holding current position and when tried to disturb the rotor position, the motor react to keep its current position
  9. Demonstrate that you can control the motor position or velocity to any desired value and direction.
  10. The smallest positioning accuracy we achieved with this system is 60 degrees
  11. The output is obtained in arduino microcontroller software.

 

Circuit Diagram:

circuit dia

Circuit:

Circuit

Ardiuno Setup:

Ardiuno Setup

Encoder:

Encoder

Arduino Code:

void setup

References:

Prof. Cetinkunt, Sabri. Mechatronics with Experiments – Second Edition. Sussex: John Wiley & Sons Ltd, 2015

Share this:

  • X
  • Facebook
Like Loading...

Tag » Arduino Dc Motor Closed Loop Speed Control