13
Stepper Motor Control System The stepper motor control system uses ULN2003 chip to drive. The working voltage is DC5V. It is widely used on ATM machine, inkjet printer cutting plotter, fax machine,spraying equipment, medical instruments and equipments, PC peripheral, and USB Mass Storage ,precise instrument industrial control system,office automation,robot areas,etc.

Stepper Motor Control System

Embed Size (px)

Citation preview

Page 1: Stepper Motor Control System

Stepper Motor Control SystemThe stepper motor control system uses ULN2003 chip to drive.

The working voltage is DC5V. It is widely used on ATM machine, inkjet printercutting plotter, fax machine,spraying equipment, medical instruments and equipments, PC peripheral, and USB Mass Storage ,precise instrumentindustrial control system,office automation,robot areas,etc.

Page 2: Stepper Motor Control System
Page 3: Stepper Motor Control System

Functions1)When start up, the stepper motor will rotate in the clockwise, at the same time the LCD will display the stepping rate and rotating directions 2)When you press the key1, the stepper motor will rotate in the counterclockwise. 3)When you turn the potentiometer to the left or to the right, you can adjust the stepping rate of the stepper motor. At the same tine the LCD will display the current speed.

物料清单:1)ICStation ATMEGA328 UNO V3.0 R3 Board Compatible Arduino

http://www.icstation.com/product_info.php?products_id=35162)1602A HD44780 Character LCD Display Modulehttp://www.icstation.com/product_info.php?products_id=14193)830 Point Solderless PCB Bread Board MB-102 Test DIYhttp://www.icstation.com/product_info.php?products_id=1450 4)ULN2003AN DIP-16 TI Darlington Transistor Arrayhttp://www.icstation.com/product_info.php?products_id=215)50K Ohm B50K Knurled Shaft Linear Rotary Taper Potentiometerhttp://www.icstation.com/product_info.php?products_id=6866)Trim Pot Resistor Potentiometerhttp://www.icstation.com/product_info.php?products_id=18507)12X12X5mm Tact Switches 4 Legshttp://www.icstation.com/product_info.php?products_id=9498)Bread Board Jump Line Jumper Wire

Page 4: Stepper Motor Control System

http://www.icstation.com/product_info.php?products_id=20259)10pcs Dupont 20cm Color Cable Linehttp://www.icstation.com/product_info.php?products_id=326910)5V 4 Phase 5 Line 28BYJ-48 5VDC Stepper Motorhttp://www.icstation.com/product_info.php?products_id=220411)+5V DC power supply

部分物料实物图如图 1所示。

Page 5: Stepper Motor Control System

In-system programmer

stepper

Icstation boardLCD 1602

ULN2003 chip

Slide rheostat

Bread line

Bread boardkey

DC+5V Power

Page 6: Stepper Motor Control System

Schematic Diagram:

1.Plug into the power suppl and place the components

Page 7: Stepper Motor Control System
Page 8: Stepper Motor Control System

2.Connect the LCD1602

Page 9: Stepper Motor Control System
Page 10: Stepper Motor Control System

图 4 LCD1602连线图3.Connect the stepper motor

Page 11: Stepper Motor Control System
Page 12: Stepper Motor Control System

4.Connect the signal end of the components and the cathode and anode of the power supply to the ICStation board and common port of power supply

Page 13: Stepper Motor Control System
Page 14: Stepper Motor Control System

Connect the signal end and power supply end5.The experimental effect after starting up the power supply

Page 15: Stepper Motor Control System
Page 16: Stepper Motor Control System

Overall hardware connected diagram

Program design#include <Stepper.h>#include <LiquidCrystal.h>int Iint1=0;int Iint2=1;int anjian1=2;int anjian2=3;int motorSpeed;LiquidCrystal lcd(9,8,7,6,5,4);const int stepsPerRevolution =200;// Here set the stepper motor rotation step how much is a circle

Page 17: Stepper Motor Control System

int dim=stepsPerRevolution;// Set the step motor number and pinStepper myStepper(stepsPerRevolution, 10,11,12,13); void setup(){ lcd.begin(16, 2); lcd.print("speed:"); lcd.setCursor(10,0); lcd.print("n/min"); lcd.setCursor(0, 1); lcd.print("Direction:"); // Set the motor speed of 60 steps per minute

myStepper.setSpeed(60); pinMode(anjian1,INPUT_PULLUP);

pinMode(anjian2,INPUT_PULLUP); attachInterrupt(Iint1,counterclockwise,FALLING); attachInterrupt(Iint2,clockwise,FALLING); Serial.begin(9600);}

void loop() { myStepper.step(dim); void Direction(); // Read the sensor values: int sensorReading = analogRead(A0);

Page 18: Stepper Motor Control System

// Map it to a range of 0-150: int motorSpeed = map(sensorReading, 0, 1023, 0, 150); // Set the motor speed: if (motorSpeed > 0) { myStepper.setSpeed(motorSpeed); lcd.setCursor(6,0); lcd.print(float(float(motorSpeed)/float(200))); } } void clockwise() { // clockwise rotation dim=stepsPerRevolution; lcd.setCursor(10, 1); lcd.print(">>>>>>"); }

void counterclockwise() { // anti-clockwise dim=-stepsPerRevolution; lcd.setCursor(10, 1); lcd.print("<<<<<<"); }