You are on page 1of 21

let's make

Login(/account/login)
Explore(/tag/typeid/)
| SignUp(/account/gopro?sourcea=header${sourceaurlParams})
Publish(/about/create.jsp)

Featured: share what


IntelIoT(/id/intel/)
LaserCutting(/tag/typeid/categoryworkshop/channellasercutting/)
you make
(/)
LifeHacks(/tag/typeid/categoryhome/channellifehacks/)
Fusion360(/id/Fusion/)

AboutThisInstructable

8 310.374views

License:

295favorites

MohannadRawashdeh
(/member/Mohannad+Rawashdeh/
MohannadRawashdeh
(http://www.genotronex.com/)

(/member/Mohannad+Rawashdeh/)
Follow 235

MorebyMohannadRawashdeh:

(/id/MotorDriver

(/file/FRWXF7GHMMF4YR8/)
BTS796043A/)

(/id/BYJ48StepperMotor/)

(/id/RF315433MHz

BYJ48StepperMotor byMohannadRawashdeh(/member/Mohannad+Rawashdeh/)
Download(/id/BYJ48StepperMotor/?download=pdf)

h(/id/BYJ48StepperMotor/)
Collection

(/file/FI0SQ71HMMF4YR9/)

(/file/F65M3G8HMMF4YRG/)

4Steps

TransmitterreceiverModuleandArdu/)
IMadeit!
Favorite
Share

Tags:
steppermotor(/tag/typeid/keywordstepper%20motor/)
arduino(/tag/typeid/keywordarduino/)

StepperMotorisamotorcontrolledbyaseriesofelectromagneticcoils.The
centershafthasaseriesofmagnetsmountedonit,andthecoilssurrounding
theshaftarealternatelygivencurrentornot,creatingmagneticfieldswhich
repulseorattractthemagnetsontheshaft,causingthemotortorotate.

BYJ48(/tag/typeid/keywordBYJ48/)
Driver(/tag/typeid/keywordDriver/)
ULN2003(/tag/typeid/keywordULN2003/)
stepper(/tag/typeid/keywordstepper/)

Thisdesignallowsforverypreciouscontrolofthemotor,Therearetwobasic
typesofsteppermotors,unipolarsteppersandbipolarsteppers.

DC(/tag/typeid/keywordDC/)
Module(/tag/typeid/keywordModule/)

InThisinstructable,IwilltalkaboutanUnipolarStepperMotor28BYJ48.
Theunipolarsteppermotorhasfiveorsixwiresandfourcoils(actuallytwocoils

Related

dividedbycenterconnectionsoneachcoil).Thecenterconnectionsofthecoils
aretiedtogetherandusedasthepowerconnection.Theyarecalledunipolar
steppersbecausepoweralwayscomesinonthisonepole.
(/id/28BYJ

Step1:Specification,MotorDriver

(/id/Arduino

(/id/An

(/id/Small

(/id/Theall

(/file/FP5CJZCHMWVZPBT/)

(/file/F45YX55HMMF4YXJ/)

(/file/F0SUW4EHMMF4YXK/)

(/file/FXTLPI9HMMF4YXN/)
ShowAllItems

TherearemanyTypesofDrivers,L293,ULN2003,A3967SLB
(https://www.sparkfun.com/datasheets/Robotics/A3967.pdf),AndMore,
The28BYJ48EvencomeswithBreakoutusingULN2003AsaMotordriver
chip.

28BYJ48StepperMotor
ControlSystemBasedOn
ArduinoWithULN2003Chip
(/id/28BYJ48StepperMotor
ControlSystemBasedOn
ArduinoLibraryfor28BYJ48
StepperMotorandULN2003
Driver(/id/ArduinoLibrary
for28BYJ48StepperMotor
andULN/)
AnArduinopowered
microplate
spectrophotometer(/id/An
Arduinopoweredmicroplate
spectrophotometer/)
SmallSolarRoom
TemperatureRegulator
(/id/SmallSolarRoom
TemperatureRegulator/)
byChanL2(/member/ChanL2/)
The"allinonebox"
aquariumfeeder(/id/Theall
inoneboxaquariumfeeder/)
byBrianfromBelgium
(/member/Brian+from+Belgium/)

SpecificationforthisMotor"Andyoucandownloaddatasheetfromthe
attachment"
Ratedvoltage5VDC
NumberofPhase4
SpeedVariationRatio1/64
StrideAngle5.625/64
Frequency100Hz
DCresistance507%(25)
IdleIntractionFrequency>600Hz
IdleOuttractionFrequency>1000Hz
IntractionTorque>34.3mN.m(120Hz)
SelfpositioningTorque>34.3mN.m
Frictiontorque6001200gf.cm
Pullintorque300gf.cm
InsulationgradeA
andtheschematicsofThisbreakoutshownlikethePicturesontheattachment
NotethatifyouwanttouseL293InsteadofULN2003,Youwillneedtoleave
RedwireNoconnection.

Materials:
youwillneed:
1)ArduinoBoard.
2)BYJ48StepperMotor5v
3)ULN2003MorordriverModule
4)Jumper.
5)5vvoltagesource"Optional".

28BYJ48.pdf(/files/orig/FQY/RHST/HMVJ7U24/FQYRHSTHMVJ7U24.pdf)

Step2:ArduinoCode.

(/file/FXRWP1EHMMF4Z5O/)

(/file/FT68TVVHMMF4Z5P/)

(/file/FB6LOAWHMMF4Z5Q/)

(/file/FEOP930HMMF4Z5R/)

(/file/FZGPTQ4HMMF4Z5S/)

TheArduinoIDESupportaLibraryforStepperMotor,VeryEasytouse,After
ConnectMotorwitharduinoYoucanUploadtheSketchontothearduino.
But...
Youmusttakesomethinginconsider:
ThisMotorhasaGearratioof64,andStrideAngle5.625sothismotorhasa

4096Steps.
steps=NumberofstepsinOneRevolution*Gearratio.
steps=(360/5.625)*64"Gearratio"=64*64=4096.thisvaluewill
substituteitonThearduinoSketch
ForadafruitStepperMotor(http://www.adafruit.com/products/918),theStride
Angle7.5andGearratiois16,Sonumberofstepsin1Revolutionis:
stepsinOneRevolution=360/7.5=48.
steps=48*16=768
That'swillbedifferentdependonwhatmotoryouareusing,SocheckThe
DatasheetforYourstepperMotortocalibratethisvalues
28BYJ48MotorDatasheet(http://robocraft.ru/files/datasheet/28BYJ
48.pdf).
MotorDriverULN2003BreakOutConnectedToArduinoFromIN1IN4ToD8
D11Respectively
ToPoweryouMotor,RecommandedtouseexternalPowerSupplywith5V
500mAatleast,Don'tpoweritdirectlyfromarduinoBoard5V.

Step3:LibraryDirectionIssue...Andhowtofixit.

(/file/FBD8BUKHMWVZNZQ/)

(/file/FG9S3MRHMWVZNZR/)

WhenYouUploadthesketchtothearduino,TheMotorwillBerotateinone
directionBytypethecommand:
step(steps)

SoyoumustPuttheNumberofsteptoturnthemotor.
Thereference(http://arduino.cc/en/Reference/StepperStep)saidYoucanput
thepositivevaluetoturnonedirection,negativetoturntheother.
Ifthat'sOKWithYourstepperMotor,Youdon'tneedtoreadthefollowing.
IfNot,YourMotorturntosamedirectionevenyouPutthestepsPositiveValue
ornegative,Whatistheissue?
ThisMotorneedtooperateastheTableontheattachment.
thearduinoStepperLibraryneedtomodifytomatchthisrequirement.
IwroteacodewhichisallowtothismotortoMoveclockwiseandcounterclock
wise
Codeinthenextstep:

Step4:ModifyCode

(/file/FV9LEN8HMWVZP97/)

thefinalcodeforthisSteppermotor:

/*
BYJ48Steppermotorcode
Connect:
IN1>>D8
IN2>>D9
IN3>>D10
IN4>>D11
VCC...5VPrefertouseexternal5VSource
Gnd
writtenBy:MohannadRawashdeh
http://www.instructables.com/member/Mohannad+Rawashdeh/
28/9/2013
*/
#defineIN18
#defineIN29
#defineIN310
#defineIN411
intSteps=0
booleanDirection=true//gre
unsignedlonglast_time
unsignedlongcurrentMillis
intsteps_left=4095
longtime
voidsetup()
{
Serial.begin(115200)
pinMode(IN1,OUTPUT)
pinMode(IN2,OUTPUT)
pinMode(IN3,OUTPUT)
pinMode(IN4,OUTPUT)
//delay(1000)
}
voidloop()
{
while(steps_left>0){
currentMillis=micros()
if(currentMillislast_time>=1000){
stepper(1)
time=time+micros()last_time
last_time=micros()
steps_left
}
}
Serial.println(time)
Serial.println("Wait...!")
delay(2000)
Direction=!Direction
steps_left=4095
}
voidstepper(intxw){
for(intx=0x<xwx++){
switch(Steps){
case0:
digitalWrite(IN1,LOW)
digitalWrite(IN2,LOW)
digitalWrite(IN3,LOW)
digitalWrite(IN4,HIGH)
break
case1:
digitalWrite(IN1,LOW)
digitalWrite(IN2,LOW)

digitalWrite(IN3,HIGH)
digitalWrite(IN4,HIGH)
break
case2:
digitalWrite(IN1,LOW)
digitalWrite(IN2,LOW)
digitalWrite(IN3,HIGH)
digitalWrite(IN4,LOW)
break
case3:
digitalWrite(IN1,LOW)
digitalWrite(IN2,HIGH)
digitalWrite(IN3,HIGH)
digitalWrite(IN4,LOW)
break
case4:
digitalWrite(IN1,LOW)
digitalWrite(IN2,HIGH)
digitalWrite(IN3,LOW)
digitalWrite(IN4,LOW)
break
case5:
digitalWrite(IN1,HIGH)
digitalWrite(IN2,HIGH)
digitalWrite(IN3,LOW)
digitalWrite(IN4,LOW)
break
case6:
digitalWrite(IN1,HIGH)
digitalWrite(IN2,LOW)
digitalWrite(IN3,LOW)
digitalWrite(IN4,LOW)
break
case7:
digitalWrite(IN1,HIGH)
digitalWrite(IN2,LOW)
digitalWrite(IN3,LOW)
digitalWrite(IN4,HIGH)
break
default:
digitalWrite(IN1,LOW)
digitalWrite(IN2,LOW)
digitalWrite(IN3,LOW)
digitalWrite(IN4,LOW)
break
}
SetDirection()
}
}
voidSetDirection(){
if(Direction==1){Steps++}
if(Direction==0){Steps}
if(Steps>7){Steps=0}
if(Steps<0){Steps=7}
}

Stepper Motor 28 BYJ48 Arduino

Wehaveabenicecommentpolicy.

Pleasebepositiveandconstructive.

wIMadeit!

AddImages

rabiuls(/member/rabiuls)

PostComment

7daysago

Reply

4daysago

Reply

Thankyouverymuch,itworks!!Butthesteppermotorgets
veryhot,Iamusing12v.Isitok?

Alderin(/member/Alderin) . rabiuls(/member/rabiuls)

Itisverycommonforsteppermotorstogethot.Many3dprinterandCNC
milldesignsincludeheatsinksandfansoneachsteppermotor,andin
robustdesignsatemperaturesensorisaddedtoeachsteppertoallowthe
controlcircuitstoshutdownbeforethemotorisdamaged.
TheULN2003isprettymuchjustanamperageamplifierthatstepsupthe
Arduino'spowersignaltobeenoughforthemotor.Specializedstepper
motordrivershavedifferentamperagesettingsfor'moving'and'holding'
states,whichcandrasticallylowerheatandpowerusage.Theyareabit
moreexpensive,though.
Withthatallsaid,thetypicaluseforthissteppermotordoesnothavea
dedicatedfan,andgenerallynotemperaturebasedshutoff.Itisprobably
notgettingtoohotforitsdesign,butifyouareconcerned,addinga40mm
fan(likethisone:http://www.digikey.com/productdetail/en/sunon
fans/HA40101V4000U999/2591616ND/3694183)wouldn'thurt.

nbc12(/member/nbc12) . rabiuls(/member/rabiuls)

6daysago

Reply

Dependsonyouramperage,thoughitisnormalforstepperstogetalittle
warm,soyou'reprobablyfine

AbuM12(/member/AbuM12)

hello

6daysago

Reply

Itsmostako,Iamverynewtosteppermotorcontrolwith
Arduino.
Ineedtorotatemysteppermotor28byj48,ULN2003driver
ICbothinforwardandinreversedirectionwhenthe
respectivepushbuttonispressed.
IhaveIhaveasteppermotor,ULN2003,arduinoandtwo
pushbutton
Pleaseprovidemeacodeforarduinosuchthaticanrotate
thestepperinbothdirectiononlywhenpushbuttonis
pressed
Myemailidismostako1@gmail.com

CaptainZ(/member/CaptainZ)

amonthago

Reply

amonthago

Reply

WillandsometimesWendyK(/member/WillandsometimesWendyK)
amonthago

Reply

2monthsago

Reply

Thanks,justwhatIneededtomakesuremyboardwas
good.Ichangedthepinstotheonesforananoandit
startedrightup.

Meterry52(/member/Meterry52)

Coolproject!Onlytookminutestogetitgoing!Thankyou!!!!

Thiswasgreat!Helpedmealotthankyoumuchly!

MarcusBlaisdell(/member/MarcusBlaisdell)madeit!

Thankyouforpostingthis.Mysteppershadthedirectionproblemsoyourfixis
greatlyappreciated.

(http://cdn.instructables.com/FUN/PU82/IKVFUWCJ/FUNPU82IKVFUWCJ.LARGE.jpg)

rizawerks(/member/rizawerks)

2monthsago

Reply

2monthsago

Reply

thanksfortutorial:)

X
8

TheElectromania(/member/TheElectromania)

Workedperfectly...canyoupleaseputcommentsonyour
sketchcode,tounderstandthelogic.
Iwouldliketocontrolspeedandrotateit360deg

JamalN1(/member/JamalN1)

Canyouplzaddcommentalsinthecodetoexplainit

3monthsago

Reply

MartynSudworth(/member/MartynSudworth)

3monthsago

Reply

Mysetupwoulddonothinguntilirealisedthepinmarked
"+"wasn'tactuallyconnectedtoanything(onthemotor
board).Wheniconnected5vtoboththetwopins
previouslyjumperedtogether(likeyourimageabove)it
burstintolife.Doihaveabadlydesignedmotorboard?

MartynSudworth(/member/MartynSudworth) . MartynSudworth
(/member/MartynSudworth)

3monthsago

Reply

onfurtherexaminationifindthis:pin1(marked"")is
ground,asitshouldbe).Pin2(marked"+")not
connected.Pin3isconnectedto"com"onulnchip,
soshouldbe5v.Pin4connectedthroughtheLEDs
tothemotoratotheulnoutputs.Iput5vonthisaIso.
Impliesyoucansplitthepowertodriveadifferent
powerstepper?Odd,whatdopeoplethink?

CalvT1(/member/CalvT1)

3monthsago

Reply

4monthsago

Reply

5monthsago

Reply

Manythanks,workswell.

aurelien.a.walker(/member/aurelien.a.walker)

Hello,
Andthanksforyourhelp.Nowiunderstand:)
Itrytodoaprogramwhocontrolmymotorwithapusher
button.
Whenipushthebutton,iwouldthatmymotordoastepof
25.
Couldyouhelpme?

MatthewW80(/member/MatthewW80)

Hi,Ihavefollowedyourinstructionsanditworkedfine.I
havebuiltonyourcodeandmakewhatIthinktobea
neaterimplementation.Hereismygithubrepowithitin,
hopesomeonefindsituseful.
https://github.com/mattcow12/BYJ48Stepper/tree/master

JonGolcha(/member/JonGolcha) . MatthewW80(/member/MatthewW80)

ThanksforsharingyourcodeMatthew,thisisindeed 5monthsago
useful:)

malijai(/member/malijai)

5monthsago

Reply

Reply

Thanksforyourcode.ImanagedtohavemyUnocontrolthesame
steppermotor,whereasIcouldnotwithotherexamples.Thecodecould
bemadesimplerthough.
Hereismyattempt,usingarrays,renamingvariablesandsimplifyingcontrol

/*
BYJ48Steppermotorcode
Connect:
IN1>>D8
IN2>>D9
IN3>>D10
IN4>>D11
VCC...5VPrefertouseexternal5VSource
Gnd
writtenBy:MohannadRawashdeh
http://www.instructables.com/member/Mohannad+Rawashdeh/
28/9/2013
*/
#defineIN18
#defineIN29
#defineIN310
#defineIN411
constintNBSTEPS=4096
constintSTEPTIME=900
intStep=0
booleanClockwise=true
intarrayDefault[4]={LOW,LOW,LOW,LOW}
intstepsMatrix[8][4]={
{LOW,LOW,LOW,HIGH},
{LOW,LOW,HIGH,HIGH},
{LOW,LOW,HIGH,LOW},
{LOW,HIGH,HIGH,LOW},
{LOW,HIGH,LOW,LOW},
{HIGH,HIGH,LOW,LOW},
{HIGH,LOW,LOW,LOW},
{HIGH,LOW,LOW,HIGH},
}
unsignedlonglastTime
unsignedlongtime
voidsetup(){
Serial.begin(9600)
Serial.println("Starting...")
pinMode(IN1,OUTPUT)
pinMode(IN2,OUTPUT)
pinMode(IN3,OUTPUT)
pinMode(IN4,OUTPUT)
}
voidloop(){
unsignedlongcurrentMicros
intstepsLeft=NBSTEPS
time=0
while(stepsLeft>0){
currentMicros=micros()
if(currentMicroslastTime>=STEPTIME){
stepper()
time+=micros()lastTime
lastTime=micros()
stepsLeft
}

}
Serial.println(time)
Serial.println("Wait...!")
delay(2000)
Clockwise=!Clockwise
stepsLeft=NBSTEPS
}
voidwriteStep(intoutArray[4]){
for(inti=0i<4i++){
digitalWrite(IN1+i,outArray[i])
}
}
voidstepper(){
if((Step>=0)&&(Step<8)){
writeStep(stepsMatrix[Step])
}else{
writeStep(arrayDefault)
}
setDirection()
}
voidsetDirection(){
(Clockwise)?(Step++):(Step)
if(Step>7){
Step=0
}elseif(Step<0){
Step=7
}
}
structures.

twolf8(/member/twolf8)madeit!

5monthsago

Reply

MadeitusingaULN2003APGICinsteadofthebreakoutboard.TheMB101
Breadboardpowersupplyfeedsthemotor.

(http://cdn.instructables.com/F1I/8CCY/IH9GVGW4/F1I8CCYIH9GVGW4.LARGE.jpg)

aaron1928(/member/aaron1928)

5monthsago

Reply

6monthsago

Reply

iconnectedtheulnboard2003toan9vbatterybutitsnot
poweringon
istheboarddead?
redwire+
blackwire

vandenbrande(/member/vandenbrande)

Mysteppermotorseemtobebroken..ordoihaveapowerproblem?Itonly
turnswhenigiveitalittlehelp...restworksfine....itonlyvibratesifidonthelpit
turnwithmyfingers..soguessitsbroken...thatsucks

GavinS11(/member/GavinS11) . vandenbrande(/member/vandenbrande)

Makesureyourpinsaremappedright.Minewasdoingthat
becauseIhadpins8&9flipped

6monthsago

vandenbrande(/member/vandenbrande) . GavinS11(/member/GavinS11)

Yesiknowiused2bluecablesandiwasntsober
lol....butthanksseemyothercommentthatileft
afterthat...itworksfine..

Reply

vandenbrande(/member/vandenbrande)

6monthsago

Reply

6monthsago

Reply

Fixedit..justbeingstoned..used2bluecableslol..and
gueswhat?iputin3onpin11
andin4onpin10...lolokthennothingbrokenhere

vandenbrande(/member/vandenbrande) . vandenbrande(/member/vandenbrande)

Andthanksman!nicetutorialmohannad

jaysonlooi(/member/jaysonlooi)

6monthsago

Reply

6monthsago

Reply

7monthsago

Reply

Helloguys,I'mnewhere.MayIknowwherecaniget
steppermotor'slibrary?TQ

AshleyO3(/member/AshleyO3)

Yourtutorialishelpingmealotinmyproject!I'mjusta
beginner,andthisisoneofmyfirstcircuitsI'mbuildingin
reallife.CanOPorsomeonetell/showmehowthis
exampleconnectstoapowersupplysinceIhavean
ardunionanoinsteadofthearduinounousedinthis
example?
Sorry,I'mreallynewandthisisallsoconfusingforme!

LaurensHuizer(/member/LaurensHuizer) . AshleyO3(/member/AshleyO3)

HiAshleyO3,
IrecommendyoutouseaPCpowersource,
especiallyisyouareusingmultiplesteppermotorsin
yoursetup.YoucanconnectthedriverboardVCCpin
toaredwireandtheGNDpintoablackwire.I've
createdaclasstocontrolyourPCpowersource:
http://www.laurenshuizer.nl/blog/arduino/power

6monthsago

Reply

sourcelibrary
(http://www.laurenshuizer.nl/blog/arduino/power
sourcelibrary).

AshleyO3(/member/AshleyO3) . LaurensHuizer(/member/LaurensHuizer)

Thankyou,butIneedawaytoattachabatterypackpower
sourcesoIcantransportmycircuitaround!Anysuggestions
forthatatall?I'musinganArduinoNano>_>

LuisF37(/member/LuisF37) . AshleyO3(/member/AshleyO3)

Ifyoulookatthepictureofthecontroller,therearetwopins,
markedand+,with512V.That'sit.

DonD10(/member/DonD10)

Reply

6monthsago

Reply

7monthsago

6monthsago

Reply

6monthsago

Reply

Iwanttomakeanarduinobasedrobotictripodhead(fora
DSLRforpanoramic&360degreephotos),butIhave
neveractuallyusedasteppermotorbefore.Ihaveone
(sameasyours)fromakit&plantoorderacouplemore
(needtouse21sideways&1up&down),butI'mnot
surethebestwaytoattach(whatever)tothe'spinnypart'
ofthemotor:)
Anythoughts/direction?I'mbrandnewtomessingwith
Arduinos(IhaveanUNOandacoupleATTINY85boards)
andsofarhaveonlylitLEDs,somaybethisistoo
ambitious...butcommercialroboticheadsarealmost
$1000&mybudgetiscloserto$20:)

binobino(/member/binobino)madeit!

Thankyouverymuchforthispricelessexample!Ihadatroubletorunmy
steppermotor28BYJ48withULN2003withstandard"stepper"libraryofthe
latestArduinoIDE:(Itmakeafewstepsandstuckwithabigcurrent...AfterI
triedyourwayandeverythingisnice!:)AfterIdecidedtolookatlogiclevelson
pinsfromIN1toIN4inbothsituations.AsIseethelibraryfunction"step"runin
1fullphase,andyourcoderunmotorin1/2phase,asyourwrote.Iattached4
screenshotsofyourcodeCCWandCWrotatingin2differenttime/divanda
screenshotofthelibraryfunction.
Myquestionis:areyouthinkthatthefirst(library)functioncorrectforthis

(http://cdn.instructables.com/FR3/JDCK/IFUEFLAP/FR3JDCKIFUEFLAP.LARGE.jpg)

(http://cdn.instructables.com/FZO/NIIK/IFUEFL9Z/FZONIIKIFUEFL9Z.LARGE.jpg)

(http://cdn.instructables.com/FYC/4Q18/IFUEFL7N/FYC4Q18IFUEFL7N.LARGE.jpg)

(http://cdn.instructables.com/F9M/5J4F/IFUEFL7K/F9M5J4FIFUEFL7K.LARGE.jpg)

(http://cdn.instructables.com/FU2/95L1/IFUEFL2D/FU295L1IFUEFL2D.LARGE.jpg)

binobino(/member/binobino) . binobino(/member/binobino)

Sorry,thescreenshotsaremisplacedwhenuploadthe
LASTscreenshotisfromalibraryfunction"step"....

Reply

6monthsago

LaurensHuizer(/member/LaurensHuizer) . binobino(/member/binobino)

Hibinobino,

Reply

6monthsago

I'vecreatedanobjectorientedlibrarytocontrolyourBYJ48
steppermotor:
https://github.com/LaurensHuizer/Arduino/tree/master/libraries/StepperMotor
(https://github.com/LaurensHuizer/Arduino/tree/master/libraries/StepperMotor)

binobino(/member/binobino) . LaurensHuizer(/member/LaurensHuizer)

Greatthanx,Laurens!

LaurensHuizer(/member/LaurensHuizer)

Ifyouwanttocontrolyousteppermotorinanobject
orientedway,youcanviewmyblogpost
http://www.laurenshuizer.nl/blog/arduino/steppermotor

Reply

6monthsago

6monthsago

Reply

library(http://www.laurenshuizer.nl/blog/arduino/stepper
motorlibrary).

binobino(/member/binobino) . LaurensHuizer(/member/LaurensHuizer)

Thankyouverymuch,Laurensforgreatexplanation,work
andlibrary!Itwasveryusefulforme!

M.razik(/member/M.razik)

Reply

6monthsago

2yearsago

Reply

thanksfortheexplaining,butihaveaproblemafterusingUr
codeandthesamepinoutthemotorismakeavibrate
sound!..anddon'tturn..!?andihaveaquestion?how
canitellthesteppermotortostartpointatadefineddegree
(0)degorstepandfromitgoto(180)deg(90)deg...etc.I
wonderifyoucanhelpme...thanksinadvance:)

LaurensHuizer(/member/LaurensHuizer) . M.razik(/member/M.razik)

Reply

6monthsago

HiM.razik,
Thisisprobablybecausethemotordoens'tgetenough
power.Irecommendyoutouseanexternalpowersupply

LuisF37(/member/LuisF37) . M.razik(/member/M.razik)

7monthsago

Reply

Forthat,youshouldcalculatethenumberofstepstoreachtheseangles,
basedonthenumberofsteps/turn.Or(whichseemsmoreelegantfor
yourcase)wouldbeusingaservomotorinstead.
http://www.instructables.com/id/ArduinoServoMotors/

X
8

MohannadRawashdeh(/member/MohannadRawashdeh)(author) . M.razik
(/member/M.razik)

2yearsago

Reply

7monthsago

Reply

8monthsago

Reply

Checkyourconnectionagain,Itestedbefore.
Yesyoucan

AhmeedS(/member/AhmeedS)

Billdwp(/member/Billdwp)madeit!

Iputthistogetherandit'sreallycoolthankyou.BeforeyourexplanationIwas
lostandalmostburnedupamotor.Isyourcodedocumentedanywhere?It
worksgreat,butit'sabidadvancedforme...SoislightingLEDs...hahahaha
Thankyouagain,Iwouldrecommedthisprojecttoeveryone.

(http://cdn.instructables.com/FH0/4Q0K/IE184JN4/FH04Q0KIE184JN4.LARGE.jpg)

AshleyO3(/member/AshleyO3) . Billdwp(/member/Billdwp)

Reply

7monthsago
Awesomesetup!I'mtryingtodosomethingsimilarformy
projecthere.Doyoumindshowingmeortellingmewhats
goingonwiththepowersupply?Like,howyouhavethe
powersupplyconnectedtothebreadboardandarduinoand
driverboard?

AshleyO3(/member/AshleyO3) . AshleyO3(/member/AshleyO3)

Oh,Ishouldaddit'sbecauseIhaveanardunionanoinstead
oftheuno!

sourcery(/member/sourcery)madeit!

Reply

7monthsago

8monthsago

Reply

Thanksforyourcode!IusedittomakeanArduinoBumperRobot!Checkitout
hereifyouwantyourown:http://www.instructables.com/id/Supersimpleand
S...(http://www.instructables.com/id/SupersimpleandSupercheapArduino
Bumperrobot/)

(http://cdn.instructables.com/F9M/FJL6/IEB8DYQB/F9MFJL6IEB8DYQB.LARGE.jpg)

JoshS38(/member/JoshS38)

Hi,Iamusingamotorfromthesamefamilyasthisone
(24BYJ48)IamusingtheAdafruitlibrarytocontrolthe
steppingmotor.
TheissueIamhavingisrunningthemotoratFullSpeed.
Hereismycode:
#include<Wire.h>
#include<Adafruit_MotorShield.h>
#include"utility/Adafruit_PWMServoDriver.h"
//CreatethemotorshieldobjectwiththedefaultI2C
address
Adafruit_MotorShieldAFMS=Adafruit_MotorShield()
//Or,createitwithadifferentI2Caddress(sayfor
stacking)

8monthsago

Reply

//Adafruit_MotorShieldAFMS=
Adafruit_MotorShield(0x61)
//Connectasteppermotorwith200stepsperrevolution
(1.8degree)
//tomotorport#2(M3andM4)
Adafruit_StepperMotor*myMotor=AFMS.getStepper(200,
2)
voidsetup(){
Serial.begin(9600)//setupSeriallibraryat9600bps
Serial.println("Steppertest!")
AFMS.begin()//createwiththedefaultfrequency1.6KHz
//AFMS.begin(1000)//ORwithadifferentfrequency,say
1KHz
myMotor>setSpeed(100)//10rpm
}
voidloop(){
Serial.println("Microstepsteps")
myMotor>step(50,FORWARD,MICROSTEP)
}
Iamverynewtoarduinosowouldappreciatethehelp:)

Domonsura(/member/Domonsura)madeit!

8monthsago

Reply

Ijustputthistogetherona'Moteino'smallwirelessarduinoclone.Itworks
perfectlywithnoalterationstothecodeatall.Iammakinganautomatic
chickencoopdoor,andwillmonitorafewthings(temp,humidity,water&food
consumption)toprovidedatabacktoabaseRaspberryPi.Thiswill(Ihope)
open&closethedoormechanism,butevenifthemotorprovesnotstrong
enoughithastaughtmewhatIneedtoknow,thanks!

(http://cdn.instructables.com/FDV/SAEC/IE4ZU9FU/FDVSAECIE4ZU9FU.LARGE.jpg)

humphrey.lees(/member/humphrey.lees)

8monthsago

Reply

ayearago

Reply

IhavethemotorworkingasIwrite.Ithinkitcanbeused
formycoilwinderthatisusingadcmotorandencoder.
HowcanIstopthepauseandcontrolthespeedand
duration?

urkraft(/member/urkraft)

Thankyoufortheinformation,butibelievethatthecodewas
overlycomplicated.Isimplifieditdramaticallyandmycode
workedgreataswellasbeingmuchsimpliertounderstand.
Hereismysuggestion:

constcharposArray[9]={0x08,0x0C,0x04,0x06,0x02,
0x03,0x01,0x09}
voidsetup(){
//putyoursetupcodehere,torunonce:
DDRB=0xFF
}
voidloop(){
//putyourmaincodehere,torunrepeatedly:
intpos
intskritt
for(pos=0pos<512pos++){
for(skritt=0skritt<8skritt++){
PORTB=posArray[skritt]
delay(1)
}
}
delay(1000)
for(pos=512pos>0pos){
for(skritt=7skritt>1skritt){
PORTB=posArray[skritt]
delay(1)
}
}
delay(1000)
}

I MoreComments

FEATURED CHANNELS

HomeRepair
(/tag/type
id/category

Knitting
Survival
(/tag/type

workshop/channel id/category
home
outside/channel
improvement/)

Newsletter
survival/)

Breakfast
(/tag/type

Minecraft
(/tag/type

(/tag/type
id/category

id/category
food/channel

id/category
play/channel

craft/channel
knittingand

breakfast/)

minecraft/)

crocheting/)

USB
(/tag/type

id/category
id/category
WinterDrinks
technology/channel
costumes/channel (/id/Holiday

usb/)

Join2million+toreceiveinstant
inspirationinyourinbox.
enteremail

Comics
(/tag/type

I'min!

Mobile
Downloadourapps!
Android(https://play.google.com/store/apps/details?id=com.adsk.instructables)
iOS(https://itunes.apple.com/app/instructables/id586765571)
Windows(http://apps.microsoft.com/windows/enus/app/7afc8194c771441a959054250d6a8300)

comics/)

Drinks/)

Weddings
(/howto/weddings/)

AboutUs

FindUs

WhoWeAre(/about/)

Facebook(http://www.facebook.com/instructables)

Advertise(/advertise/)

Youtube(http://www.youtube.com/user/instructablestv)

Contact(/about/contact.jsp)

Twitter(http://www.twitter.com/instructables)

Jobs(/community/PositionsavailableatInstructables/)
Help(/id/howtowriteagreatinstructable/)

Pinterest(http://www.pinterest.com/instructables)
Google+(https://plus.google.com/+instructables)
Tumblr(http://instructables.tumblr.com)

Resources
ForTeachers(/teachers/)
ArtistsinResidence(/air)
GiftProAccount(/account/give?sourcea=footer)
Forums(/community/)
Answers(/tag/typequestion/?sort=RECENT)
Sitemap(/sitemap/)

TermsofService(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21959721) |
PrivacyStatement(http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=21292079) |
LegalNotices&Trademarks(http://usa.autodesk.com/legalnoticestrademarks/) | MobileSite(http://m.instructables.com)
(http://usa.autodesk.com/adsk/servlet/pc/index?id=20781545&siteID=123112)
2016Autodesk,Inc.

You might also like