Arduino Lesson 16. Stepper Motors



Similar documents
Arduino Lesson 14. Servo Motors

Arduino Lesson 13. DC Motors. Created by Simon Monk

Arduino Lesson 0. Getting Started

Arduino Lesson 1. Blink

Adafruit's Raspberry Pi Lesson 9. Controlling a DC Motor

cs281: Introduction to Computer Systems Lab08 Interrupt Handling and Stepper Motor Controller

Arduino Lesson 9. Sensing Light

Arduino Lesson 5. The Serial Monitor

Arduino Lesson 4. Eight LEDs and a Shift Register

Eric Mitchell April 2, 2012 Application Note: Control of a 180 Servo Motor with Arduino UNO Development Board

Arduino Lesson 17. Sending Movement Detector

Your Multimeter. The Arduino Uno 10/1/2012. Using Your Arduino, Breadboard and Multimeter. EAS 199A Fall Work in teams of two!

revolution Contents: Introduction Power 28-pin Project Board with input/output cables

Arduino Motor Shield (L298) Manual

Bluetooth + USB 16 Servo Controller [RKI-1005 & RKI-1205]

Lab 6 Introduction to Serial and Wireless Communication

Table 1 Comparison of DC, Uni-Polar and Bi-polar Stepper Motors

Microcontroller Programming Beginning with Arduino. Charlie Mooney

Arduino DUE + DAC MCP4922 (SPI)

Adafruit's Raspberry Pi Lesson 11. DS18B20 Temperature Sensing

Surveillance System Using Wireless Sensor Networks

Sending an SMS with Temboo

C4DI Arduino tutorial 4 Things beginning with the letter i

IR Communication a learn.sparkfun.com tutorial

DEPARTMENT OF ELECTRONICS ENGINEERING

Servo Info and Centering

Programming the Arduino

Tiny Arduino Music Visualizer

PHYS 2P32 Project: MIDI for Arduino/ 8 Note Keyboard

Arduino Shield Manual

SYSTEM 45. C R H Electronics Design

RB-See-211. Seeedstudio Grove 6-15V, 2A Dual I2C Motor Driver. Grove - I2C Motor Driver. Introduction

Theory and Practice of Tangible User Interfaces. Thursday Week 2: Digital Input and Output. week. Digital Input and Output. RGB LEDs fade with PWM

Connecting Arduino to Processing a

Lecture 7: Programming for the Arduino

TUTORIAL FOR INITIALIZING BLUETOOTH COMMUNICATION BETWEEN ANDROID AND ARDUINO

2.2" TFT Display. Created by Ladyada. Last updated on :15:09 PM EDT

DC Motor control Reversing

Adafruit BME280 Humidity + Barometric Pressure + Temperature Sensor Breakout

Servo Motors (SensorDAQ only) Evaluation copy. Vernier Digital Control Unit (DCU) LabQuest or LabPro power supply

Data Sheet. Adaptive Design ltd. Arduino Dual L6470 Stepper Motor Shield V th November L6470 Stepper Motor Shield

DS1307 Real Time Clock Breakout Board Kit

Data Acquisition Module with I2C interface «I2C-FLEXEL» User s Guide

Green House Monitoring and Controlling Using Android Mobile Application

SYSTEM 4C. C R H Electronics Design

CHAPTER 11: Flip Flops

Arduino Shield Manual

A REST API for Arduino & the CC3000 WiFi Chip

Adafruit MCP9808 Precision I2C Temperature Sensor Guide

Basic Pulse Width Modulation

Character LCDs. Created by Ladyada. Last updated on :45:29 PM EDT

MCP4725 Digital to Analog Converter Hookup Guide

Tutorial. replace them with cell-phone operated module. The advantages of a cell-phone operated bot are:-

How to Make a Pogo Pin Test Jig. Created by Tyler Cooper

1 Coffee cooling : Part B : automated data acquisition

ARDUINO SEVERINO SERIAL SINGLE SIDED VERSION 3 S3v3 (REVISION 2) USER MANUAL

Crazy Alarm Clock L A K S H M I M E Y Y A P P A N J A M E S K A Y E W I L L I A M D I E H L C O N G C H E N

Home Security System for Automatic Doors

INTRODUCTION TO SERIAL ARM

Yun Shield Quick Start Guide VERSION: 1.0 Version Description Date 1.0 Release 2014-Jul-08 Yun Shield Quick Start Guide 1 / 14

1602 LCD adopts standard 14 pins(no backlight) or 16pins(with backlight) interface, Instruction of each pin interface is as follows:

MIDECO 64-outputs MIDI note decoder USER MANUAL. Roman Sowa 2012

CAN-Bus Shield Hookup Guide

Set up and Blink - Simulink with Arduino

Specification: 1 Specification

Ocean Controls RC Servo Motor Controller

Basic DC Motor Circuits. Living with the Lab Gerald Recktenwald Portland State University

Basic DC Motor Circuits

How to Move Canon EF Lenses. Yosuke Bando

ECEN 1400, Introduction to Analog and Digital Electronics

Pulse width modulation

Electrical Engineering Department College of Engineering California State University, Long Beach Long Beach, California, 90840

Lesson 8: Simon - Arrays

1115 4G SERIES GOVERNOR ma ANALOGUE DIGITAL SPEED SETTING

Intro to Intel Galileo - IoT Apps GERARDO CARMONA

MANUAL FOR RX700 LR and NR

2013 G Miller. 3 Axis Brushless Gimbal Controller Manual

Adafruit SHT31-D Temperature & Humidity Sensor Breakout

Simple Analysis for Brushless DC Motors Case Study: Razor Scooter Wheel Motor

DATASHEET. ADAM Arduino Display Adaptor Module. Arduino Compatible Shield P/N: 4Display-Shield-FT843 For the 4D Systems 4DLCD-FT843 Display

Motor Fundamentals. DC Motor

EARTH PEOPLE TECHNOLOGY SERIAL GRAPH TOOL FOR THE ARDUINO UNO USER MANUAL

GLOLAB Two Wire Stepper Motor Positioner

Hand Crank Generator (9 May 05) Converting a Portable Cordless Drill to a Hand Crank DC Generator

Sensors Collecting Manufacturing Process Data

Six-servo Robot Arm. DAGU Hi-Tech Electronic Co., LTD Six-servo Robot Arm

Inductance. Motors. Generators

PIR Motion Sensor. Created by Ladyada. Last updated on :15:25 PM EST

Selecting and Implementing H-Bridges in DC Motor Control. Daniel Phan A

Electronic Brick of Current Sensor

STEPPER MOTOR SPEED AND POSITION CONTROL

Arduino Wifi shield And reciever. 5V adapter. Connecting wifi module on shield: Make sure the wifi unit is connected the following way on the shield:

Electronics 5: Arduino, PWM, Mosfetts and Motors

Pololu DRV8835 Dual Motor Driver Shield for Arduino

Bob Rathbone Computer Consultancy

Motorising the Peco Turntable - a different approach

Internet of Things with the Arduino Yún

Cornerstone Electronics Technology and Robotics I Week 15 Voltage Comparators Tutorial

Transcription:

Arduino Lesson 16. Stepper Motors Created by Simon Monk Last updated on 2013-11-22 07:45:14 AM EST

Guide Contents Guide Contents Overview Parts Part Qty Breadboard Layout Arduino Code Stepper Motors Other Things to Do 2 3 4 4 4 6 7 9 10 Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 2 of 10

Overview Stepper motors fall somewhere in between a regular DC motor and a servo motor. They have the advantage that they can be positioned accurately, moved forward or backwards one 'step' at a time, but they can also rotate continuously. In this lesson you will learn how to control a stepper motor using your Arduino and the same L293D motor control chip that you used with the DC motor in lesson 15. Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 3 of 10

Parts To build the project described in this lesson, you will need the following parts. Part Qty 5V Stepper Motor 1 L293D IC 1 Half-size Breadboard 1 Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 4 of 10

Arduino Uno R3 1 Jumper wire pack 1 Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 5 of 10

Breadboard Layout The stepper motor has five leads, and we will be using both halves of the L293D this time. This means that there are a lot of connections to make on the breadboard. The motor has a 5-way socket on the end. Push jumper wires into the sockets to allow the motor to be connected to the breadboard. Note that the red lead of the Stepper motor is not connected to anything. Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 6 of 10

Arduino Code The following sketch uses the Serial Monitor, so once the sketch is installed and running, open the Serial Monitor and enter a number of 'steps'. Try a value of about 500, this should cause the motor to turn through about 360 degrees. Enter -500 and it will turn back in the reverse direction. The Stepper library is included in newer distributions of the Arduino IDE - you may need to upgrade. /* Adafruit Arduino - Lesson 16. Stepper */ #include <Stepper.h> int in1pin = 12; int in2pin = 11; int in3pin = 10; int in4pin = 9; Stepper motor(512, in1pin, in2pin, in3pin, in4pin); void setup() { pinmode(in1pin, OUTPUT); pinmode(in2pin, OUTPUT); pinmode(in3pin, OUTPUT); pinmode(in4pin, OUTPUT); // this line is for Leonardo's, it delays the serial interface // until the terminal window is opened while (!Serial); Serial.begin(9600); motor.setspeed(20); } void loop() { if (Serial.available()) { int steps = Serial.parseInt(); motor.step(steps); } } As you might expect, there is an Arduino library to support stepper motors. This makes the process of using a motor very easy. Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 7 of 10

After including the 'Stepper' library, the four control pins 'in1' to 'in4' are defined. To tell the Arduino Stepper library which pins are connected to the motor controller, the following command is used: Stepper motor(768, in1pin, in2pin, in3pin, in4pin); The first parameter is the number of 'steps' that the motor will take to complete one revolution. The motor can be moved by one step at a time, for very fine positioning. Serial communications is then started, so that the Arduino is ready to receive commands from the Serial Monitor. Finally the following command sets the speed that we wish the stepper motor to move, when we subsequently tell it how many steps to rotate. motor.setspeed(10); The 'loop' function is very simple. It waits for a command to come in from the Serial Monitor and converts the text of the number sent into an int using 'parseint'. It then instructs the motor to turn that number of steps. Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 8 of 10

Stepper Motors Stepper motors use a cogged wheel and electro magnets to nudge the wheel round a 'step' at a time. By energizing the coils in the right order, the motor is driven round. The number of steps that the stepper motor has in a 360 degree rotation is actually the number of teeth on the cog. The motor we are using has 48 steps, but then the motor also incorporates a reduction gearbox of 1:16 that means that it needs 16 x 48 = 768 steps. In this lesson, we do not use the common Red connection. This connection is only provided if you are using a different type of drive circuit that does not allow the current in each coil to be reversed. Having a center connection to each coil means that you can either energise the left or right side of the coil, and get the effect of reversing the current flow without having to use a circuit that can reverse the current. Since we are using a L293D that is very good at reversing the current, we do not need this common connection, we can supply current in either direction to the whole of each of the coils. Adafruit Industries http://learn.adafruit.com/adafruit-arduino-lesson-16-stepper-motors Page 9 of 10

Other Things to Do Try changing the command that sets the speed of the stepper motor: motor.setspeed(20); to a lower value (say 5) upload the sketch and notice that the stepper turns more slowly. Now try and find the maximum speed for the stepper by increasing the speed above 20. After a certain point, you will find that the motor does not move at all. This is because it just cannot keep up with the stream of pulses asking it to step. Try disconnecting the orange and pink leads of the stepper. It should still turn, but you will notice that it is weaker, as it does not have both coils working to push the motor around. In the next Lesson (http://adafru.it/c2f) you will learn how to make an Arduino detect movement using a PIR sensor and then communicate with your computer to send an email. Adafruit Industries Last Updated: 2013-11-22 07:45:16 AM EST Page 10 of 10