printercarriage arduino

Upload: moineau011

Post on 03-Jun-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 Printercarriage Arduino

    1/7

    Printer Carriage Motion Control Laboratory

    Printer Carriage Motion Control

    Learning Objectives

    By the end of this laboratory experiment, the experimenter should be able to:

    Use a quad push-pull driver hip for bi-diretional !C motor ontrol "ith an #rduino$

    Use refletive photo-s"ithes, opto-interrupter s"ithes, and miro-s"ithes for limit sensing

    %xplain ho" and "hy limit s"ithes are used to prevent over-travel of moving omponents$

    Components

    &ty$ 'tem

    ( #rduino !uemilanove board ") #*mega+ miroontroller

    ( U.B # to B able

    ( .olderless breadboard

    ( Printer arriage assembly

    ( /ptial-interrupter s"ith 01airhild 2(L*B3

    ( Photo-refletive opto sensor 01airhild &4B((+53

    4oller lever momentary s"ith 0/mron ..-67L3( .89655( 0&uad 2alf-2 driver3 or L;+! 0&uad Push-Pull driver "ith diodes3

    ( 95L.5 hex inverter

    Overview

    *he purpose of this lab is to help you learn ho" onstrut a system "ith multiple sensors and an atuator,and interfae these "ith the #rduino)#*mega+$ 1igure ( sho"s ho" all the omponents ome together toomplete the printer arriage motion system$ *he proedure belo" "ill guide you in building and testingpiees of the system and then integrating them into a omplete system$

    Figure 1. Printer carriage system. *he printer arriage system ontains: t"o sensors: a photo-refletive optosensor and photo-interrupter s"ith< a po"er interfae 0the .89655( and ()= of the 95L.53< the arriage motor,and t"o .P.* s"ithes to provide fail-safe end-of-travel limits$ *he onnetions bet"een the modules and #rduinoare made through 6-"ay binding posts on the printer arriage assembly$ *he opto sensors and the .89655( need>6 ? to operate, "hereas >9 ? "ill be applied to the ?.pin of the .89655( to po"er the motor$

    Introduction

    ."ithes are ommon devies that permit or interrupt the flo" of urrent$ 'n addition to simply ontrollingeletrial po"er to a devie 0suh as a motor or light3, they an be used in motion ontrol to detet "hetheror not a movable element has reahed a predetermined position$

    @ .an Aos .tate University !epartment of Mehanial and #erospae %ngineering rev ($ (+M#4((

    Ardu

    ino/

    ATm

    ega3

    28

    IN 1

    IN 2

    EN 1

    .89655(

    74LS04

    >6?

    (

    OUT 1

    OUT 2

    motor

    reflective opto

    optointerrupter

    LimitSW 1

    LimitSW 2

    tactswitch

    >6?

    /P*/ P/D%4/P*/ 78!

    >9?

    >6?

    D8

    D9

    D2

    Page ( of

  • 8/12/2019 Printercarriage Arduino

    2/7

    Printer Carriage Motion Control Laboratory

    Mehanial s"ithes ome in a variety of designs$ *hey are ategoriEed by the number of poles and thro"sthey have$ *he number of poles represents the number of separate iruits that an be ompleted by thesame ation of the atuating lever or button$ *he number of thro"s represents the number of individualontats for eah pole$ *he most ommon types are sho"n in 1igure belo"$

    Figure 2. !amples o" di""erent switc# con"igurations. *he number of poles represents the number of separateiruits that an be ompleted by the same ation of the movable ontat0s3 inside the s"ith$ *he number ofthro"s represents the number of individual ontats for eah pole$

    Miro-s"ithes typially refer to mehanial s"ithes of small siEe that have a spring-loaded, momentaryontat, operated by a push-button diretly or via a pivoted antilever$ Miro-s"ithes find use in manyonsumer produts suh as noteboo omputers, applianes 0to detet if a over is losed3, et$ ."ithesare omprised of moving or sliding mehanial elements are designed to operate for thousands to hundredsof thousands of on-off yles$

    /ptial s"ithes 0e$g$ opto-interrupters, opto-refletors, et$3 are non-mehanial s"ithes made up of alight-emitting diode 0L%!3 and a phototransistor$ #s sho"n in 1igure +, light from the L%! shines to"ardthe base of a photransistor aross a gap in the housing of the s"ith$ *he output of the photransistor "illindiate "hether or not something is bloing the light from the L%!$ /pto-interrupters are often used inmehatroni devies to indiate that a movable element has reahed a speifi position or an end-of-travellimit$ !evies that use optial s"ithes inlude printers, opiers, and manufaturing automation systems$/pto-interrupters are attrative to use, beause they are solid-state, reliable, relatively inexpensive, and arestraightfor"ard to interfae "ith logi iruits$ .ine they operate "ithout physial ontat, they have theadvantages of longer lifetime, higher reliability, and faster atuation time ompared to mehanial s"ithes$

    Fou are going to use t"o types of optial s"ithes, a refletive 01airhild &4B((+53 and an interrupter-type 01airhild 2(L*B3 on a printer mehanism and use them in driving a printer arriage bet"een preset

    limits$ Fou "ill also use t"o .P.* miros"ithes to provide a fail-safe limit on the end-of-travel of thearriage in ase one of the opto-s"ithes fails$

    Figure $. Opto switc# sc#ematic.*he opto interrupters used on the printer arriage are solid state deviesonsisting of an infared-L%! and an 8P8 transistor$ Dhen the L%! shines on the phototransistor, this auses aurrent to flo" from the base to the emitter$ *he base-to-emitter urrent in turn an ontrol urrent from olletor-to-emitter assuming that there is a iruit onneted to the olletor from a voltage soure$

    %ssembling t#e &ystem

    #s "e have done in past expermiments, "e "ill again onstrut the system in a modular"ay by buildingand testingpiecesof the system as "e go$ *his is al"ays a good general approah in anyind ofengineering, "hether it be eletroni "or, system design, or omputer programming$ #void the temptationto "ire everything up first and hope that it "ill all "or the first time$ .uh an approah is doomed to fail,and you "ill end up spending more time trying to figure out "hat is not "oring than if you simply buildand testing eah individualsubsystemas you go along$

    @ .an Aos .tate University !epartment of Mehanial and #erospae %ngineering rev ($ (+M#4((

    Single-pole/single-throw (SPST) Single-pole/double-throw (SPDT)

    Double-pole/double-throw (DPDT)Double-pole/single-throw (DPST)

    Page of

  • 8/12/2019 Printercarriage Arduino

    3/7

    Printer Carriage Motion Control Laboratory

    1irst you "ill "or "ith the sensors and mae sure that they are "oring properly$ *hen you "ill onnetthe sensors to the #rduino$ 8ext, you "ill "or "ith the .89655( hip, and finally you "ill pulleverything together to omplete the printer system$

    7et a printer arriage assembly from your lab instrutor$ *he next three setions "ill guide you throughsome tests to ensure that all the sensors on the assembly are "oring properly$

    'e"lective Opto(switc#

    1irst, before onneting anything, verify the proper funtioning of the refletive opto-s"ith, "hih ismounted on a braet and attahed to the side of the printer losest to the motor$ ?erify that it is operatingproperly using the proedure belo"$

    ($ .et the >=? output terminal on the 2P %+=+# *riple /utput Po"er .upply to output >6?$ Usingbanana-to-banana test leads, onnet the >6? output and the Common output from the po"er supplyto the respetive /P*/ P/D%4 and the /P*/ 78! Gas on the printer arriage assembly$

    $ Measure the voltage at the binding post that is onneted to the output of the reflectiveopto-sensor0the one shaped lie an Harro" headI3 "hen the aluminum plate on the arriage is in front of its fae0this is the HbloedI ondition3$ )#at voltage do you measure* and w#at does t#is voltagerepresent* logic #ig# or low+

    +$ Move the printer arriage, so that the refletive optosensor is no longer bloed, and measure its

    output voltage$ )#at voltage do you measure* and w#at does t#is voltage represent* logic #ig# orlow+

    5$ )#at s#ould t#e voltages be in parts 1 and 2+

    'f you are satisfied that the opto-refletor is "oring orretly, go on$ 'f not, figure out "hat is "rong, andfix it, or as you lab instrutor for help$

    Opto(interrupter

    Che that the photo-interrupter, the sensor "ith the big slot in it that is mounted on a braet and attahedto the side of the printer frame furthest a"ay from the motor, is operating properly$

    5$ Measure the voltage at the binding post that is onneted to the output of the opto-interrupter "hen the

    aluminum plate on the arriage is in its slot$ )#at voltage do you measure* and w#at does t#isvoltage represent* logic #ig# or low+

    6$ Measure the voltage at the output "hen the sensor is unbloed$ )#at voltage do you measure* andw#at does t#is voltage represent* logic #ig# or low+

    =$ )#at s#ould t#e voltages be in parts , and -+

    'f you are satisfied that the photo-interrupter is "oring orretly, go on$ 'f not, figure out "hat is "rong,and fix it, or as you lab instrutor for help$

    Limit &witc#es

    Move the printer arriage by hand, and mae sure that eah of the t"o miros"ithes "ith the roller leversat the far right and left limits of travel "ill be atuated "hen the aluminum JflagK on the arriage passes

    beneath them$ Use the !MM to he for ontinuity bet"een the /U*( and /U* binding posts, first "iththe roller levers from both s"ithes unpressed, then "ith eah s"ith, one at a time, "ith its roller leverpressed$ Continuity should be broen "hen eitherof the roller levers is pressed$ *hese s"ithes "ill beused to ut the po"er to the motor if the arriage travels beyond the opto-s"ithes$ 8ote that it is veryimportant that any devie you design "ith moving omponents have some means to reliablyprevent or deal"ith over-travel$ /ver-travel protetion is important to avoid damage to the devie and ensure the safety ofothers "oring "ith or near the mahine "hile it is operating$

    @ .an Aos .tate University !epartment of Mehanial and #erospae %ngineering rev ($ (+M#4(( Page + of

  • 8/12/2019 Printercarriage Arduino

    4/7

    Printer Carriage Motion Control Laboratory

    Connecting t#e Optical &ensors to t#e %rduino

    Connet the #rduino to the photo-refletive sensor and the opto-interrupter via the appropriate6-"ay binding post, and write a short program that reads the state of each sensor and printsthe corresponding logic level to the serial monitor.Fou may use any input port and pins you"ish 0exept for P! and P!(, "hih are used for the .erial Monitor3$ ?erify that your programorretly detets the hange of state of the s"ithes$ .ho" your lab instrutor that your programfuntions properly before going on$ raw your own sc#ematic* and document w#ic# pins youused$Include t#is code and sc#ematics* and label it appropriately in your lab report.

    /,L&0, e! Inverter

    *he 95L.5 is a logi 'C ontaining six independent inverters 0or NOT gates3$ 1igure 6 sho"s ho" thehip is laid-out$ *he output of an inverter simply inverts0reverses3 the logi level that is presented at itsinput$ .o, if logi 2'72 is presented at the input, the output of the inverter "ill be logi L/D$

    Figure -. /,L&0, pinout.*he 95L.5 is a logi 'C ontaining six inverters, also alled 8/* gates$ *heshemati symbol for a 8/* gate is a triangle "ith an open irle at the end$ 8ote that you must apply >6?and ground for the 95L.5 hip to funtion$

    IMPO'%3: !/ 8/* #..UM% any logi 'C hip is "oring "hen you reeive it$ Fou MU.* test thelogi level on the pins you are "oring from$ 1or example, observing 1igure 6, if you hose to "or "ithpin ( and pin as your designated inverter, test them by applying>6 ? to pin ( and verify that pin is ?, then apply ? to pin ( and verify that pin is >6?$ !onIt forgetthat you need to apply >6? and ground to po"er the 95L.5 for it to funtion$

    8/*%: *he hex inverterIs funtion an also be done entirely by soft"are$ By using the bitwise-notoperator 03, you an also reverse the logi level presented at an input, and use it to set the state of anoutput pin 0i$e$ P/4*B P'8#< "ill set all pins on output P/4*B to the inverted state of P/4*#Nsinputs3$

    4uad al"( river

    *he .89655( 0or L;+!3 is an 'C designed for driving moderate-urrent indutive loads, suh as motorsand solenoids, from logiclevel signals 0 ? or 6 ? in our ase3$ *he hip has four, half 2-bridges 0alsono"n as Hpush-pullI hannels, beause eah of the four output an either source0HpushI3 orsink0HpullI3urrent3, and eah pair has an enabling input, and integral lamping 0flyba3 diodes as sho"n in 1igure =$%ah hannel an soure or sin up to = m# ontinuous urrent$ # push-pull hannel onsists of t"otransistors, a P8P and an 8P8, in "hih the olletors of the t"o transistors are onneted and their baseleads are ommon$ Dhen a logi-level signal is applied to the ommon base, one of the transistors "ill besaturated 0full-on3 and the other utoff 0full-off3$ *his arrangement allo"s the hannel to either soure0push3 or sin 0pull3 urrent from the ommon olletor Guntion, hene the name Jpush-pullK$ 'f t"ohannels are used, a !C motor an be driven bi-diretionally from a po"er supply of single polarity$

    @ .an Aos .tate University !epartment of Mehanial and #erospae %ngineering rev ($ (+M#4(( Page 5 of

    1

    2

    3

    4

    5

    6

    7

    14

    13

    12

    11

    10

    9

    8

    74LS04

    +5 V

  • 8/12/2019 Printercarriage Arduino

    5/7

    Printer Carriage Motion Control Laboratory

    Figure 5. &3/-,,10 6or L27$8 connections. *he .89655( is a four-hannel push-pull driver hip "ith integrallamping diodes$ /nly t"o of the four hannels are sho"n$ *he hip needs >6 ? applied to pin (= to operate$ >? .is the voltage of the supply used to drive the motor 0use >9 ? for ?s3$ Channels (and "ill be enabled "hen logihigh 0>6 ?3 is applied to pin ( 0%nable (3$

    /,L&0, and &3/-,,10 connection

    Pin ( of the .89655( is the enableinput 0abbreviated %8(3 for hannels ( and 0see 1igure =3$ Dhenpin ( is taen to logi high, thepairof push-pull hannels 0'8()/U*( and '8)/U*3 is JenabledK,meaning that hannels ( and are made operational$ *hus, if a logi high is applied to pin ( 0'n (3, then pin+ 0/ut (3 "ill go HhighI 0to about ($5 ? lo"er than ?s3$ 'f a logi lo" is applied to pin 0'n (3, then pin +0/ut (3 "ill go Hlo"I 0to about ($ ? above ground3$ Dhen pin( 0%8(3 is taen to logi lo", the t"o

    hannels are JdisabledK, "hih means that their outputs are effetively disonneted from the iruit$Connet the miroontroller to the 95L.5 and the .89655( as sho"n in 1igure 9 using #rduino pins ofyour hoie$

    .et the >? output terminal on the 2P po"er supply so that it "ill output 9/ :0he the voltageB%1/4% you mae the onnetion desribed next3$ Connet the tat s"ith to an input pin of the #rduinousing an appropriate Gumper$ )rite a s#ort program 6label it appropriately8 t#at loo;s "or t#eswitc# tobe pressed* enables 31 o" t#e &3/-,,10* and toggles I3 1 and I3 2 continuously. Dith the !MM,verify that the voltages measured at /U* ( and /U* on the .89655( alternate bet"een high 0>9?3and lo" 0?3 "hen the state "ritten to '8 ()'8 toggles$

    @ .an Aos .tate University !epartment of Mehanial and #erospae %ngineering rev ($ (+M#4(( Page 6 of

    +5 V

    +VS

    1

    2

    3

    4

    5

    6

    7

    8

    16

    15

    14

    13

    12

    11

    10

    9

    Enable 1

    In 1

    Out 1

    Out 2

    In 2

    +VS

    +VS

    SN754410

    ?.>9? is used

    to po"er themotor$

  • 8/12/2019 Printercarriage Arduino

    6/7

    Printer Carriage Motion Control Laboratory

    Figure /. Connections to t#e %rduino* t#e /,L&0,* and t#e &3/-,,10 6or L27$8.8ote that the onnetions for>6 and ?s are not sho"n on the .89655(, but need to be onneted$

    Motor Connection

    #ssuming that you have gotten all the piees to "or so far, you are no" ready to interfae the printerarriage motor, and get things movingO Connet the output of the optos"ithes to the #rduino if they arenot already onneted$ *he general layout of your system should loo lie 1igure belo"$

    Figure

  • 8/12/2019 Printercarriage Arduino

    7/7

    Printer Carriage Motion Control Laboratory

    1or more information on the .89655(, see http:))fous$ti$om)dos)prod)folders)print)sn9655($html $

    1or more information on the 95L.5, loo at the data sheets on the *exas 'nstruments "eb site:http:))"""$ti$om

    @ .an Aos .tate University !epartment of Mehanial and #erospae %ngineering rev ($ (+M#4(( Page 9 of

    http://www.ti.com/http://www.ti.com/