image1 image2 image3

HELLO I'M LiNuS|WELCOME TO MY PERSONAL BLOG|I LOVE TO DO CREATIVE THINGS|I PRESENT MY WORKS ON VLSI AND EMBEDDED

Stepper motor

 

Stepper Motor


The Following are required to run a stepper motor:

1. Arduino Mega 2560 board:

The Arduino Mega 2560 is a microcontroller board based on the ATmega2560. 
It has 54 digital input/output pins (of which 15 can be used as PWM outputs), 16 analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. 
It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started. 
The Mega 2560 board is compatible with most shields designed for the Uno and the former boards Duemilanove or Diecimila.

pin layout of arduino


Digital Pins of Arduino



2. ULN2003AN IC:

The ULx200xA devices are high-voltage, high-current darlington transistor arrays. Each consists of 7 NPN darlington pairs that feature high-voltage outputs with common-cathode clamp diodes for switching inductive loads. 

IC pin layout



internal logical view

darlington pair


3. 28BYJ-48 Gear Stepper Motor:

This 5V DC 28BYJ-48 Stepper Motor is a small, inexpensive, and high-quality geared step motor. 
The 28BYJ-48 Stepper Motor and ULN2003 Stepper Motor Driver is a widely popular combination of the stepper motor and stepper driver, because of the stability and reliability of the system.

28BYJ-48 stepper motor


pin diagram of stepper motor

Sequence to rotate in clockwise


Connections to Arduino board:
Here map the arduino pins D8-D11 to arduino mega 2560's D22-D25 pins. The stepper motor is connected to ULN2003AN/ULN2004A IC . 
pin connections of stepper motor, ULN2003AN & arduino



Arduino Code:
#define STEPPER_PIN_1 22 #define STEPPER_PIN_2 23 #define STEPPER_PIN_3 24 #define STEPPER_PIN_4 25 int step_number = 0; void setup() { pinMode(STEPPER_PIN_1, OUTPUT); pinMode(STEPPER_PIN_2, OUTPUT); pinMode(STEPPER_PIN_3, OUTPUT); pinMode(STEPPER_PIN_4, OUTPUT); } void loop() { OneStep(false); delay(200); } void OneStep(bool dir){ if(dir){ switch(step_number){ case 0: digitalWrite(STEPPER_PIN_1, HIGH); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); break; case 1: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, HIGH); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); break; case 2: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, HIGH); digitalWrite(STEPPER_PIN_4, LOW); break; case 3: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, HIGH); break; } }else{ switch(step_number){ case 0: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, HIGH); break; case 1: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, HIGH); digitalWrite(STEPPER_PIN_4, LOW); break; case 2: digitalWrite(STEPPER_PIN_1, LOW); digitalWrite(STEPPER_PIN_2, HIGH); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); break; case 3: digitalWrite(STEPPER_PIN_1, HIGH); digitalWrite(STEPPER_PIN_2, LOW); digitalWrite(STEPPER_PIN_3, LOW); digitalWrite(STEPPER_PIN_4, LOW); } } step_number++; if(step_number > 3){ step_number = 0; } }


Setup images & working video:












Share this:

CONVERSATION

0 comments:

Post a Comment