Stepper Motors in C. Unipolar (5 lead) stepper motorr. $1.95 from 100 steps per rotation. 24V / 160mA / 600 gm cm holding 160mA

Similar documents
Stepper Motors & Look Up Table

Assembly Language. Topic 14 Motion Control. Stepper and Servo Motors

MICROCONTROLLERS Stepper motor control with Sequential Logic Circuits

Real Time Embedded Systems. Lecture 1 January 17, 2012

combine regular DC-motors with a gear-box and an encoder/potentiometer to form a position control loop can only assume a limited range of angular

Stepper Motors and Control Part I - Unipolar Stepper Motor and Control (c) 1999 by Rustle Laidman, All Rights Reserved

Name & SID 1 : Name & SID 2:

EEE3410 Microcontroller Applications Department of Electrical Engineering Lecture 11 Motor Control

Embedded Systems Lab Lab 7 Stepper Motor Application

Lab 8. Stepper Motor Controller

EXPERIMENT 6: Advanced I/O Programming

Controlling Stepper Motors Using the Power I/O Wildcard

Introduction to Relays. ECE/CS 5780/6780: Embedded System Design. Various Relay Configurations. Types of Relays. Drawing of an EM Relay

SRI SUKHMANI INSTITUTE OF ENGINEERING & TECHNOLOGY DERA BASSI DEPARTMENT: ELECTRONICS & COMM. LABORATORY MANUAL LAB: EMI SUBJECT CODE: SEMESTER: 4th

THE UNIVERSITY OF BRITISH COLUMBIA. Department of Electrical and Computer Engineering. EECE 365: Applied Electronics and Electromechanics

Electric Power Systems 2: Generators, Three-phase Power, and Power Electronics

Automatic Railway Gate Control & Track Switching

Half stepping techniques

ME430 Mechatronics. Lab 2: Transistors, H Bridges, and Motors. Name. Name. The lab team has demonstrated:

Binary Outputs: Transistors Used as a Switch

2.017 DESIGN OF ELECTROMECHANICAL ROBOTIC SYSTEMS Fall 2009 Lab 4: Motor Control. October 5, 2009 Dr. Harrison H. Chin

AN Industrial Stepper Motor Driver. Application Note Abstract. Introduction. Stepper Motor Control Method

L E C T U R E R, E L E C T R I C A L A N D M I C R O E L E C T R O N I C E N G I N E E R I N G

NJM37717 STEPPER MOTOR DRIVER

Administrative Notes. DC Motors; Torque and Gearing; Encoders; Motor Control. Today. Early DC Motors. Friday 1pm: Communications lecture

PBL 3717/2 Stepper Motor Drive Circuit

STEPPER MOTORS. Intro to Stepper Motors

Laboratory Seven Stepper Motor and Feedback Control

Introduction to Stepper Motors

Portland State University MICROCONTROLLERS

ELM313 Stepper Motor Controller

Driving DC and Stepper Motors

User Guide IRMCS3041 System Overview/Guide. Aengus Murray. Table of Contents. Introduction

Basic of PCD Series Pulse Control LSIs

ECE 445 Spring 2017 Autonomous Trash Can. Group #85: Eshwar Cheekati, Michael Gao, Aditya Sule

Experiment#6: Speaker Control

UNIT 9 DC Separately-Excited Generator

NJM3777 DUAL STEPPER MOTOR DRIVER NJM3777E3(SOP24)

EE445L Fall 2011 Quiz 2A Page 1 of 6

EDE1204 Bi-Polar Stepper Motor IC

DUAL STEPPER MOTOR DRIVER

Lab Exercise 9: Stepper and Servo Motors

2012 Texas Instruments Motor Control Training. -V th

MOSFET as a Switch. MOSFET Characteristics Curves

High-Torque/High-Power Bipolar Stepper Motor Driver Using 8-bit PIC Microcontroller. Over Temperature Detection COG1 COG1C COG2

Robot Actuators. Motors and Control. Stepper Motor Basics. Increased Resolution. Stepper motors. DC motors AC motors. Physics review: Nature is lazy.

Brushed DC Motor Microcontroller PWM Speed Control with Optical Encoder and H-Bridge

Application Note, V1.0, Oct 2006 AP08019 XC866. Sensorless Brushless DC Motor Control Using Infineon 8-bit XC866 Microcontroller.

School of Engineering Mechatronics Engineering Department. Experim. ment no. 1

Designated client product

Stepper Motor Board. User Manual. 1.0, Oct 2013

NJM3771 DUAL STEPPER MOTOR DRIVER

ECE Solution to Homework #4

AN Driving stepper motors using NXP I 2 C-bus GPIO expanders. Document information

More Fun with A/D Converters

Implementation of Brushless DC motor speed control on STM32F407 Cortex M4

The Motor sketch. One Direction ON-OFF DC Motor

Design with Microprocessors Year III Computer Science 1-st Semester

HIGH-POWER, DUAL-BRIDGE ICs EASE STEPPER-MOTOR-DRIVE DESIGN

Stepping Motor. Applications. Structure and operation. Code names. Mobile equipment Digital cameras, Mobile equipments, PDA, etc.

Conventional Paper-II-2011 Part-1A

CIS009-2, Mechatronics Signals & Motors

L297 L297A STEPPER MOTOR CONTROLLERS

Appendix 1. Basic Electronics. The PIC Hardware. Using Transistors (Basic Electronics)

Figure 1: Motor model


Actuators. DC Motor Servo Motor Stepper Motor. Sensors

가치창조기술. Motors need a lot of energy, especially cheap motors since they're less efficient.

MLA High Performance Microstepping Driver. User s Guide E. Landon Drive Anaheim, CA

Placement Paper For Electrical

PBL 3775/1 Dual Stepper Motor Driver

Lazy Clock Electronics and Software

Application Note. I C s f o r M o t o r C o n t r o l. Evaluation board for the TDA5143/TDA5144. Report No: EIE/AN R. Galema

Autonomous Robot Control Circuit

Page 1. Relays. Poles and Throws. Relay Types. Common embedded system problem CS/ECE 6780/5780. Al Davis. Terminology used for switches

A Unipolar Stepper Motor Drive Using the Z8 Encore! MCU

The Mechatronics Sorter Team Members John Valdez Hugo Ramirez Peter Verbiest Quyen Chu

Inductance, capacitance and resistance

ELG2336 Introduction to Electric Machines

Step vs. Servo Selecting the Best

INSTITUTE OF AERONAUTICAL ENGINEERING (AUTONOMOUS) Dundigal, Hyderabad

Stepping motor controlling apparatus

Step Motor Controller I. Introduction II. Step Motor Basics

University of Texas at El Paso Electrical and Computer Engineering Department

Dual Full-Bridge PWM Motor Driver AMM56219

Designated client product

:for... A G!,Jide to Stepp~s~ Se~o~, ~,6d ~er Electrical M~chines

LV8716QAGEVK Evaluation Kit User Guide

USER S GUIDE POLOLU A4988 STEPPER MOTOR DRIVER CARRIER USING THE DRIVER POWER CONNECTIONS

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad

Simulation Study of MOSFET Based Drive Circuit Design of Sensorless BLDC Motor for Space Vehicle

ECE 5670/6670 Project. Brushless DC Motor Control with 6-Step Commutation. Objectives

unit: mm 4130 Parameter Symbol Conditions Ratings Unit Maximum supply voltage 1 V CC 1 max No input signal 50 V Maximum supply voltage 2 V CC

User Guide Introduction. IRMCS3043 System Overview/Guide. International Rectifier s imotion Team. Table of Contents

Upgrading from Stepper to Servo

30-80V, 8.2A Peak, No Tuning, Nulls loss of Synchronization

NJM3773 DUAL STEPPER MOTOR DRIVER

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

DISCONTINUED PRODUCT FOR REFERENCE ONLY. See A3967 or A3977 for new design. BiMOS II UNIPOLAR STEPPER-MOTOR TRANSLATOR/DRIVER FEATURES

OHM S LAW AND CIRCUITS. Mr. Banks 8 th Grade Science

Transcription:

U tepper Motors ugust 22, 2017 tepper Motors in Unipolar (5 lead) stepper motorr. $1.95 from www.mpja.com 100 steps per rotation. 24V / 160m / 600 gm cm holding torque @ 160m stepper motor is a digital motor with two phases and 4, 5, or 6 leads. These leads connect to two sets of electromagets. The main difference is the addition of a center tap for the two electromagnets: black black white 4-Lead (bipolar) 5-Lead (unipolar) 6-Lead (unipolar) 4-lead stepper motors are typically higher power (higher torque) and require an H-bridge to operate. 5-lead and 6-lead motors are easier to interface to a microprocessor but only use half of the winding, resulting in less torque. With a 5-lead stepper motor, the center taps are shorted together, resulting in essentailly four separate electromagnets: red 134 Ohms 134 Ohms white black 134 Ohms green 134 Ohms brown To make the motor spin, there are several options. page 1

U tepper Motors ugust 22, 2017 ase 1: 5V Operation The stepper motor in your kits is rated at +24V. It will operate at 5V as well, just without as much holding torque. Each phase has a resistance of 134 Ohms to the center tap (ground in this case), resulting in the stepper motor drawing 37m. This is a little more than the 25m rated for the PI, but there's always some engineering tolerance. Just don't run it too long. If you connect your PI to the stepper motor as follows: R7 R6 R5 R4 R3 R2 R1 R0 - - - - - - - - white brown green red with the center tap (black) tied to ground, you can make the motor spin by energizing each coil sequentially: 5V 5V 5V 5V 5V ote that when is energized, current flows the opposite direction as when is energized. This results in the electromagnet attracting the north or sourth poles of the rotor magnet respectively. To make the motor spin, output the following sequence to PORT (termed full stepping) : 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 repeat Each step causes the motor to rotate 3.6 degrees, giving the motor 100 steps per rotation. You can also do half-steps. This increases the resolution of a stepper motor by a factor of two or 200 steps per rotation for the motor in your lab kits 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 0 0 0 1 0 0 1 repeat page 2

U tepper Motors ugust 22, 2017 ase 2: 5V.. 24V Operation Unipolar tepper Motor (0 to 4) The stepper motor in your kit is rated at +24V. To get more voltage to your stepper motor, onnect the center tap (black) to your power supply. +12V is used in this example. onnect each phase to ground using a transistor. +12V a0 a1 a2 300 300 a0 a1 a2 +12V b1 b0 300 b0 b1 b2 300 b2 Each transistor acts as a switch. When the PI applies +5V to, transistor Qa saturates, allowing current to flow. The current you're allowing is I c = 12V 134Ω = 89.6m ssuming a 3906 P transistor with a gain of 100, to saturate the transistor you need at least 0.89m I b > I c β = 0.896m The base resistor can then be anything less than 4948 Ohms R b < 5V 0.7V = 4948Ω 0.869m. The lower limit on Rb is 25m: the maximum current a PI can output R b > 5V 0.7V 25m = 172Ω 300 Ohms is an overkill, but it works. The nice thing about this design is It works for any voltage: you can connect the center tap to +5V, +12V, +24V, or whatever the stepper motor needs. It works for currents up to 200m for 3904 transistors (4 cents each) or 4 for Zetex 1049 transistors (78 cents each). The problem is you lose some torque: by using the center tap you're only using half of each electromagnet. page 3

U tepper Motors ugust 22, 2017 ase 3: 5V to 12V Operation, <800m ($0.99 solution) third option is to use a stepper motor driver chip from ebay H-ridge river from ebay. ote that the limits are +12V, +800m. This is essentially a dual H-bridge and works best for 4 and 6 lead stepper motors. It sort of works for 5-lead stepper motors as well. 1-1- Motor 1 Motor 2 Motor 1-2 5V +Vcc +Vcc 5V +Vcc -Vcc 5V 5V +Vcc +Vcc If you connect the center tap (black) to ground, you can drive the stepper motor as before with R2 R0 +5V R4 R1 PI oard 1 1 Vcc g 1 1 L9110 oard Motor Motor re br gr wh tepper Motor bk onnections for the L9110 H-ridge tepper Motor river board with a 5-lead stepper motor. page 4

U tepper Motors ugust 22, 2017 Input Output 1-1- 1-1- Motor 1 Motor 2 Motor 1 Motor 2 R0 R2 R1 R3 (red) (br) (gr) (wh) enter Tap (black) tied to ground If you need more than 800m, you need a different (and more expensive) H-bridge. For example, $1.99 will get you a stepper motor driver capable of 2 and +35V. Hmmm. We might get these for next year. Regardless, the interface is the same. If you need more power, Jameco (and ebay and Marlin P Jones) has nice stepper motors. For example, one of their larger stepper motors has the following specs: EM 34 stepper motor from www.jameco.com. Part number 237631 6.3V, 1.5 operation 14,276 gm - cm holding torque (24 time the holding torque) 2.43 pounds $39.95 each (20 times more expensive) page 5

U tepper Motors ugust 22, 2017 ample ode: ase 1: Full-tepping Every 500ms ( tepper1. ) simple way to walk through the 1/0 pattern is to use a table. The following program cycles through the table with each step taking 100ms // tepper1. // rive a stepper motor at 100ms/step // Global Variables const unsigned char MG[16] = "tepper1. "; unsigned char TLE[4] = {1, 2, 4, 8; while(1) { TEP = TEP + 1; PORT = TLE[TEP % 4]; L_Move(1,0); L_Out(TEP,0); Wait_ms(100); On PORT, you should see the following bit pattern with it changing every 100ms. R3 R2 R1 R0 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 (repeat) If you want to step the other way, simple decrement TEP every 100ms. If you want to step faster, change the wait() function. page 6

U tepper Motors ugust 22, 2017 ase 2: tep using Timer2 interrupts. (tepper2.) Problem: tep the motor every 100ms. If you want more precise timing with the stepping, you can step using interrupts. First, set up Timer2 for 1ms (10,000 clocks), = 10 = 250 = 4 ext, inside the interrupt routine, step the motor every 100th interrupt (100ms). // Global Variables unsigned char TLE[4] = {1, 2, 4, 8; int TEP, TIME, ; // High-priority service void interrupt Interve(void) { if (TMR2IF) { TIME = TIME + 1; = ( + 1) % 100; if ( == 0) { TEP = TEP + 1; PORT = TLE[TEP % 4]; TMR2IF = 0; Turn on Timer2 interrupts for 1ms // initialize Timer2 T2O = 0x4; PR2 = 249; TMR2O = 1; TMR2IE = 1; PEIE = 1; ince everything is done inside the interrupt, the main routine is free to do whatever you like - such as display the present angle of the motor: while(1) { L_Move(1,0); L_Move(1,8); L_Out(TIME,3); L_Out(TEP,0); page 7

U tepper Motors ugust 22, 2017 ase 3: djust the speed the stepper motor steps using push buttons: (tepper3.) R4: Forward, 30ms / step R3: Forward, 100ms / step R2: top R1: Reverse, 100ms / step R0: Reverse, 30ms / step hange the hard numbers in the previous code to variables, which are changed based upon the button you press: // Global Variables unsigned char TLE[4] = {1, 2, 4, 8; int TEP, TIME; int IR, PEE; // High-priority service void interrupt Interve(void) { if (TMR2IF) { TIME = TIME + 1; if (R4) { IR = 1; PEE = 30; if (R3) { IR = 1; PEE = 100; if (R2) { IR = 0; PEE = 100; if (R1) { IR =-1; PEE = 100; if (R0) { IR =-1; PEE = 30; = ( + 1) % PEE; if ( == 0) { TEP = TEP + IR; PORT = TLE[TEP % 4]; TMR2IF = 0; page 8

U tepper Motors ugust 22, 2017 ase 4: Position ontrol via push buttons (tepper4.) Have the stepper motor go to the following positions based upon which button is pressed: R4: 100 steps (360 degrees) R3: 75 steps (270 degrees) R2: 50 steps (180 degrees) R1: 25 steps (90 degrees) R0: 0 steps (0 degrees) Move the stepper motor at a speed of 10ms/step. To do this, define two new global variables: int TEP; int REF; // the present position of the stepper motor // the desired position hange the Timer2 interrupt as follows: // High-priority service void interrupt Interve(void) { if (TMR2IF) { if (R4) REF = 100; if (R3) REF = 75; if (R2) REF = 50; if (R1) REF = 25; if (R0) REF = 0; TIME = (TIME + 1) % 10; if (TIME == 0) { if (TEP < REF) TEP += 1; if (TEP > REF) TEP -= 1; PORT = TLE[TEP % 4]; TMR0IF = 0; The interrupts do all the work. In the main routine, you can watch what's happening with: while(1) { L_Move(0,0); L_Move(0,8); L_Move(1,8); L_Out(TIME,3); L_Out(REF,0); L_Out(TEP,0); page 9

U tepper Motors ugust 22, 2017 Microstepping: stepper motor is actually an synchronous machine: If you send a square wave to the motor, it jumps from one angle to another: it is operating as a stepper motor. For the motor above, it has 100 steps per rotation. If you send a sine wave to the motor, it smoothly moves from one angle to another: it is operating as an synchronous machine. For the motor above, it rotates once per 25 cycles: 100 steps revolution 1cycle 4steps = 25 cycles revolution If you apply a 60Hz sine wave to the above motor (sine on phase, cosine on phase ), it will spin at 60 cycle sec 1 revolution 25 cycles = 2.4 rps = 144 rpm For example, if you look at the voltage applied to phase, when using full stepping the voltage V looks like the blue line in the following figure (shown for two cycles): 1 0 0 0 V = 1 0 1 0 0 V = 0 0 0 1 0 V = -1 0 0 0 1 V = 0 repeat If you use a sine wave instead, you'll be able to position the motor inbetween steps. This is shown in the red line below: ignal sent to V when using full steps (blue line) or microstepping (red line). V would be 90 degrees out of phase (cosine vs. sine). page 10