37 sensores

Embed Size (px)

Citation preview

  • 8/12/2019 37 sensores

    1/67

    37 in 1 box Sensor Kit For Arduino Starters

    Summary:DIY Maker 37 IN 1 sensor learning package is a highly cost-Learning Arduino sensor package

    We carefully uild for the eginners in the !hole learning process !ithout !elding and !iring"

    directly y plug 3# uni$ersal sensor ca le" you can easily go to e%perience the fun of interacti$e

    sensing and electronic technology" in getting started&

    Let us into a $ariety of interacti$e electronic !orld& & &

  • 8/12/2019 37 sensores

    2/67

    list of kit:'1& D(1)*+' sensor ,odule

    '+& $i ration s!itch ,odule

    '3& all ,agnetic sensor ,odule'.& key s!itch ,odule

    '/ &infrared trans,itter ,odule

    '0 &passi$e u er ,odule

    '7& laser trans,itter ,odule

    ')& 3 colors - 2ull olor L4D (MD Module

    '5& photo interrupter ,odule

    1'& 3 ,, red and green L4D ,odule 6co,,on cathode

    '11& acti$e u er ,odule

    '1+& analog te,perature sensor

    '13& D 811 digital te,perature and hu,idity sensor ,odule

    '1."&3 colors - L4D full color ,odule

    '1/& ,ercury tilt s!itch ,odule

    '10& photoresistor ,odule

    '17& /9 :elay Module

    '1)& tilt s!itch ,odule

    '15& MINI reed s!itch ,odule

    '+'& infrared recei$er ,odule

    '+1& #(+ ga,epad a%is sensor ,odule

    '++& Linear all ,agnetic ,odule'+3& :eed ,odule

    '+.& fla,e sensor ,odule

    '+/& Magic light cup ,odule

    '+0& Digital 8e,perature Module

    '+7& /,, red and green L4D ,odule 6co,,on cathode

    '+)& knock sensor ,odule

    '+5& infrared o stacle a$oidance sensors

    '3'& 7 color flashing L4D ,odule !ill auto,atically

    '31& analog all ,agnetic sensor ,odule

    '3+& 8ouch Module

    '33& igh sensiti$ity sound detection ,odule

    '3.& ,icrophone sound detection ,odule

    '3/& finger ,easuring heart eat ,odule

    '30&& 8racking Module

    '37& rotary encoder ,odules

    P

  • 8/12/2019 37 sensores

    3/67

    List of courses

    '1 D(1) +' sensor ,odule

  • 8/12/2019 37 sensores

    4/67

    I& IN8:;D< 8I;NI elie$e if !e co,e into contact !ith this a,a ing Arduino then the D(1)*+' digital

    ther,o,eter hips are generally not (tranger to it" right= It ena les you to keep a reast of the

    a, ient te,perature around you" ,ore i,portantly" as If you ha$e an idea you can also custo,i e

    ;!n use Arduino DIY a ther,o,eter" put in your edroo, or in the car"> - > Well" let?s !ork

    together to unco$er the ,ystery D(1)*+'" and then you You can use it to ,ake the @inds of

    electronic products that ,atch your personality &

    " #roducts

    As in the past the te,perature sensor output is analog" !e need to add additional A D And D A

    chip into Line con$ersion" then for Arduino resources are not a undant e%ternal interface is a ig

    challenge at the sa,e ti,e

  • 8/12/2019 37 sensores

    5/67

  • 8/12/2019 37 sensores

    6/67

    ds&select 6addr F

    ds&!rite 6'%.." 1 F R start con$ersion" !ith parasite po!er on at the end

    delay 61''' F ,ay e 7/',s is enough" ,ay e not

    We ,ight do a ds&depo!er 6 here" ut the reset !ill take care of it& present O ds&reset 6 F

    ds&select 6addr F

    ds&!rite 6'%*4 F R :ead (cratchpad

    (erial&print 6S# OS F

    (erial&print 6present" 4V F

    (erial&print 6SS F

    for 6i O 'F i J5F i R !e need 5 ytes

    data PiQ O ds&read 6 F

    When you !rite the progra," do!nload it to arduino inside after running the resulting effect is as

    follo!s In the

    When doing e%peri,ents here

    8he te,perature !as +7 degrees elsius" touch D(1)*+'" you can see the serial co,,unication

    (ignificant change in the te,perature of the ,odule&

    A success= > U >

    9II onclusion

    8his section here !ill co,e to an end" I elie$e after reading this section has not D(1)*+'

    And then is so afraid of

    It" in fact" as long as !e grasp" !e can use it ar itrary and designed our personality

    4lectronic products" their 8ry it yourself also& & & & &

    (erial&print 6data PiQ" 4V F

    (erial&print 6SS F

    8e,p O 6data P1Q JJ ) data P'Q F take the t!o ytes fro, the response relating to te,perature

    8e,p O 8e,p KK . F di$ide y 10 to get pure celcius readout

    Ne%t line is 2ahrenheit con$ersion

    8e,p O 8e,p 1&) 3+F co,,ent this line out to get celcius

    (erial&print 6S8 OS F output the te,perature to serial port

    (erial&print 68e,p F

    (erial&print 6SS F

    (erial&print 6S : OS F

    (erial&print 6;neWire crc) 6data" ) " 4V F

    (erial&println 6 F

  • 8/12/2019 37 sensores

    7/67

    '+ A:D

  • 8/12/2019 37 sensores

    8/67

    '3 @4Y4( Arduino all ,agnetic sensor ,odule

    all ,agnetic sensor ,odule and a digital interface" uilt-in 13 L4D uild a si,ple circuit to

    produce a ,agnetic flasher&

    13 co,es !ith digital interfaces of the L4D" the all ,agnetic sensor connected to the force plate

    nu, er 3 A:D

  • 8/12/2019 37 sensores

    9/67

    $al O digital:ead 6(4N(;: F read digital interface is assigned a $alue of 3 $al

    if 6$al OO IG When the shock sensor detects a signal" L4D lights

    digitalWrite 6Led" IG F

    digitalWrite 6Led" L;W F

    '. @4Y4( A:D

  • 8/12/2019 37 sensores

    10/67

    pinMode 6 uttonpin" IN#

  • 8/12/2019 37 sensores

    11/67

    out" its structure" !ith the general principle of the light e,itting diode si,ilar" ut !ith a

    se,iconductor

    Different ,aterialsF

    +" the infrared recei$er is set to recei$e" a,plify" de,odulate one of the de$ices" !hich has eenco,pleted !ithin the de,odulation I output

    Is a digital signalF

    3" the principle of infrared co,,unication

    Let?s look at the structure of the infrared recei$er infrared recei$er inside there are t!o i,portant

    ele,ents" na,ely the I and#D& I is a recei$er processing ele,ents" ,ainly co,posed of silicon

    crystals and circuits" is a highly integrated de$ice" the ,ain

    8o function as a filter" shaping" decoding" oo, and other functions& #hotodiode #D is" the ,ain

    function is to recei$e the optical signal Nu, er&

    8he follo!ing is a rief sche,atic !ork

    8he ,odulated infrared e,itting diode signal e,itted" infrared recei$er after recei$ing" decoding"

    filtering" and a series of operations After the signal for reco$eryF

    I9 Notes

    1" infrared e,itting diodes clean" good conditionF $arious para,eters during operation ,ust not

    e%ceed li,it $alues 6positi$e

    8o the current 3' X 0' ,A" #ulse 2or!ard urrent '&3 X 1 A" re$erse $oltage / 9" po!er

    dissipation 5' ,W" the !orking te,perature

    :ange -+/ X )' " storage te,perature range of -.' X 1'' " soldering te,perature of +0' infrared e,ission tu e and then

    losed head should e paired !ith" other!ise it !ill affect the sensiti$ityF+" the infrared recei$er in a lo! hu,idity en$iron,ent storage and useF #lease pay attention to

    protect the infrared recei$er recei$ing surface"

    onta,ination or !ear !ill affect reception" and do not touch the surfaceF Do not !ash thisF

    polluting gas in

    *ody or the sea 6salty en$iron,ent storage and useF !ithout any e%ternal pressure" and affect the

    Buality of the en$iron,ent

    (torage and useF

    2i$e" instructions for use

    We first look at the diagra," to understand the infrared trans,itter and recei$er ,odule specific

    connection !ith the Arduino

    Note 8he a o$e circuit is ased on our a o$e that kind protel sche,atic structures" and ,eet the

    specific pin assign,ent

    (ho!n in the sche,atic&

    Well" the test circuit there" look at the code under test right no!

    8his ti,e !e use to t!o Arduino control oard" a ,ain trans,itter 6Master " one as a sla$e

    recei$er 6(la$e "

    ;!n specific set& We can according to the a o$e sche,atic !iring and fi%ed infrared trans,itter

    and recei$er ,odules" here I

    We can !ork together to test it&(i% of the test portion

    ard!are :eBuire,ents

    P

  • 8/12/2019 37 sensores

    12/67

    1" Arduino controller H 1

    +" U >

    2ro, the recei$ing part of the code

    Include JI:re,ote&hK

    int :4 9U#IN O 11F define input pin on Arduino

    I:rec$ irrec$ 6:4 9U#IN F

    decodeUresults resultsF

    $oid setup 6

    (erial& egin 650'' F

    irrec$&ena leI:In 6 F (tart the recei$er

    $oid loop 6

    if 6irrec$&decode 6Z results

    (erial&println 6results&$alue" 4V F

    irrec$&resu,e 6 F :ecei$e the ne%t $alue

    Main e,ission part of the code

    Include JI:re,ote&hK

    I:send irsendF

    $oid setup 6

    (erial& egin 650'' F

    $oid loop 6

    for 6int i O 'F i J/'F i

    irsend&send(ony 6'%a5'" 1+ F (ony 89 po!er code

    delay 6.' F

    P

  • 8/12/2019 37 sensores

    13/67

    8he a,ount of points !e can hand to lock recei$er ,odule" see also the nor,al co,,unication

    et!een the, do 8he follo!ing is the recei$e !indo!

    Ah" looked at the !indo!" and !e all kno! it& & & & &

    9II onclusion8he reason !hy !e feel that infrared is really a !onderful thing" it is ecause !e are in$isi le"

    intangi le" ut

    ;kay" !e do not need that" too" can control it and ,ake it ser$e us" in fact" !e are ,ore ,agical"

    Is not ;h& & & & & & Well" today?s introduction on to this" and if you are interested you can contact us"

    thank you=

    '0 #assi$e u er

    Arduino can e done !ith a lot of interacti$e !ork" the ,ost co,,on and ,ost co,,only used is

    the sound and light sho! in front has een

    L4D lights are used in the e%peri,ents" !e let the e%peri,ent circuit sound" a $oice of the ,ost

    co,,on

    o,ponent is the u er and speaker" and co,parison of the t!o u er easier and ease the

    present study" !e u er&

    *u er and the principle

    6A the introduction of the u er

    1& *u er *u er is an integrated role in the structure of electronic transducers" D $oltage po!er

    supply" !ide

    #an used in co,puters" printers" copiers" alar,s" electronic toys" auto,oti$e electronic eBuip,ent"

    telephones" ti,ers" etc&4lectronic products for sound de$ices&

    +& 8he classification is di$ided into u er pie o u er u er and t!o types of electro,agnetic

    P

  • 8/12/2019 37 sensores

    14/67

    u er&

    3& Graphic sy, ols u er u er circuit in the circuit y the letter S S or S AS 6old standard

    !ith

    S2MS" SL*S" S[DS" etc& indicates&68!o structural principle u er

    1& #ie o *u er #ie o *u er ,ainly y the ,ulti$i rator" pie o u er" i,pedance ,atching and

    resonance

    *o%es" housing and other co,ponents& (o,e pie o u er case is also eBuipped !ith light-

    e,itting diodes&

    Multi$i rator constituted y the transistors or integrated circuits& When s!itched on 61&/ X 1/9

    D !orking $oltage " ,ulti-

    ar,onic oscillator start-up" the output 1&/ X +&/k \ audio signals" i,pedance ,atching push

    pie o u er sound&

    #ie o u er y a lead irconate titanate or lead ,agnesiu, nio ate pie oelectric cera,ic

    ,aterial& *oth sides of the cera,ic piece plated sil$er electrode

    8he polari ation and the aging process" and then !ith rass or stainless steel sheet stick together&

    +& Magnetic *u er Magnetic *u er y the oscillator" the electro,agnetic coil" ,agnet"

    diaphrag, and housing and other co,ponents&

    After po!er on" the audio signal generated y the oscillator current through the electro,agnetic

    coil" the electro,agnetic coil generates a ,agnetic field& (hake

    Mo$ing the diaphrag, in the electro,agnetic coil and ,agnet interaction" periodically sound

    $i ration&

    Acti$e and passi$e u er u er What is the differenceere the SsourceS does not ,ean po!er& *ut rather refers to the shock source& In other !ords" the

    acti$e internal u er !ith shock source" so only

    Will e called to an energi ed&

    8he passi$e internal sources !ithout shocks" so if a D signal can not ,ake it t!eet& Must +@ X

    /@ sBuare !a$e to

    Dri$e it&

    *u er often than passi$e e%pensi$e" ecause there ,ultiple oscillator circuit&

    #assi$e u er ad$antages are 1& heap" +& (ound freBuency control" you can ,ake a S,ore than

    a ,eter hair (uola Vi ?efficiency

    2ruit& 3& In so,e special cases" you can reuse a control and L4D port acti$e u er ad$antages are

    process control

    on$enient&

    A:D

  • 8/12/2019 37 sensores

    15/67

    !hile 61

    for 6i O 'F i J)'F i Wen a freBuency sound

    digitalWrite 6 u er" IG F send $oice

    delay 61 F Delay 1,s

    digitalWrite 6 u er" L;W F do not send $oice

    delay 61 F delay ,s

    for 6i O 'F i J1''F i Wen ^ie out another freBuency sound

    digitalWrite 6 u er" IG F send $oice

    delay 6+ F delay +,s

    digitalWrite 6 u er" L;W F do not send $oice

    delay 6+ F delay +,s

    After do!nloading the progra," the u er e%peri,ents are done&

    '7 @4Y4( A:D

  • 8/12/2019 37 sensores

    16/67

    :outines source code

    $oid setup 6

    pinMode 613" ;

  • 8/12/2019 37 sensores

    17/67

    1" using /'/' full color L4D

    +" :G* trichro,atic li,iting resistor to pre$ent urnout

    3" through the #WM ad]usting three pri,ary colors can e ,i%ed to o tain different colors

    ." !ith a $ariety of single-chip interface/ ;perating $oltage /9

    0&L4D dri$e ,ode co,,on cathode dri$er

    8hree" Arduino test code

    int redpin O 11F select the pin for the red L4D

    int luepin O 1'F select the pin for the lue L4D

    int greenpin O 5 F select the pin for the green L4D

    int $alF

    $oid setup 6

    pinMode 6redpin" ;

  • 8/12/2019 37 sensores

    18/67

    #hoto interrupter ,odule and a digital interface" uilt-in 13 L4D uild a si,ple circuit to produce

    photo-interrupter !arning la,p

    13 co,es !ith digital interfaces of the L4D" the light locking access nu, er 3 sensor interfaces"

    sensing !hen the light interrupter

    De$ice senses a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the photo interrupter sensor interfaceint $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    19/67

    '1'&3,, red and green L4D 6co,,on cathode ,odule

    olor Green :ed

    Dia,eter 3,,

    ase olor None

    #ackage 8ype Diffusion

    9oltage 69 +&'-+ &/

  • 8/12/2019 37 sensores

    20/67

    $oid setup 6

    pinMode 6redpin" ;

  • 8/12/2019 37 sensores

    21/67

    ;ne" related presentations

    I elie$e !e are not unfa,iliar to the u er" !e !ill e used in ,any scenarios u er" ,ost of

    the,#ro,pted to do is to use the u er or alar," such as utton press" to !ork" or the end of the !ork

    reakdo!n and so on&

    ere the ,icrocontroller dri$es the u er to ,ake it on the application description&

    (econd" dri$e ,ode

    on$entional dri$e the u er in t!o !ays one is the #WM output to directly dri$e" another is the

    use of

    I ; ti,ing flip-le$el generates a dri$e !a$efor, for the u er to dri$e&

    #WM output #WM output to directly dri$e is to use a certain port itself can output sBuare !a$e

    dri$e directly

    Mo$ing the u er& In the ( M soft!are settings" there are se$eral syste, registers are used to set

    the #WM output port"

    You can set the duty cycle" period" etc& *y setting these registers that ,eets the reBuire,ents of

    the u er freBuency !a$es

    (hape" si,ply open the #WM output" #WM output port can output the freBuency sBuare !a$e"

    this ti,e Lee

    8his !a$efor, can e dri$en !ith a u er& (uch as freBuency of +'''

    http keyes-arduino&tao ao&co,

    *u er dri$er" you can kno! the cycle of /''_s" so ]ust put the #WM period is set to / ''_s"

    Duty le$el is set to +/'_s" can generate a freBuency of +''' sBuare !a$e" sBuare !a$e throughreuse

    You can go !ith a transistor dri$e the u er it&

    8he use of I ; ti,ing flipping to generate dri$e !a$efor, le$el !ould e ,ore trou le that !ay"

    you ,ust use regularly

    8i,ing is done" flip through the regular le$el that ,eets the reBuire,ents of the u er freBuency

    !a$efor, 8his !a$efor, can e

    *e used to dri$e the u er& (uch as +/'' u er dri$er" you can kno! the cycle of .''_s"

    !hich

    (a,ples only need to dri$e the u er I ; port flip once e$ery +''_s le$el can generate a

    freBuency

    +/'' " 1 +duty duty sBuare !a$e" and then through the transistor a,plifier can dri$e the u er

    it&

    8hird" the ,odule uses

    We look to the ,odule should understand that he is $ery easy to use" a po!er supply ter,inal" a

    ground ter,inal" as !ell as a

    ;ne is the signal input& We ]ust put the po!er and ground connected" then the signal line

    connected to I; ports on the line

    2ourth" the ,odule function test

    ard!are :eBuire,entsArduino controller H 1

    P

  • 8/12/2019 37 sensores

    22/67

  • 8/12/2019 37 sensores

    23/67

    :ead the key one initial $alue" !here I took in the circuit is in the default high" the initial $alue

    is highF

    utton(tate O digital:ead 6 utton#in F

    If the key is high" then the u er did not ringF*ecause I ]ust egan to take in the hard!are circuit initial $alue is high" so the if condition is true"

    the u er does not sound

    if 6 utton(tate OO IG

    digitalWrite 6speaker#in" L;W F

    else

    8his utton is lo! 6also the key is pressed F u er sounded

    digitalWrite 6speaker#in" IG F

    8his procedure is relati$ely si,ple" I elie$e !e see to understand" in order to increase people?s

    a!areness on the honey ,e great

    o,e to !rite a short code !ith #WM control u er&

    8he follo!ing procedure is to use a #WM 6pulse !idth ,odulation control the u er" and

    do!nloaded to the ,icrocontroller can e heard

    *u er sounded a different tone" as long as !e ad]ust the notes under the rele$ant tracks

    6'"1"+"3"."/"0"7 can ,ake the eep

    Is singrocedures are as follo!s

    int speaker#in O )F

    yte songUta le PQ O 3'" 3'" 3'" .'" /'" 0'" 7'" )'" 5'" 1''"11'" 1+'" 13'" 1.'"

    1/'" 10'" 17'" 1)'" 15'" +''" +1'" ++'" +3'" +.'" +/'" +/'" +.'" +3'" ++'" +1'" +''" 15'" 1)'"

    17'" 10'" 1/'" 1.'" 13'" 1+'" 11'" 1''" 5'" )'" 7'" 0'" /'" .'" 3'" 3'" 3' F

    int MAV O /'F

    int count O 'F

    $oid setup 6

    pinMode 6speaker#in" ;

  • 8/12/2019 37 sensores

    24/67

    line" of course" !e

    8he a o$e test case is relati$ely rough" u er sound effect ,ay not e $ery good" !ith readers

    slo!ly co,prehend& & & & &

    '1+&Analog te,perature sensor

    2irst" the ,odule introduces

    8he ,odule is ased on the ther,istor 6resistance increases !ith the a, ient te,perature

    changes !orks" a sense of real-ti,e

    8o kno! the te,perature of the surrounding en$iron,ent changes" !e send the data to the

    Arduino analog I;" then co,e do!n as long as !e go through [ane

    (ingle progra,,ing !ill e a le to con$ert the sensor output data elsius te,perature $alues and

    displayed" it is still easy to use"

    It effecti$ely" there y !idely used in gardening" ho,e alar, syste,s and other de$ices&

    (econd" the use

    And the general te,perature sensor is the sa,e" are three-line package" !hen !e use the po!er cord connected ;@ signal output

    Into the end on the line" ecause the ,odule output is an analog signal" !e !ant to signal output

    P

  • 8/12/2019 37 sensores

    25/67

    ter,inal connected to the Arduino analog I;

    ;n sa,pling" so as to correctly read the te,perature $alueF

    - >

    (uccessful co,pletion of the test" then it can later e applied to the design of future !e go& & & & & &

    Good presentation of the ,odule

    :espect to this" thank you=

    8ips code useful a out the (teinhart- art 8her,istor eBuation applications" specifically !e can

    look online

    Look" I !ill not say ,ore&Is displayed in the !indo! a o$e the current roo, te,perature" and is so ,uch ,ore& & & & & &

    Well" here !e hand touched it" to see change is not

    P

  • 8/12/2019 37 sensores

    26/67

    '13&D 811 Digital 8e,perature and u,idity (ensor Module

    2irst" the product introduction

    In our daily life" te,perature and hu,idity on our li$es has a great i,pact" especially for factory

    #roduction" if !e are not !ell ,astered and take rele$ant ,easures" then it rings !ill e a greatloss" not

    ;$er Well no!" there is a te,perature sensor that can ,easure not only ut also ,easured

    hu,idity" it really can sol$e our pro le,s

    Yet& Well" follo!ing up on learning ho! to use it" it rings con$enience to your life& & & & &

    (econd" the ,odule related presentations

    D 811 digital te,perature and hu,idity sensor is a cali rated digital signal output te,perature

    and hu,idity co, ined sensor" !hich

    Application-specific ,odules capture technology and digital te,perature and hu,idity sensor

    technology to ensure that products !ith high relia ility and e%cellent

    Long-ter, sta ility& 8he product has e%cellent Buality" fast response" anti-interference a ility" high

    cost and other ad$antages& (ingle

    Wire serial interface that allo!s Buick and easy syste, integration&

  • 8/12/2019 37 sensores

    27/67

    Accuracy u,idity -/` : " te,perature -+

    :esolution u,idity 1` : " te,perature 1

    Long-ter, sta ility JE 1` : Year

    I9 Notes1" to a$oid the use of the condensation conditions

    +" long-ter, storage te,perature 1'-.' " hu,idity elo! 0'`

    3" the use of po!er and ground connection to e correct" so as not to da,age the sensor

    2i$e" instructions for use

    A out D 811 specific ti,ing pro le,s !e can refer to its datasheet" see the follo!ing ,odules"

    such as our co,pany

    e connected !ith the Arduino oard

    8he a o$e is typical of its connection !ith the processor" the follo!ing are specific connection

    reference

    Module S S 8er,ination / 9 output" S-S 8er,inal GND" S(S 8er,ination digital port on the 7th

    pin 6!hen

    o!e$er" this can also define your o!n digital pins F connection is $ery si,ple" !e only ha$e the

    follo!ing test phase& & & & & &

    (i%" ,odule function test

    ard!are :eBuire,ents

    Arduino controller H 1

  • 8/12/2019 37 sensores

    28/67

    digitalWrite 6D pin" L;W F us do!n" send start signalF

    delay 63' F delay greater than 1),s" so D 811 start signal can e detectedF

    digitalWrite 6D pin" IG F

    delayMicroseconds 6.' F Wait D 811 responseF pinMode 6D pin" IN#

  • 8/12/2019 37 sensores

    29/67

    ha ha& & & & & & (o then !e

    @a akhstan fe! reaths try it

    And i,agine the sa,e hu,idity significantly larger" ha" this thing really is pretty good& & & & Are

    interested" you can*e on your o!n hands freBuently e in place" so your heart there at the end&

    9II onclusion

    Modules introduced here !ill tell so,e" and if you are interested in it" then you can uy your o!n

    at ho,e" slo!ly

  • 8/12/2019 37 sensores

    30/67

    /" the !orking $oltage /9

    0" L4D dri$e ,ode co,,on cathode dri$er

    8hree" Arduino test code

    int redpin O 11F select the pin for the red L4Dint luepin O 1'F select the pin for the lue L4D

    int greenpin O 5 F select the pin for the green L4D

    int $alF

    $oid setup 6

    pinMode 6redpin" ;

  • 8/12/2019 37 sensores

    31/67

    Mercury s!itch ,odule and a digital interface" uilt-in 13 L4D uild a si,ple circuit to produce

    tilt !arning la,p

    13 co,es !ith digital interfaces of the L4D" the ,ercury tilt s!itch sensor interface to access

    digital 3" !hen the !ater

    (il$er tilt s!itch sensor senses a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the ,ercury tilt s!itch sensor interface

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    32/67

    '10 photoresistor ,odule

    I& Introduction

    #hotoresistor in our daily li$es ut also e a le to see" is ,ainly used in s,art s!itch" gi$ing our students

    Li$e rings so,e con$enience" ut" in our daily electronic design !ill also e used& 8hen in order

    to ,ake etter use"

    We ha$e the appropriate ,odule" easy to use" and efficient&

    (econd" an o$er$ie!

    #hotoresistors are se,iconductor photosensiti$e de$ices" in addition to ha$ing high sensiti$ity"

    fast response" consistent !ith the spectral characteristics and $alue of r

    Good features" ut at a high te,perature" and hu,idity in harsh en$iron,ents" ut also to ,aintain

    a high degree of sta ility and relia ility" !ide

    #an used ca,eras" solar garden lights" la!n" detectors" clock" ,usic" cups" gift o%es" ,ini-

    Night light" light $oice s!itches" lights auto,atically s!itch toys and a $ariety of light control"

    light control lighting" la,ps and other light auto,atic opening

    ;22 control field

    8hird" the ,ain para,eters and characteristics

    1" according to the spectral characteristics of the photoresistor has three photoresistor

  • 8/12/2019 37 sensores

    33/67

    *" (ensiti$ity (ensiti$ity is irradiated y light sensiti$e resistor" the resistance $alue 6dark

    resistance !hen irradiated !ith light

    :esistance $alue 6light resistance the relati$e change in $alues&

    " $olt-a,pere characteristic cur$e& 9oltage characteristic cur$es are used to descri e theresistance of the applied $oltage and the photosensiti$e photocurrent relationship"

    ;n the photosensiti$e de$ices" the light current !ith applied $oltage increases&

    D" te,perature coefficient& #hotoelectric effect photoresistor affected y te,perature" at a lo!

    te,perature portion photoresistor photoelectric

    (ensiti$e high sensiti$ity at high te,peratures is lo!&

    4" rated po!er& #hotosensiti$e resistor rated po!er is allo!ed for certain lines in the po!er

    consu,ed !hen the te,perature rise

    igh" its po!er consu,ption is reduced&

    2ourth" the use

    *ecause !e are in the Arduino en$iron,ent" then !e take a look at ho! they are connected to the

    corresponding

    And general sensors" t!o po!er lines and a data ca le" !iring is si,pleF

    8hen our su seBuent test circuit !iring can e like it& Well" since the !iring !ill e" !e take a

    look at the follo!ing

    In the end ho! to use it&

    2i$e" ,odule test

    ard!are :eBuire,ents

    1" Arduino controller H 1

    +"

  • 8/12/2019 37 sensores

    34/67

    '17 :elay Module

    I& IntroductionAt present" the co,pany?s products ha$e ,ultiple types of relays" including a relay" t!o relays" .

    relay"

    0 relay" ) relays" etc&" to ,eet the needs of different users use the relay is !hen the input

    6e%citation

    :eed a,ount ,eet the reBuire,ents change" the output circuit in the electrical ,anipulation

    occurred predeter,ined a,ount charged a step change in an electrical

    Makers& 8he co,pany produces relay ,odule can e connected to +.'9 A or +)9 D po!er

    into a $ariety of other electrical parts

    Line control& an e achie$ed using single-chip ti,ing control s!itching purposes& an e used in

    anti-theft alar," toys" uilding

    Let other fields& :elay is an electrically controlled de$ice& It has a control syste, 6also kno!n as

    the input circuit and the control syste,

    6Also kno!n as the output circuit the interaction et!een& o,,only used in auto,ation control

    circuit" it is actually a s,all

    urrent to control a large current operation Sauto,atic s!itch&S 8herefore" the circuit

    auto,atically ad]usts the play" safety protection" transfer

    on$ersion circuit and so on& #articularly suita le for single-chip control strong electric de$ices&

    In the control and use is also $ery con$enient" ]ust gi$e input corresponding output relay different

    le$els" you canAchie$ed y controlling the relay control purposes other de$ices" in addition" in the ,ulti-channel

    P

  • 8/12/2019 37 sensores

    35/67

    relay # * layout on the use of t!o lines

    Layout" user-lead connections& While in the circuit of a D diode added greatly i,pro$ed relay

    Module to engage current a ility to pre$ent the transistor eing urned& In addition" !e added a

    relay this po!er indicator Lights 6e%cept relay all the !ay " the indicator is red& In rightest relay also adds a status indicator&

    an

    8o let e$eryone real-ti,e o ser$ation of the relay s!itch status&

    (econd" the ,odule classification introduced

    1" one relay

    A" the ,ain purpose

    :elay is a function of the auto,atic isolation s!itching ele,ents" are !idely used in re,ote

    control" tele,etry" co,,unications" auto,atic control"

    Mechatronics and po!er electronic de$ices" is one of the ,ost i,portant control ele,ents&

    *oils do!n to the follo!ing effect

    1 e%pand the control range for e%a,ple" ,ulti-contact relay control signal reaches a certain

    $alue" you can not press the contact group

    Different for,s" and for access" reaking" connected ,ulti-channel circuits&

    + \oo, for e%a,ple" sensiti$e relays" relays" etc&" !ith a $ery s,all a,ount of control" you can

    control a large

    8he po!er of the circuit&

    3 Integrated signal for e%a,ple" !hen a plurality of control signals in the for, prescri ed input

    ,ulti-!inding relay" y co,parison ,echani ed

    8ogether" to achie$e the desired control effect&. auto,atic" re,ote control and ,onitoring for e%a,ple" the auto,atic de$ice relays together

    !ith other appliances" can e co,posed of progra, control

    Wire line" in order to achie$e auto,atic operation

    *" Note

    1 :ated $oltage refers to nor,al !orking hours relay coil $oltage reBuired"

    8he control circuit is a control $oltage& According to the relay ,odel" can e ac

    #ressure" it can e a D $oltage&

    + D resistance refers to the relay coil D resistance" ,easured y the ,ulti,eter&

    3 #ick-up current refers to the relay pull action can produce a ,ini,u, current& In nor,al use"

    the current !ill e gi$en

    *e slightly larger than the pull current" so that the relay can e operated sta ly& 8he !ork of the

    coil $oltage is applied" generally do not

    8o ,ore than 1&/ ti,es the rated !orking $oltage" other!ise it !ill ha$e a greater current to the

    coil urnt&

    . release current refers to the relay generates the ,a%i,u, current release action& When the

    relay state current is reduced to a

    ertain e%tent" the relay !ill re$ert to the release of unpo!ered state& 8hen the current is ,uch

    s,aller than the pull current&

    / contact s!itch $oltage and current is the relay to allo! the applied $oltage and current& Itdeter,ines the relay to control

    9oltage and current si e" use can not e%ceed this $alue" it !ill e $ery easy to da,age the relay

    P

  • 8/12/2019 37 sensores

    36/67

    contacts&

    " ,odule test

    #in Description elo!

    Description ;M to 9 " N; then !e ha$e to control the L4D anode" !hichLike !hen the relay turns on" L4D lights !ill e litF

    8o co,plete the look of this test ,ust e prepared to !hat !hat they specifically

    Arduino controller H 1

  • 8/12/2019 37 sensores

    37/67

    8ilt s!itch ,odule and a digital interface" uilt-in 13 L4D uild a si,ple circuit to produce tilt

    !arning la,p

    13 co,es !ith digital interfaces of the L4D" the tilt s!itch sensor interface to access digital 3"

    !hen the tilt open

    ;ff sensor senses a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the tilt s!itch sensor interfaces

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    38/67

    '15 MINI reed s!itch ,odule

    :eed ,odule and the interface co,es !ith digital 13 L4D uild a si,ple circuit to produce a :eed

    !arning la,p

    13 co,es !ith digital interfaces of the L4D" the :eed sensor access nu, er 3 interface" !hen

    :eed sensors(ensed a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the :eed sensor interfaces

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    39/67

    '+' Infrared re,ote control ,odule

    I& Introduction

    8his is a ne! ultra-thin 3)@ uni$ersal infrared re,ote control" using the N4 encoding for,at"

    ,ainly for cars

    ontaining M#3" foot ath" lighting design eBuipped" digital photo fra,e" ,icrocontroller

    de$elop,ent oard learning oard and other occasions& *ecause it is ased on non-

    Line re,ote control" so people see, easy to use" effecti$e" and no! ,ore and ,ore !ide

    application field" then for

    8his product of our co,pany that !e !ill ,ake the follo!ing introduction&

    (econd" the technical para,eters

    Infrared re,ote control distance ,ore than ) ,etersLaunch tu e infrared !a$elength 5.'N,

    rystal freBuency .//@ \ crystal

    P

  • 8/12/2019 37 sensores

    40/67

    arrier freBuency 3)@ \

    4ncoding encoding for,at for the N4

    (i e )0 .' 0,,

    #o!er :+'+/ 10'',A8hird" the use

    We ,ust re,e, er that efore using the re,ote control to the infrared cell" as !ell as infrared

    re,ote control infrared recei$er ,odule allo!s to co, ine

  • 8/12/2019 37 sensores

    41/67

    - ontroller trans,itting signals o$erF y the test results can e seen each key has its o!n

    he%adeci,al encoding" if I

    We long press a utton in the (erial Monitor !indo! sho!s 22222222&

    '+1 #(+ ga,e ]oystick a%is sensor ,odule

    2irst" the product description

    8he co,pany produces #(+ ga,e ]oystick a%is sensor ,odule consists of using original Buality

    ,etal #(+ ]oystick potentio,eter syste,

    2or" !ith 6V" Y +-a%is analog output" 6\ 1 digital output channel utton& With Arduino sensor

    e%pansion oard can e ,ade

    2or re,ote control and other interacti$e !ork& In addition the product in order to allo! custo,ers

    to ,ore easily fit arduino e%pansion oards and other standard interfaces

    Mouth" in the design of the V" Y" \-a%is circuit leads indi$idually" you can use three dedicated

    lines really pin A:D

  • 8/12/2019 37 sensores

    42/67

    8ype of %" y di,ension for the analog input signal is a digital input signal di,ension" therefore"

    % and y connected to the analog port

    #in sensor end" and port is connected to the digital port&

    8hird" the use;n ho! to use" !e first look at ho! it !orks no!" so !e kno! it is there in the end

    o!" !hich !e find it helpful to use" there is a functional diagra, elo!" !e take a look

    No! !e should clear it" in fact" it is a potentio,eter Well" %" y di,ension of the data output is

    analog

    #ort readout $oltage $alue" is not a little surprised& ;f course" this is not sho!n a o$e" -

    di,ensional data output" in fact" it is ,ore

    (i,ple" !e kno! that -di,ensional output only ' and 1" then it can e achie$ed through a utton

    ar& No! on !e should

    (urface of saying" it is a potentio,eter and utton co, ination 68o e honest" if you do not

    understand it ]ust to see that

    (entence is a it foggy it &

    After reading the chart I elie$e !e all kno! ho! to use it right Arduino" %" y di,ension !e

    recei$ed t!o analog ports

    :ead their $alues" and di,ensions !e are to the digital port" so that the line" plus the po!er and

    ground" so fine& & & &

    2ourth" the ,odule test

    Let?s look at this test !hat things !e ha$e" in fact" not ,uch& & & &

    Arduino controller H 1

  • 8/12/2019 37 sensores

    43/67

    #rogra, function it can play sensor status 6%" y" three-di,ensional data in real ti,e response to

    the co,puter screen 6!e use the

    (erial Monitor !indo! " here I cut a figure for e$eryone to look at itIs not it" the test is successful" or ,ore I play" !e ha$e the opportunity to see for yourself& & & & & &

    I elie$e !e carefully read the a o$e sche,atic !ould say" in fact" I can also DIY

    A yo" ut ,ight not look so good" it is not so s,oothly control it" ah" yes" i,itation principle"

    #repare their o!n t!o potentio,eters and a key entirely possi le Yeah" this !ould lea$e you

    co,plete it" the follo!ing test code"

    We can take a try& & &

    int [oy(tickUV O 'F %

    int [oy(tickUY O 1F y

    int [oy(tickU\ O 3F key

    $oid setup 6

    pinMode 6[oy(tickUV" IN#

  • 8/12/2019 37 sensores

    44/67

    Linear all ,agnetic ,odule and a digital interface" uilt-in 13 L4D uild a si,ple circuit to

    produce a ,agnetic field !arning la,p13 co,es !ith digital interfaces of the L4D" the linear all sensor ,agneto,eter access nu, er 3

    interface" !hen linear all ,agneto,eter

    (ensor senses a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the linear all ,agnetic sensor interface

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    45/67

    digitalWrite 6Led" L;W F

    '+3 :eed ,odule

    :eed ,odule and the interface co,es !ith digital 13 L4D uild a si,ple circuit to produce a :eed

    !arning la,p

    13 co,es !ith digital interfaces of the L4D" the :eed sensor access nu, er 3 interface" !hen

    :eed sensors

    (ensed a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the :eed sensor interfaces

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    46/67

    $al O digital:ead 6 uttonpin F digital interface !ill e assigned a $alue of 3 to read $al

    if 6$al OO IG When the :eed sensor detects a signal" L4D flashes

    digitalWrite 6Led" IG F

    else

    digitalWrite 6Led" L;W F

    '+. @4Y4( A:D

  • 8/12/2019 37 sensores

    47/67

    $oid loop 6

    $al O digital:ead 6 uttonpin F digital interface !ill e assigned a $alue of 3 to read $alif 6$al OO IG When the fla,e sensor detects a signal" L4D flashes

    digitalWrite 6Led" IG F

    else

    digitalWrite 6Led" L;W F

    '+/ Magic light cup ,odule

    Magic Light up ,odules are easy to Interacti$e 8echnology Di$ision de$eloped a can and

    A:D

  • 8/12/2019 37 sensores

    48/67

    int Led#in* O 0F

    int *utton#inA O 7F

    int *utton#in* O .F

    int utton(tateA O 'Fint utton(tate* O 'F

    int rightness O 'F

    $oid setup 6

    pinMode 6Led#inA" ;

  • 8/12/2019 37 sensores

    49/67

    Digital te,perature ,odule and a digital interface" uilt-in 13 L4D uild a si,ple circuit" ,aking

    the te,perature !arning la,p

    13 co,es !ith digital interfaces of the L4D" the digital te,perature sensor connected digital three

    interfaces" !hen the digital te,perature

    (ensor senses a key signal" L4D lights" other!ise off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the digital te,perature sensor interface

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    50/67

    olor Green :ed

    Dia,eter /,,

    ase olor None

    #ackage 8ype Diffusion

    9oltage 69 G +&3-+ &0 9F : 1&5-+ &+ 9

  • 8/12/2019 37 sensores

    51/67

    delay 61/ F

    for 6$al O 'F $al J+//F $al

    analogWrite 611" $al F

    analogWrite 61'" +//-$al F

    delay 61/ F

    (erial&println 6$al" D4 F

    '+) @4Y4( A:D

  • 8/12/2019 37 sensores

    52/67

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    53/67

    reflected ack" !hen the indicator is lit"

    8hrough the circuit" the signal output interface output digital signal that can e detected y ,eans

    of potentio,eter kno to ad]ust the distance" the effecti$e distance

    2ro, + X .'c," !orking $oltage of 3&39-/9" operating $oltage range as road" relati$ely largefluctuations in the po!er supply $oltage of the situation

    (ta le condition and still !ork for a $ariety of ,icrocontrollers" Arduino controller" *(+

    controller" attached to the ro ot that

    an sense changes in their surroundings&

    (pecifications

    1 Working $oltage D 3&39-/9

    6+ Working current +',A

    63 ;perating te,perature -1' - /'

    . detection distance +-.'c,

    /&I; Interface .-!ire interfaces 6- ( 4N

    0 ;utput signal 88L le$el 6lo! le$el there is an o stacle" no o stacle high

    7& Ad]ust,ent ad]ust ,ulti-turn resistance

    ) 4ffecti$e angle 3/ C

    7 (i e +),, H +3,,

    ) Weight (i e 5g

    ere !e use the o stacle a$oidance ,odule and a digital interface" uilt-in 13 L4D uild a si,ple

    circuit" ,aking a$oidance !arning la,p" the o stacle a$oidance

    (ensor Access Digital 3 interface" !hen o stacle a$oidance sensor senses a signal" L4D light" and$ice $ersa off&

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define the o stacle a$oidance sensor interface

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    54/67

    '3' 7 color flashing L4D ,odule auto,atically

    7 color flashing L4D ,odule auto,atically uses /,, round high- rightness light-e,itting diode

    !hich has the follo!ing characteristics

    1 #roduct 8ype L4D

    + #roduct Model Y*-31+'*.#nYG-#M

    3 (hape :ound L4D /,, DI# type

    . olor pink yello! green 6high rightness

    / Lens type !hite ,ist

    0 (tandard 2or!ard 9oltage 3&'-. &/ 9

    Arduino test cod

    *link

    8urns on an L4D on for t!o second" then off for t!o second" repeatedly&

    8his e%a,ple code is in the pu lic do,ain&

    $oid setup 6

    P

  • 8/12/2019 37 sensores

    55/67

    Initiali e the digital pin as an output&

    #in 13 has an L4D connected on ,ost Arduino oards

    pinMode 613" ;

  • 8/12/2019 37 sensores

    56/67

    pinMode 6led#in" ;

  • 8/12/2019 37 sensores

    57/67

    $oid loop 6

    $al O digital:ead 6 uttonpin F digital interface !ill e assigned a $alue of 3 to read $al

    if 6$al OO IG When the ,etal touch sensor detects a signal" L4D flashes

    digitalWrite 6Led" IG F

    else

    digitalWrite 6Led" L;W F

    '33 igh sensiti$ity sound detection ,odule

    2or sound detection

    Module has t!o outputs1" A;" analog output" real-ti,e output $oltage signal of the ,icrophone

  • 8/12/2019 37 sensores

    58/67

    +" D;" !hen the sound intensity reaches a certain threshold" the output high and lo! signal

    Pthreshold - sensiti$ity can e ad]usted $ia potentio,eter

    DayQ

    Module features

    +" there is a ,ounting scre! hole 3,,3" the use /$ D po!er supply

    ." !ith analog output

    /" there are threshold le$el output flip

    0" high sensiti$e ,icrophone and high sensiti$ity&

    7" a po!er indicator light

    )" the co,parator output is light

    A:D

  • 8/12/2019 37 sensores

    59/67

    delay 6sensor9alue F

    digitalWrite 6led#in" L;W F

    delay 6sensor9alue F

    (erial&println 6sensor9alue" D4 F

    '3. Microphone sound detection ,odule

    2or sound detection

    Module has t!o outputs

    1" A;" analog output" real-ti,e output $oltage signal of the ,icrophone

    +" D;" !hen the sound intensity reaches a certain threshold" the output high and lo! signal

    Pthreshold - sensiti$ity can e ad]usted $ia potentio,eter

    DayQ

    Module features

    +" there is a ,ounting scre! hole 3,,

    3" the use /$ D po!er supply

    ." !ith analog output

    /" there are threshold le$el output flip

    0" a po!er indicator light

    7" the co,parator output is light

    A:D

  • 8/12/2019 37 sensores

    60/67

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    61/67

    8his pro]ect uses right infrared 6I: L4D and a phototransistor to detect the pulse of the finger" a

    red L4D flashes !ith each pulse&

    #ulse ,onitor !orks as follo!s 8he L4D is the light side of the finger" and phototransistor on the

    other side of the finger" phototransistor used to o tain the flu% e,itted" !hen the lood pressure

    pulse y the finger !hen the resistance of the phototransistor !ill e slight changed&

    8he pro]ect?s sche,atic circuit as sho!n"

    We chose a $ery high resistance resistor :1" ecause ,ost of the light through the finger is

    a sor ed" it is desira le phototransistor sensiti$e enough& :esistance can e selected ye%peri,ent to get the est results&

    8he ,ost i,portant is to keep the shield stray light into the phototransistor& 2or ho,e lighting that

    is particularly i,portant ecause the lights at ho,e ,ostly ased /' \ or 0' \ fluctuate" so faint

    heart eat !ill add considera le noise&

    A:D

  • 8/12/2019 37 sensores

    62/67

    $oid loop 6

    static dou le old9alue O 'F

    static dou le old hange O 'F int ra!9alue O analog:ead 6sensor#in F

    dou le $alue O alpha old9alue 61 - alpha ra!9alueF

    (erial&print 6ra!9alue F

    (erial&print 6S"S F

    (erial&println 6$alue F

    old9alue O $alueF

    delay 6period F

    30& @4Y4( 8racking Module

    L4D lights use 13 #IN and 8racking sensor co, ines to ,ake a !arning light

    :outines source code

    int Led O 13 F define L4D Interface

    int uttonpin O 3F define 8racking (ensor Interface

    int $al F define nu,eric $aria les $al

    $oid setup 6

    pinMode 6Led" ;

  • 8/12/2019 37 sensores

    63/67

    if 6$al OO IG When the 8racking sensor detects a signal" L4D flashes

    digitalWrite 6Led" IG F

    else

    digitalWrite 6Led" L;W F

    '37 :otary encoder ,odule

    *y rotating the rotary encoder can e counted in the positi$e direction and the re$erse direction

    during rotation of the output pulse freBuency" unlike rotary potentio,eter counter" !hich

    (pecies rotation counts are not li,ited& With the uttons on the rotary encoder can e reset to its

    initial state" that starts counting fro, '&

    o! it !orks incre,ental encoder is a displace,ent of the rotary pulse signal is con$erted to a

    series of digital rotary sensors& 8hese pulses are used to control

    Angular displace,ent& In 4ltra angular displace,ent encoder con$ersion using a photoelectric

    scanning principle& :eading syste, of alternating light trans,itting !indo! and the !indo! is

    not

    onsisting of radial inde%ing plate 6code !heel rotating asis" !hile eing an infrared light

    source $ertical irradiation light to the code disk i,age onto the recei$ing

    ;n the surface& :ecei$er is co$ered !ith a diffraction grating" !hich has the sa,e code disk

    !indo! !idth& 8he recei$er?s ]o is to feel the rotation of the disc

    :esulting changes" and change the light into corresponding electrical changes& 8hen the lo!-le$elsignals up to a higher le$el" and generates no interference

  • 8/12/2019 37 sensores

    64/67

    (Buare pulse" !hich ,ust e processed y electronic circuits& :eading syste,s typically e,ploy a

    differential ,anner" a out the sa,e ut the phase difference of the t!o !a$efor,s

    Different y 1)' C co,pared to the signal in order to i,pro$e the Buality and sta ility of the

    output signal& :eading is then the difference et!een the t!o signals for,ed on the asis"

    8hus eli,inating the interference&Incre,ental encoder

    Incre,ental encoders gi$e t!o-phase sBuare !a$e" the phase difference et!een the, 5' C" often

    referred to as A and * channels& ;ne of the channels is gi$en and speed-related

    Infor,ation" at the sa,e ti,e" y seBuentially co,paring t!o channel signals" the direction of

    rotation of the infor,ation o tained& 8here is also a special signal called \ or

    \ero channel" !hich gi$es the a solute ero position encoder" the signal is a sBuare !a$e !ith the

    center line of channel A sBuare !a$e coincide&

    lock!ise counterclock!ise

    A *

    11

    '1

    ' '

    1'

    A *

    11

    1'

    ' '

    '1

    Incre,ental encoder accuracy depends on the ,echanical and electrical t!o factors" these factorsare :aster inde%ing error" disc eccentricity" earing eccentricity" e-reading

    (e$eral ,eans into the optical portion of the errors and inaccuracies& Deter,ine the encoder

    resolution is ,easured in electrical degrees" the encoder accuracy depends

    (et the pulse encoder generates inde%ing& 8he follo!ing electrical degrees !ith a 30' C rotation of

    the shaft to said ,achine" and rotation of the shaft ,ust e a full !eek of

    #eriod& 8o kno! ho! ,uch electrical eBui$alent of the ,echanical angle of 30' degrees can e

    calculated !ith the follo!ing for,ula 4lectrical 30' O Machine 30' C n C pulses re$olution

    2igure A" * co,,utation signals

    4ncoder inde%ing error is the electrical angle of the unit t!o successi$e pulse ,a%i,u, offset to

    represent& 4rror e%ists in any encoder" !hich

    Is caused y the afore,entioned factors& 4ltra encoder ,a%i,u, error is E +/ electrical degrees

    6declared in any condition " eBui$alent to the rated

    ;ffset $alues E 7`" as the phase difference 5' C 6electrical of the t!o channels of the ,a%i,u,

    de$iation E 3/ electrical degrees is eBual to E 1'` de$iation left :atings

    :ight&

  • 8/12/2019 37 sensores

    65/67

    Machine"

  • 8/12/2019 37 sensores

    66/67

    if 6countK target ount

    set(tate 6 F

    count O 'F

    delay 61 F

    int get4ncoder8urn 6

    :eturn -1" '" or 1

    static int oldA O L;WF

    static int old* O L;WF

    int result O 'F

    int ne!A O digital:ead 6a#in F

    int ne!* O digital:ead 6 #in F

    if 6ne!A= O oldA ne!*= O old*

    (o,ething has changed

    if 6oldA OO L;W ZZ ne!A OO IG

    result O - 6old* + - 1 F

    oldA O ne!AF

    old* O ne!*F

    return resultF

    int set(tate 6

    if 6state OO '

    setLights 6 IG " L;W" L;W F

    target ount O long#eriodF

    state O 1F

    else if 6state OO 1

    setLights 6 IG " IG " L;W F

    target ount O short#eriodF

    state O +F

    else if 6state OO +

  • 8/12/2019 37 sensores

    67/67

    setLights 6L;W" L;W" IG F

    target ount O long#eriodF

    state O 3F

    else if 6state OO 3

    setLights 6L;W" IG " L;W F

    target ount O short#eriodF

    state O 'F

    $oid setLights 6int red" int yello!" int green

    digitalWrite 6red#in" red F

    digitalWrite 6yello!#in" yello! F

    digitalWrite 6green#in" green F