24
Instructor TA: Edgar Martinez Soberanes ([email protected]) 2019-08-01 Laboratory: Introduction to Mechatronics Lab 4. Stepper Motor (Motion Control).

Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Instructor TA: Edgar Martinez Soberanes([email protected])

2019-08-01

Laboratory: Introduction

to Mechatronics

Lab 4. Stepper Motor (Motion

Control).

Page 2: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Lab Sessions

Lab 1. Introduction to the equipment and tools to be used in the lab, which

include the development board (PICDEM 2 Plus),the microcontroller (PIC

16F1937), and the USB Oscilloscope (Analog Discovery).

Lab 2. Experiment 2: Transistor Operation, Experiment 3: Passive filters, and an

Op-Amp circuit experiment.

Lab 3. Experiment 7: LED Control and Interruptions.

Lab 4. Experiment 10: Stepper Motor Motion Control.

Lab 5. Experiment 11: DC Motor Speed Control Using PWM.

Lab 6. Experiment 12: Closed Loop DC Motor Position Control. 2

Page 3: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Lab 1. Outline

Objective.

Lecture

o Stepper Motor.

o Step motor controller (L297)

o Square wave signal.

o Input/output Ports.

Time for the experiments.

3

Page 4: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Objective

Objectives

o Design a complete system for motion control of a stepper motor using the PIC

and a step motor controller integrated circuit.

o Design a program to control: magnitude of speed, direction of rotation, and full-

step mode and half-step mode.

4

Page 5: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

5

Stepper Motor

Stepper motors are DC motors that move in discrete steps. They have multiple coils that are organized in groups called "phases". By energizing each phase in sequence, the motor rotates, one step at a time

o Positioning – Steppers move in precise repeatable steps, they excel in applications

requiring precise positioning such as in 3D printers, CNC, Camera platforms and

X,Y Plotters.

o Speed Control – Precise increments of movement also allow for excellent control

of rotational speed for process automation and robotics.

o Low Speed Torque - Normal DC motors don't have very much torque at low

speeds. A stepper motor has maximum torque at low speeds, so they are a good

choice for applications requiring low speed with high precision.

Page 6: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Step Count

Resolution is often expressed as degrees per step. A 1.8° motor is the same as a

200 step/revolution motor.

o Unipolar 2-phase, 7.5 degrees/step, 5 VDC stepper motor.

6

Page 7: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

7

How Stepper Motors Work

To move the rotor clockwise

(CW), the upper electromagnet

is deactivated and the right

electromagnet is activated,

causing the rotor to move 90

degrees CW, aligning itself with

the active magnet. This process

is repeated in the same manner

at the south and west

electromagnets until we once

again reach the starting

position.

Page 8: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

8

In half-stepping mode, instead of switching the next electromagnet in the rotation on

you turn on both electromagnets, causing an equal attraction between, thereby

doubling the resolution.

Half/Full-Stepping

Page 9: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

9

Stepper motor with PIC

The simplest way to operate a stepper motor with a PIC is with the full step pattern shown in

the Table below. Each part of the sequence turns on only one phase at a time, one after the

other. After the sequence is completed, it repeats infinitely until power is removed.

Page 10: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

10

The heart of the L297 is a block called translator which generates phase sequences for

half step and full step modes. The circuit (L297) is controlled by three inputs – direction

(CW/ CCW), HALF/ FULL – and a step clock which advances the translator from one step to

the next.

Stepper Motor Controller (L297)

Page 11: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

11

Stepper Motor Controller (L297)

HALF STEP MODE: Half step mode is selected by a high level on the HALF/FULL input.

Step Sequence: A B C D

Home or Reset position: A B D C = 0101

Page 12: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

12

Stepper Motor Controller (L297)

FULL STEP MODE: is selected by a low level on the HALF/FULL

Page 13: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

13

High-Current Darlington Transistor Arrays

(ULN2003A)

The ULN2003A device comprises seven high-voltage, high-current NPN Darlington transistor

pairs.

Each channel consists of Darlington connected NPN transistors. This connection creates the

effect of a single transistor with a very high-current gain (β2).

The very high current (β2) allows for high-output current drive with a very low input

current, essentially equating to operation with low GPIO voltages.

Typically, the ULN2003A device drives a high-voltage or high-current (or both) peripheral

from an MCU or logic device that cannot tolerate these conditions. Driving inductive loads

such as motors, solenoids and relays, is a common application of this IC.

Page 14: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

14

Summary

To control a stepper motor using the controller or driver L297 you only need 4 signals:

1.Enable (ON/OFF)

2.Stepping mode (Half/Full).

3.Direction of rotation (CW/CCW).

4.Speed (Clock)

The ULN2003A device allow us to drive devices such as inductive loads that require high

currents, with low voltages inputs.

Page 15: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

15

Square Wave Signal (Clock)

The square wave, also called a pulse train, or pulse wave, is a periodic waveform consisting

of instantaneous transitions between two levels.

Page 16: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Input/output Ports

5 ports (A,B,C,D, and E). Each port has different characteristics and

number of pins.

Ports are bidirectional (Input/Output).

Multi-functional. Some pins are multiplexed with an alternate

function. When a peripheral is enable, that pin may not work as a

general input/output.

16

Page 17: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

17

Each port has three standard registers for its operation:

o TRISx registers (data direction)

o PORTx registers (reads the levels on the pins)

o LATx registers (output latch)

Page 18: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Example Port A

TRISA register (PORTA Data Direction Register):

o Bit = 1 (pin on port A = Input)

o Bit = 0 (pin on port A = Output)

18

PORTA reads the status of the pins.

o Example: x = PORTA

LATA puts the content of the output latch on the port A.

o Example: LATA = 0; Make all the pins of port A equal to 0 V.

Note: Writes to PORTA are actually written to corresponding LATA register. Reads

from PORTA register is return of actual I/O pin values.

Page 19: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

19

Experiment:

1. Wire the proposed circuit.

2. Write a program to test both driving modes of the motor (Full/Half Step) and

try different rotation speeds and directions.

3. Using the USB Oscilloscope fully characterize your clock signal (Slide 15).

Page 20: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

20

Experiment:

Push Buttons RB0 and RA4

Page 21: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

21

Experiment:

Program:

o We require 2 inputs (push buttons)

o 4 outputs to drive the L297 controller (Enable, Direction, Mode, and Clock)

o Clock Signal

Page 22: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

22

Formal Report: The formal report must include the following:

1.Summary

2.Introduction

3.Objectives

4.Theory related to the lab (Step motors theory)

5.Apparatus (Brief description, on your own words, of each device used)

6.Procedure

7. Results (Main code of the program, with comments for each line of code, fully characterized clock signal or square wave, and observations of the motor behaviour)

8.Discussion (Elaborate on the differences observed in driving modes and speed. Did you find a minimum and maximum speed? Did you try different clock signals.

9.Conclusion

Page 23: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

23

Formal Report:

Page 24: Laboratory: Introduction to Mechatronics. to...5 Stepper Motor Stepper motors are DC motors that move in discrete steps.They have multiple coils that are organized in groups called

Thanks

24