Vous êtes sur la page 1sur 10

M LM Q NLNP

q ~= ~ = j

Physical ComputingTransistors and Motors

DC Motors
DC motors are all around you. They allow your cellphone to vibrate, they run laptop fans and they run the dvd drives.

Parameters of motors
direct-drive vs. gearheadbuilt-in gears or not voltagewhat voltage it best operates at current (efficiency)how much current it needs to spin speedhow fast it spins torquehow strong it spins size, shaft diameter, shaft length,etc.

Characteristics
When they first start up, they draw a lot more current, up to 10x more. They draw a lot of current when they stall They can operate in either direction, by switching voltage polarity Polarity controls the direction Usually spin very fast: >1000 RPM To get slower spinning, need gearing To drive a motor, apply a voltage. The higher the voltage, the faster the spinning. Just as voltage causes rotation, rotation causes voltage. The circuit for motors is more complex than prior circuits you have worked with. In addition to using familiar components, you'll also be using a DC Motor, diode , and a transistor.

Diodes
Diodes allow current to flow only in one direction. Motors often create current spikes as they turn on and off. These spikes can damage the transistor, so you use a diode to protect the transistor from the spikes. Diodes have polarity, so the direction you install them matters. The bar in the schematic diagram corresponds to a white stripe on the actual diode. Current can only flow in the direction of the triangle.
~ K L~ L | LO M ~ M UL K NLNM

M LM Q NLNP

q ~= ~ = j

Since motors can act like generators, need to prevent them from generating kickback into the circuit Once a motor starts spinning, its inertia keeps it spinning, this turns it into a generator and thus can generate a kickback voltage. The kickback diode routes that voltage harmlessly back into the motor so it can't damage the rest of the circuit. Kickback is also called back EMF (EMF == electromotive force == voltage)

Transistors
Transistors have three terminals: The base is the input that you use to open and close the switch across the collector and emitter. On this type of transistor (called an NPN, you need to make sure the collector is always more positive than the emitter. Generally you do this by connecting the emitter to ground. Because the motor requires much more power than the Arduino is capable of providing, you use batteries to power the motor. The transistor allows you to control the amount of current that flows from the battery through the motor. Transistors are used to run loads larger than 5V.

~ K L~ L | LO M ~ M UL K

O LNM

Typical Tip120 circuit

Controlling Motors
You can control speed of motor with a a o W i e ) just like controlling brightness of LED. nlgrt( If you use a small motor, you can wire it up on the same breadboard:

M LM Q NLNP

q ~= ~ = j

In Arduino add this code: itmtr__ n oo=_; ca vl hr a; vi stp) od eu({ pnoe___OTU) iMd(__,UPT; Sra.ei(90) eilbgn120; Sra.rnl(etrsednme 09) eilpitn"ne pe ubr -"; } vi lo({ od op) vlSra.ed) a=eilra(; i(a>''&vl=9) fvl=0 &a<''{ vlvl'' /cnet fo ca t nm a=a-0; /ovrs rm hr o u vl2*a;/cnet nmt 025 a=8vl /ovrs u o -5 aaoWie__,_) nlgrt(____; Sra.rnl(etrsednme 09) eilpitn"ne pe ubr -"; } }

Bigger Motor

~ K L~ L | LO M ~ M UL K

Q LNM

M LM Q NLNP

q ~= ~ = j

Wire up a DC Motor with a pot

~ K L~ L | LO M ~ M UL K

RLNM

M LM Q NLNP

q ~= ~ = j

H-Bridges
The SN754410 is a handy IC that allows you to control the speed and direction of a DC motor with only one PWM output and two digital outputs from your Arduino board

~ K L~ L | LO M ~ M UL K

SLNM

M LM Q NLNP

q ~= ~ = j

The first half of the 270 degree turning angle of the potentiometer will make the motor run forward. The motor's speed will decrease the more the knob is turned toward the potentiometer's center position. The second half of the turning angle will make the motor run in reverse, with increasing speed toward the 270 mark. the percentages in the following picture are related to the motor's speed.

~ K L~ L | LO M ~ M UL K

TLNM

M LM Q NLNP

q ~= ~ = j

/ * *Adiocd frS741 Hbig run oe o N540 -rde *mtrdie cnrl Aptnimtrs oo rvr oto. oetoee' *20dge rttoa agei ue t 7 ere oainl nl s sd o *cnrlaD mtri tefloigwy oto C oo n h olwn a: *015dges-mtrrn frad sed -3 ere oo us owr, pe *gtigsoe tehge teage mtr etn lwr h ihr h nl, oo *sosa 15dges tp t 3 ere. *1520dges mtrrn bcwr, 3-7 ere: oo us akad *sedi gtigfse tehge te pe s etn atr h ihr h *age mtrsedi 0a 15dges nl, oo pe s t 3 ere. * *cplf Fb 20,Fba Wnlr oyet e. 08 ain ike * * / itpti =0 n oPn ; / aao iptpn0frteptnimtr / nlg nu i o h oetoee itsedi =3 n pePn ; / Hbig eal pnfrsedcnrl / -rde nbe i o pe oto itmtrPn=6 n oo1i ; / Hbig lg1 / -rde e itmtrPn=7 n oo2i ; / Hbig lg2 / -rde e itldi =1; n ePn 3 / sau LD / tts E itvl=0 n a ; / vral t soetevlecmn fo te / aibe o tr h au oig rm h

vi stp){ od eu( / stdgtliopn a otus / e iia / is s upt: pnoesedi,OTU) iMd(pePn UPT; pnoemtrPn OTU) iMd(oo1i, UPT;
~ K L~ L | LO M ~ M UL K ULNM

pnoemtrPn OTU) iMd(oo2i, UPT; pnoeldi,OTU) iMd(ePn UPT; } vi lo( { od op) dgtlrt(ePn HG) / sau LDi awy o iiaWieldi, IH; / tts E s las n vl=aaoRa(oPn; a nlgedpti) / ra tevlefo teptnimtr / ed h au rm h oetoee vl=vl4 a a/; / cnet012 rnet 025rne / ovr -03 ag o -5 ag i (a < 17 { f vl = 2) / ptmtri fradmto / u oo n owr oin dgtlrt(oo1i,LW; / stlg1o teHbig lw iiaWiemtrPn O) / e e f h -rde o dgtlrt(oo2i,HG) / stlg2o teHbig hg iiaWiemtrPn IH; / e e f h -rde ih / cnrlsedbsdo ageo ptnimtr / oto pe ae n nl f oetoee aaoWiesedi,24(a*); / otu seda PMvle nlgrt(pePn 5-vl2) / upt pe s W au / ti vlenest g fo 24t 0friptvle / hs au ed o o rm 5 o o nu aus /fo 0t 17 /rm o 2 } / ptmtri bcwr mto / u oo n akad oin es { le dgtlrt(oo1i,HG) / stlg1o teHbig hg iiaWiemtrPn IH; / e e f h -rde ih dgtlrt(oo2i,LW; / stlg2o teHbig lw iiaWiemtrPn O) / e e f h -rde o / cnrlsedbsdo ageo ptnimtr / oto pe ae n nl f oetoee aaoWiesedi,(a*)26; / otu seda PMvle nlgrt(pePn vl2-5) / upt pe s W au / ti vlenest g fo 0t 24friptvle / hs au ed o o rm o 5 o nu aus / fo 18t 25 / rm 2 o 5 } }

Here is another H-Bridge program: / smlMtruigt Hrde * ipeoo sn h Big *--------------* / /teHbig tkstootusfo teAdiot cnrltemtr /h rde ae w upt rm h run o oto h oo. itmtrPn=4 n oo1i ; itmtrPn=3 n oo2i ; / teei oesic / hr s n wth itsicPn=1 n wthi ; /dcaetesaevral /elr h tt aibe itsae=0 n tt ; vi stp){ od eu( /temtrcnrlwrsaeotus /h oo oto ie r upt pnoemtrPn OTU) iMd(oo1i, UPT; pnoemtrPn OTU) iMd(oo2i, UPT;

M LM Q NLNP

q ~= ~ = j

/tesic i a ipt /h wth s n nu pnoesicPn IPT; iMd(wthi, NU) } vi lo( { od op) /ra tesic /ed h wth sae=dgtledsicPn; tt iiaRa(wthi)

/bsdo tesaeo tesic atraetecnrlpn t cag h drcino tem /ae n h tt f h wth lent h oto is o hne e ieto f h sic (tt) wth sae{ cs 0 ae : dgtlrt(oo1i,HG) iiaWiemtrPn IH; dgtlrt(oo2i,LW; iiaWiemtrPn O) bek ra; cs 1 ae : dgtlrt(oo1i,LW; iiaWiemtrPn O) dgtlrt(oo2i,HG) iiaWiemtrPn IH; bek ra; } }

~ K L~ L | LO M ~ M UL K

NM LNM

Vous aimerez peut-être aussi