Stepper Motor DC Motor Interfacing and PWM 1

  • Slides: 19
Download presentation
Stepper Motor, DC Motor Interfacing and PWM 1

Stepper Motor, DC Motor Interfacing and PWM 1

DC Motor -Translates electrical pulses into mechanical movement. -Only have + and – leads.

DC Motor -Translates electrical pulses into mechanical movement. -Only have + and – leads. - The maximum speed of a DC motor is indicated in rpm. -DC motor has 2 rpm: 1) no-load 2)loaded -RPM is reduced when increase a load -Nominal voltage (1 to 150 V) ; Increase voltage, the rpm goes up 2

Unidirectional control Figure shows the DC motor rotation for clockwise (CW) and counterclockwise (CCW)

Unidirectional control Figure shows the DC motor rotation for clockwise (CW) and counterclockwise (CCW) rotations. 3

Bidirectional control -With the help of relays, transistor or some specially chips(L 293) we

Bidirectional control -With the help of relays, transistor or some specially chips(L 293) we can change the directional of the motor rotation. -Figure shows the basic concept of H-Bridge using simple switches. S 1 S 2 M S 3 S 4 4

 • Figure below shows for turning the motor in one direction. (S 1

• Figure below shows for turning the motor in one direction. (S 1 and S 4 are closed or S 2 and S 3 are closed. • The invalid configuration will appear if all the switches are closed (Short circuit) S 1 S 2 M S 3 S 4

Example: Write C program to monitor the status of Switch (SW) and perform the

Example: Write C program to monitor the status of Switch (SW) and perform the following: (a) If SW=0, the DC motor moves with 50% duty cycle pulse. (b) If SW=1, the DC motor moves with 25% duty cycle pulse. #include <p 18 f 4580. h> #define SW PORTDbits. RD 7 #define MTR PORTBbits. RB 1 else Void Delay (unsigned int value); Void main() { TRISD=0 x 80; TRISB=0 x. FD; While(1) { if(SW==1) { MTR=1; Delay(25); MTR=0; Delay(75); } { MTR=1; Delay(50); MTR=0; Delay(50); } } Void Delay(unsigned int value) { Unsigned char x, y; For (x=0; x<1275; x++) For(y=0; y< value; y++) }

Pulse Width Modulation (PWM) Unit Peperiksaan, Bahagian Pengurusan Akademik, Jabatan Pendaftar 7

Pulse Width Modulation (PWM) Unit Peperiksaan, Bahagian Pengurusan Akademik, Jabatan Pendaftar 7

Pulse Width Modulation (PWM) -Pulse-width modulation (PWM) is a very efficient way of providing

Pulse Width Modulation (PWM) -Pulse-width modulation (PWM) is a very efficient way of providing intermediate amounts of electrical power between fully on and fully off. -PWM is so widely used in DC motor control - The wider the pulse, the higher the speed. 8

H-Bridge Circuit -Widely used to control the rotation of DC motor -Most of the

H-Bridge Circuit -Widely used to control the rotation of DC motor -Most of the switches in H-Bridge circuit are designed using BJT or FET switches - We just focus on DC motor control with ECCP 9

DC motor Control with ECCP -PIC 18 comes with one standard Compare Capture PWM

DC motor Control with ECCP -PIC 18 comes with one standard Compare Capture PWM (CCP) and one Enhance CCP (ECCP) -ECCP allows the implementation of the H-Bridge for bi-directional control of the DC motor. -It uses 4 pins (P 1 A, P 1 B, P 1 C, P 1 D; (RD 4 -RD 7) as shown in Figure below. 10

Circuit of Full Bridge Application Pg 666 DC Motor 11

Circuit of Full Bridge Application Pg 666 DC Motor 11

ECCP control register, pg 667 12

ECCP control register, pg 667 12

Example pg 668; Full implementation of the PWM for ECCP module. #include<p 18 f

Example pg 668; Full implementation of the PWM for ECCP module. #include<p 18 f 4580. h> Void main() { TRISD=0; PR 2=100; ECCPR 1 L=50; // register for ECCP 1 CON=0 x. CF; // reverse full-bridge PWM T 2 CON=0 x 24; // 4 postscaler, turn on TMR 2 While(1) { TMR 2=0; //start pulse PIR 1 bits. TMR 2 IF=0; while(PIR 1 bits. TMR 2 IF==0); //wait period } } 13

Stepper Motor Interfacing -Translates electrical pulses into mechanical movement. -Stepper motors commonly have a

Stepper Motor Interfacing -Translates electrical pulses into mechanical movement. -Stepper motors commonly have a permanent magnet rotor (shaft) -Surrounded by stator. Common stepper motor have four stator windings that are paired with a center-tapped. -Is known as four phase or unipolar stepper motor. 14

Stepper Motor Interfacing cont. -As the direction of the current changed, the polarity is

Stepper Motor Interfacing cont. -As the direction of the current changed, the polarity is also changed causing the reverse motion of the rotor. -Stepper motor has six leads: 4 leads representing the four stators and 2 for center-tapped leads. -There are several widely used sequences, each has a different degree precision. Step Winding A Winding B Winding C Winding D 1 1 0 0 1 2 1 1 0 0 3 0 1 1 0 4 0 0 1 1 15

Stepper Motor Interfacing cont. -The 4 leads of stator windings are controlled by PIC

Stepper Motor Interfacing cont. -The 4 leads of stator windings are controlled by PIC 18 port (RB 0 -RB 3). PIC lack sufficient current to drive stepper motor, so use driver ULN 2003. 16

Stepper Motor Interfacing cont. -How much movement is issociated with a single step? -Step

Stepper Motor Interfacing cont. -How much movement is issociated with a single step? -Step angle-minimum degree of rotation with single step. -Steps per rev – total no. of steps to complete 360 deg. Step Angle Step per Revolution 0. 72 1. 8 2. 0 500 200 180 2. 5 144 5. 0 72 7. 5 48 15 24 17

Stepper Motor Interfacing cont. Steps per second and rpm relation -Steps per sec =

Stepper Motor Interfacing cont. Steps per second and rpm relation -Steps per sec = (rpm x Steps per revolution) / 60 4 - Step sequence and number of teeth on rotor. -How much movement is associated with these four steps? -After completing four steps, the rotor moves only one tooth pitch. -So if 200 steps per revolution, rotor moves 50 teeth, 4 x 50=200 -Example 17 -2 pg 645 18

Example: A switch (SW) is connected to pin RD 7. Write a C program

Example: A switch (SW) is connected to pin RD 7. Write a C program to monitor the status of SW and perform the following: a) If SW=0, the stepper motor moves clockwise b) If SW=1, the stepper motor moves counter clockwise 1. 2. 3. 4. Ans: #include<p 18 f 4580. h> #define SW PORTDbits. RD 7 Void Delay(int ms); 5. Void main() 6. { 7. TRISD=0 x 80; 8. TRISB=0 x 0; 9. While(1) { 10. If (SW==0) 11. { 12. PORTB=0 x 66; 13. Delay(100); PORTB=0 x. CC; Delay(100); PORTB=0 x 99; Delay(100); PORTB=0 x 33; Delay(100); 1. } Else { PORTB=0 x 66; Delay(100); PORTB=0 x 33; Delay(100); PORTB=0 x 99; Delay(100); PORTB=0 x. CC; Delay(100); } } } Void Delay(unsigned int value) { unsigned int x, y; For(x=0; x<1275; x++) For(y=0; y<value; y++) } 19