Home
Adafruit Motor Shield V2 for Arduino
Contents
1. Plug in the USB cable Then connect the motor supply to the power terminal block on the shield Do not place the jumper on the shield This is a suggested method of powering your motor project as it has a split supply one power Supply for logic and one supply for motors If you would like to have 2 seperate DC power supplies for the Arduino and motors Plug in the supply for the Arduino into the DC jack and connect the motor supply to the power terminal block Make sure the jumper is removed from the motor shield Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 23 of 37 No matter what if you want to use the DC motor Stepper system the motor shield LED should be lit indicating good motor power Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 24 of 37 s adafruit learning system Using RC Servos d Digital 1 7 PUY J EJ gt i An ie a On SCL ARet 13 12 11 10 9 8 oe dh A AAA A 4 lt TR mal Servo pins S1 52 ia A AA 900000Q0GC okoko Ay m etetetetetet tT A te Ne EN er hf hf Af i Y i FalaVaVs Adafruit Motor Shield v2 8 3 M F gt A 2 M2 GNO Mi vaan TH ren HENN A g eg Hiliiiiiii A gt kas Hobby servos are the easiest way to get going with motor control They have a 3 pin 0 1 female header connection with 5V ground and signal
2. 4 DC motors bi directionally That means they can be driven forwards and backwards The speed can also be varied at 0 5 increments using the high quality built in PWM This means the speed is very smooth and won t vary Note that the H bridge chip is not meant for driving continuous loads over 1 2A or motors that peak over 3A so this is for small motors Check the datasheet for information about the motor to verify its OK Connecting DC Motors To connect a motor simply solder two wires to the terminals and then connect them to either the M1 M2 M3 or M4 Then follow these steps in your sketch Include the required libraries Make sure you include the required libraries include lt Wire h gt include lt Adafruit MotorShield h gt include utility Adafruit PWMServoDriver h Create the Adafruit MotorShield object Adafruit_MotorShield AFMS Adafruit MotorShield Create the DC motor object Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 26 of 37 Request the Stepper motor from the Adafruit MotorShield Adafruit DCMotor myMotor AFMS getMotor 1 with getMotor port Port is which port it is connected to If you re using M1 its 1 M2 use 2 M3 use 3 and M4 use 4 Connect to the Controller In your setup function call begin on the Adafruit MotorShield object AFMS begin Set default speed Set the speed of the motor using setSpeed speed where the speed ranges fr
3. com adafruit motor shield v2 for arduino Page 12 of 37 That s it Now you can install the terminal blocks and jumper o gt BE oe 5 ge E w D w E 5 t x pay lende ie oe KU aac tn 7 Sie ner oe E ts S y foe sss y ocd s Ss fo ol LILLE 2099 14 rev moror jo 0 55 TAN RS e2 Di tis Installing Terminal Blocks and more After you have installed either normal or stacking headers you must install the terminal blocks Next we will install the terminal blocks These are how we will connect power and motors to the shield They re much easier to use than soldering direct just use a small screwdriver to release attach wires First though we must solder them in Slide the 3 pin terminal blocks into 2 pin terminal blocks so that you have 2 x 5 pin and 1 x 2 pin blocks The two 5 pin sets go on either side The 2 pin piece goes near the bottom of the shield Make sure that the open holes of the terminal blocks face out Flip the board over so that you can see amp solder the pins of the terminal blocks oo t bbbb 66666666 AN 7 oa Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 13 of 37 Solder in the two pins of the external power terminal block Solder in both motor blocks 5 pads each That s it for the terminal blocks Next up servo connections Hg UK ceed 90 Adafruit Industries http learn adafruit com adafruit mo
4. used to specify something other than the default maximum 1 6KHz PWM frequency Adafruit_DCMotor getMotor uint8 t n This function returns one of 4 pre defined DC motor objects controlled by the shield The parameter specifies the associated motor channel 1 4 Adafruit StepperMotor getStepper uint16 t steps uint8 tn This function returns one of 2 pre defined stepper motor objects controlled by the shield The first parameter specifies the number of steps per revolution Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 34 of 37 The second parameter specifies the associated stepper channel 1 2 void setPWM uint8 t pin uint16 t val void setPin uint8 t pin boolean val These are low level functions to control pins on the on board PWM driver chip These functions are intended for internal use only class Adafruit_DCMotor The Adafruit DCMotor class represents a DC motor attached to the shield You must declare an Adafruit DCMotor for each motor in your system Adafruit DCMotor void The constructor takes no arguments The motor object is typically initialized by assigning a motor object retrieved from the shield class as below Create the motor shield object with the default I2C address Adafruit_MotorShield AFMS Adafruit_MotorShield Select which port M1 M2 M3 or M4 In this case M1 Adafruit DCMotor myMotor AFMS getMotor 1 You can also mak
5. you visualize the movement if you have trouble seeing the movement Stepper Motor Test You can also test a stepper motor connection with the shield The shield can run unipolar 5 wire and 6 wire and bipolar 4 wire steppers It cannot run steppers with any other of wires The code is the same for unipolar or bipolar motors the wiring is just slightly different Plug the shield into the Arduino and connect a stepper motor to motor port 2 unlike DC motors the wire order does matter Connect to the top two terminal ports coil 1 and the bottom two terminal ports coil 2 e If you have a bipolar motor do not connect to the middle pin GND e If you are using a unipolar motor with 5 wires connect the common wire to GND e If you are using a unipolar motor with 6 wires you can connect the two center coil wires together to GND gt i g an Ta OE Nee Hoc 50 ole OX i AORA i 90000 S000oooooooc You must also supply 5 12VDC to power the motor There are two ways to do this 1 You can power the Arduino via the DC Barrel Jack and insert the VIN Jumper shown as the tall black handle right next to the green Power LED below 2 Youcan power the Arduino via the DC Barrel jack or USB port Then Power the shield via the 5 12VDC motor power terminal port the double terminal block next to the green Power LED and remove the VIN jumper If the Green LED isn t lit up brightless do not continue you must power it via the VIN
6. It is tested to work with Duemilanove Diecimila Uno all revisions Leonardo and Mega ADK R3 and higher lt br lt brelt can work with Mega R2 and lower if you solder a jumper wire from the shield s SDA pin to Digital 20 and the SCL pin to Digital 21 lt br gt lt br gt lt is not tested working with the Due at this time the Wire library is still under construction lt br gt get the following error trying to run the example code error Adafruit_MotorShield h No such file or directory Make sure you have installed the Adafruit_MotorShield library lt span gt Make sure you have installed the Adafruit_MotorShield library lt span gt lt br gt How do install the library Check the tutorial page on the subject here http learn adafruit com adafruit motor shield v2 for arduino install software http adafru it ciO Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 6 of 37 Check the tutorial page on the subject here lt a title Link http learn adafruit com adafruit motor shield v2 for arduino install software href http learn adafruit com adafruit motor Shield v2 for arduino install software gt http learn adafruit com adafruit motor shield v2 for arduino install software lt a gt lt span class pdf short link gt http adafru it ciO lt span gt lt br gt lt br gt HELP My motor doesnt work HELP My motor doesnt work But the servos work FINE Is the power LED lit
7. KWARD and the step type is SINGLE DOUBLE INTERLEAVE or MICROSTEP e Single means single coil activation e Double means 2 coils are activated at once for higher torque e Interleave means that it alternates between single and double to get twice the resolution but of course its half the speed e Microstepping is a method where the coils are PWM d to create smooth motion between steps Theres tons of information about the pros and cons of these different stepping methods in the resources page You can use whichever stepping method you want changing it on the fly to as you may want minimum power more torque or more precision By default the motor will hold the position after its done stepping If you want to release all the coils so that it can spin freely call release The stepping commands are blocking and will return once the steps have finished Because the stepping commands block you have to instruct the Stepper motors each time you want them to move If you want to have more of a background task stepper control check out AccelStepper library http adafru it aOL install similarly to how you did with Adafruit MotorShield which has some examples for controlling three steppers simultaneously with varying acceleration Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 29 of 37 s adafruit learning system Stacking Shields One of the cool things ab
8. The Stepper and DC motor connections will not work if the onboard green Power LED is not lit brightly You must connect 5 12VDC power to the shield through the POWER terminal blocks or through the DC barrel jack on the Arduino and VIN jumper Is the power LED lit The Stepper and DC motor connections will not work if the onboard green Power LED is not lit brightly lt span gt lt p gt You must connect 5 12VDC power to the Shield through the POWER terminal blocks or through the DC barrel jack on the Arduino and VIN jumper lt br gt lt p gt lt span gt lt br gt What is the green Power LED for The LED indicates the DC Stepper motor power supply is working If it is not lit brightly then the DC Stepper motors will not run The servo ports are 5V powered and does not use the DC motor supply The LED indicates the lt b DC Stepper motor power supply is working lt b gt If it is not lit brightly then the DC Stepper motors will not run The servo ports are 5V powered and does not use the DC motor supply lt br gt What pins are are not used on the motor shield The shield uses the SDA and SCL i2c pins to control DC and stepper motors On the Arduino UNO these are also known as A4 and A5 On the Mega these are also known as Digital 20 and 21 On the Leonardo these are also Known as digital 2 and 3 Do not use those pins on those Arduinos with this shield with anything other than an i2c sensor driver Since the shield uses I2C to communicate
9. cross the motor so you get more torque out of your batteries and there are built in flyback diodes as well Instead of using a latch and the Arduino s PWM pins we have a fully dedicated PWM driver chip onboard This chip handles all the motor and speed controls over I2C Only two pins SDA amp SCL are required to drive the multiple motors and since it s I2C you can also connect any other I2C devices or shields to the same pins This also makes it drop in compatible with any Arduino such as the Uno Leonardo and Mega R3 Due s Wire support is still in beta but once that works well we can test it on the Due Completely stackable design 5 address select pins means up to 32 stackable shields that s 64 steppers or 128 DC motors What on earth could you do with that many steppers have no idea but if you come up with something send us a photo because that would be a pretty glorious project Lots of other little improvements such as a polarity protection FET onthe power pins and a bit prototyping area And the shield is assembled and tested here at Adafruit so all you have to do is solder on straight or stacking headers and the terminal blocks Lets check out these specs again Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 4 of 37 e 2 connections for 5V hobby servos connected to the Arduino s high resolution dedicated timer no jitter e 4H Bridges TB6612 chipset provides 1 2A per brid
10. ctional Connect to the top two terminal ports do not connect to the middle pin GND See the photo below for the red and blue wire example Be sure to screw down the terminal blocks to make a good connection Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 18 of 37 2AUUO mre leleleleleleleslelelelelelelelelelels p 2 Adafruit Motor Shield v2 8 2 steppers or eg 4 DC motors You must also supply 5 12VDC to power the motor There are two ways to do this 1 You can power the Arduino via the DC Barrel Jack and insert the VIN Jumper shown as the tall black handle right next to the green Power LED below 2 Youcan power the Arduino via the DC Barrel jack or USB port Then Power the shield via the 5 12VDC motor power terminal port the double terminal block next to the green Power LED and remove the VIN jumper If the Green LED isn t lit up brightless do not continue you must power it via the VIN jumper or the terminal block Once you have verified the motor is connected properly and you have the power LED lit up brightly we can upload our code In the IDE load File gt Examples gt Adafruit_MotorShield gt DCMotorTest Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 19 of 37 You should see and hear the DC motor turn on and move back and forth attaching a slip of paper or tape as a flag can help
11. d AFMS Adafruit MotorShield Connect a stepper motor with 200 steps per revolution 1 8 degree to motor port 2 M3 and M4 Adafruit_StepperMotor my Motor AFMS getStepper 200 2 Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 36 of 37 void step uint16 t steps uint8 t dir uint8 t style SINGLE The step function controls stepper motion e The first parameter specifies how many steps to move e The second parameter specifies the direction FORWARD or BACKWARD e The last parameter specifies the stepping style SINGLE DOUBLE INTERLEAVED or MICROSTEP The ste function is synchronous and does not return until all steps are complete When complete the motor remains powered to apply holding torque to maintain position void setSpeed uint16 t The setSpeed function controls the speed of the stepper motor rotation Speed is specified in RPM uint8 t onestep uints t dir uint8 t style The oneStep function is a low level internal function called by step But it can be useful to call on its own to implement more advanced functions such as acceleration or coordinating Simultaneous movement of multiple stepper motors The direction and style parameters are the same as for step but onestep steps exactly once Note Calling step with a step count of 1 is not the same as calling onestep The step function has a delay based on the speed set in setSpeed ones
12. dded to the base I2C address To program the address offset use a drop of solder to bridge the corresponding address Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 30 of 37 jumper for each binary 1 in the address The right most jumper is address bit 0 then to the left of that is address bit 1 etc up to address bit 5 PAPAPAPLOLOLOLOLOLOLOLOLOLOLOLOLOlS _ Adafruit Motor Shield v2 0 2 steppe 4 DC mo Be CSA rs ren Dd staan ge peeeeeeeeeee fall ae Dan Sn 7 Ba gt Ba D B ame dd b En hl A ie kkk ka hehehehe ds mn a runo f logic 3v IEM olg Board 0 Address 0x60 Offset binary 0000 no jumpers required Board 1 Address 0x61 Offset binary 0001 bridge AO as in the photo above Board 2 Address 0x62 Offset binary 0010 bridge A1 to the left of AQ Board 3 Address 0x63 Offset binary 0011 bridge AO amp A1 two rightmost jumpers Board 4 Address 0x64 Offset binary 0100 bridge A2 middle jumper etc Writing Code for Multiple Shields The Adafruit MotorShield library has the ability to control multiple shields unlike the older AF Motor library First we must create a Motor Shield Controller for each shield with the assigned address Adafruit MotorShield AFMSbot 0x61 Rightmost jumper closed Adafruit MotorShield AFMStop 0x60 Default address no jumpers One motor shield is goin
13. e another motor on port M2 Adafruit DCMotor myOtherMotor AFMS getMotor 2 void run uints t 4 The run function controls the motor state The parameter can have one of 3 values e FORWARD Rotate in a forward direction Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 35 of 37 e REVERSE Rotate in the reverse direction e RELEASE Stop rotation Note that the FORWARD and REVERSE directions are arbitrary If they do not match the actual direction of your vehicle or robot simple swap the motor leads Also note that RELEASE simply cuts power to the motor It does not apply any braking void setSpeed uint8 t The setSpeed function controls the power level delivered to the motor The speed parameter is a value between 0 and 255 Note that setSpeed just controls the power delivered to the motor The actual speed of the motor will depend on several factors including The motor the power supply and the load e class Adafruit StepperMotor The Adafruit StepperMotor class represents a stepper motor attached to the shield You must declare an Adafruit StepperMotor for each stepper motor in your system Adafruit StepperMotor void The constructor takes no arguments The stepper motor is typically initialized by assigning a stepper object retrieved from the shield as below Create the motor shield object with the default I2C address E Adafruit_MotorShiel
14. ect to one motor port say M1 or M3 and coil 2 should connect to the other motor port M2 or M4 For bipolar motors its just like unipolar motors except theres no 5th wire to connect to ground The code is exactly the same Running a stepper is a little more intricate than running a DC motor but its still very easy Include the required libraries Make sure you include the required libraries include lt Wire h gt include lt Adafruit MotorShield h gt include utility Adafruit_ PWMServoDriver h Create the Adafruit MotorShield object Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 28 of 37 Adafruit MotorShield AFMS Adafruit MotorShield Create the stepper motor object Request the Stepper motor from the Adafruit MotorShield Adafruit StepperMotor myMotor AFMS getStepper 200 2 with getStepper steps stepper Steps indicates how many steps per revolution the motor has A 7 5degree step motor has 360 7 5 48 steps Stepper is which port it is connected to If you re using M1 and M2 its port 1 If you re using M3 and M4 indicate port 2 Set default speed Set the speed of the motor using setSpeed rpm where rpm is how many revolutions per minute you want the stepper to turn Run the motor Then every time you want the motor to move call the step steps direction steptype procedure steps is how many steps you d like it to take direction is either FORWARD or BAC
15. g to be called AFMSbot bottom shield so we remember and one is AFMStop top shield so we can keep them apart When you create the shield object specify the address you set for it above Then we can request the motors connected to each one On the top shield connect two steppers each with 200 steps Adafruit StepperMotor myStepper2 AFMStop getStepper 200 1 Adafruit StepperMotor myStepper3 AFMStop getStepper 200 2 On the bottom shield connect a stepper to port M3 M4 with 200 steps Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 31 of 37 Adafruit StepperMotor myStepperl AFMSbot getStepper 200 2 And a DC Motor to port M1 Adafruit DCMotor myMotorl AFMSbot getMotor 1 You can request a stepper or DC motor from any port just be sure to use the right AFMS controller object when you call getMotor or getStepper Then both shields must have begin called before you use the motors connected AFMSbot begin Start the bottom shield AFMStop begin Start the top shield You can try out this code for yourself by setting up two shields and running the File gt Examples gt Adafruit_MotorShield gt StackingTest example Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 32 of 37 Ye adafruit learning system Resources Motor ideas and tutorials e Wikipedia has tons of information http adafru it aOF on steppers e J
16. g to figure out is how much current your motor will need The motor driver chips that come with the kit are designed to provide up to 1 2 A per motor with 3A peak current Note that once you head towards 2A you ll probably want to put a heat sink on the motor driver otherwise you will get thermal failure possibly burning out the chip You can t run motors off of a 9V battery so don t waste your time batteries Use a big Lead Acid or NiMH battery pack Its also very much suggested that you set up two power supplies split supply one for the Arduino and one for the motors 99 of weird motor problems are due to noise onthe power line from sharing power supplies and or not having a powerful enough supply Even small DC motors can draw up to 3 Amps when they Stall Setting up your shield for powering Hobby Servos Servos are powered off of the same regulated 5V that the Arduino uses This is OK for the small hobby servos suggested Basically power up your Arduino with the USB port or DC barrel jack and you re good to go If you want something beefier cut the trace going to the optional servo power terminal and wire up your own 5 6V supply Setting up your shield for powering DC Motors The DC motors are powered off of a high voltage supply and NOT the regulated 5V Don t connect the motor power supply to the Arduino s 5V power pin This is a very very very bad idea unless you are sure you know what you re doing You could damage your Ardu
17. ge 3A peak with thermal shutdown protection internal kickback protection diodes Can run motors on 4 5VDC to 13 5VDC e Up to 4 bi directional DC motors with individual 8 bit speed selection so about 0 5 resolution e Up to 2 stepper motors unipolar or bipolar with single coil double coil interleaved or micro stepping e Motors automatically disabled on power up e Big terminal block connectors to easily hook up wires 18 26AWG and power e Arduino reset button brought up top e Polarity protected 2 pin terminal block and jumper to connect external power for separate logic motor supplies e Tested compatible with Arduino UNO Leonardo ADK Mega R3 Diecimila amp Duemilanove Works with Mega ADK R2 and earlier with 2 wire jumpers e Download the easy to use Arduino software library check out the examples and you re ready to go Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 5 of 37 Dd adafruit learning system FAO How many motors can l use with this shield You can use 2 DC hobby servos that run on 5V and up to 4 DC motors or 2 stepper motors or 1 stepper and up to 2 DC motors that run on 5 12VDC lt div gt lt span gt You can use 2 DC hobby servos that run on 5V and up to 4 DC motors or 2 stepper motors or 1 stepper and up to 2 DC motors lt span that run on 5 12VDC lt br gt lt div gt Can I connect more motors Yes by stacking shields Every shield you stack on wi
18. gt rel ANIEPE Dg Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 17 of 37 ve adafruit learning system Install Software To use the shield on an Arduino you ll need to install the Adafruit Motorshield v2 library This library is not compatible with the older AF Motor library used for v1 shields However if you have code for the older shield adapting the code to use the new shield isn t difficult We had to change the interface a little to support shield stacking amp we think its worth it Start by downloading the zip of the library from the Github repository http adafru it ciN You can also just click the button below Download latest Adafruit Motor Shield V2 Library http adafru it cBx Copy the folder inside the zip file to the Libraries folder inside your Arduino Sketchbook folder and re name it to Adafruit_Motorshield For more details on how to install Arduino libraries check out our detailed tutorial http adafru it aY M Running the Example Code DC Motor The library comes with a few examples to get you started up fast We suggest getting started with the DC motor example You can use any DC motor that can be powered by 6V 12VDC First restart the IDE to make sure the new library is loaded Plug the shield into the Arduino and connect a DC motor to motor port 1 it does not matter which wire goes into which terminal block as motors are bi dire
19. ino and or USB port There are two places you can get your motor high voltage supply from 1 One is the DC barrel jack on the Arduino board 2 The other is the 2 terminal block on the shield that is labeled DC Motor Power 5 Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 22 of 37 12VDC The DC Jack on the Arduino has a protection diode so you won t be able to mess things up too bad if you plug in the wrong kind of power The terminal block as a protection FET so you will not damage the arduino shield if you wire up your battery supply backwards but it wont work either Here s how it works ARDUINO BOARD gy Motor logic supply Servo power supply Arduino power supply Motor power high voltage supply MOTOR SHIELD If you would like to have a single DC power supply for the Arduino and motors Say a wall adapter or a single battery pack with 6 12VDC output simply plug it into the DC jack onthe Arduino or the 2 pin power terminal block on the shield Place the power jumper on the motor shield Note that you may have problems with Arduino resets if the battery supply is not able to provide constant power so it is not a suggested way of powering your motor project You cannot use a 9V battery for this it must be 4 to 8 AA batteries ora single double lead acid battery pack If you would like to have the Arduino powered off of USB and the motors powered off of a DC power supply
20. inputs The motor shield simply brings out the 16bit PWM output lines to two 3 pin headers so that its easy to plug in and go They can take a lot of power so a 9V battery wont last more than a few minutes The nice thing about using the onboard PWM is that its very precise and goes about its business in the background You can use the built in Servo library Using the servos is easy please read the official Arduino documentation for how to use them and see the example Servo sketches in the IDE http adafru it aOD Powering Servos Power for the Servos comes from the Arduino s on board 5V regulator powered directly from the USB or DC power jack on the Arduino If you need an external supply cut the trace on the bottom of the board and connect a 5V or 6V DC supply directly to the Opt Servo power input Using an external supply is for advanced users as you can accidentally destroy the servos by connecting a power supply incorrectly Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 25 of 37 s gt adafruit learning system Using DC Motors ha 0 O00 29 JO 15 waa ee 3000 ele Oo 50 SOC us he O 6000 elelelelele 0000 ele oa slelels 3000000000000000lnk MAI wa Nololololololololelelelelolelelelelols lt 4 leleleleleleolelelelelelelelelelelelelon 0o00 x Adafruit Motor Shield v2 8 2 steppers or an DC motors are used for all Sort of robotic projects The motor shield can drive up to
21. jumper or the terminal block Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 20 of 37 elelejlejlele PeTololoTeletefetetete ROAN T Po Teale ew es o glossen QIC 5 12VU Motor Power mH oo a RST Once you have verified the motor is connected properly and you have the power LED lit up brightly we can upload our code In the IDE load File gt Examples gt Adafruit MotorShield gt StepperTest You should see and hear the stepper motor turn on and move back and forth attaching a slip of paper or tape as a flag can help you visualize the movement if you have trouble seeing the movement There are four ways to move a stepper with varying speed torque and smoothness tradeoffs This example code will demonstrate all four Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 21 of 37 Dd adafruit learning system Powering Motors Motors need a lot of energy especially cheap motors since they re less efficient Voltage requirements The first important thing to figure out what voltage the motor is going to use If you re lucky your motor came with some sort of specifications Some small hobby motors are only intended to run at 1 5V but its just as common to have 6 12V motors The motor controllers on this Shield are designed to run from 5V to 12V MOST 1 5 3V MOTORS WILL NOT WORK Current requirements The second thin
22. ll add 4 DC motors or 2 stepper motors or 1 more stepper and 2 more DC motors You will not gain more servo connections as the servo contacts go to pin 9 and 10 on the Arduino Yes by stacking shields Every shield you stack on will add lt b gt lt b gt 4 DC motors or 2 stepper motors or 1 more stepper and 2 more DC motors lt br gt You will not gain more servo connections as the servo contacts go to pin 9 and 10 on the Arduino lt br gt What if lalso need some more servos Check out our lovely servo shield also stackable with this motor shield and adds 16 free running servos per shield http learn adafruit com adafruit 16 channel pwm slash servo Shield http adafru it ciQ Check out our lovely servo shield also stackable with this motor shield and adds 16 free running servos per shield lt a href http learn adafruit com adafruit 16 channel pwm Slash servo shield gt http learn adafruit com adafruit 16 channel pwm slash servo shield lt a gt lt span class pdf short link gt http adafru it ciQ lt span gt lt br gt lt br gt What Arduinos is this shield compatible with It is tested to work with Duemilanove Diecimila Uno all revisions Leonardo and Mega ADK R3 and higher It can work with Mega R2 and lower if you solder a jumper wire from the shield s SDA pin to Digital 20 and the SCL pin to Digital 21 It is not tested working with the Due at this time the Wire library is still under construction
23. motor itself this will reduce noise that could be feeding back into the circuit thanks macegr http adafru it clc Try soldering a ceramic or disc 0 1uF capacitor between the motor tabs on the motor itself this will reduce noise that could be feeding back into the circuit thanks lt a href http forums adafruit com viewtopic php f 31 amp amp t 10290 gt macegr lt a gt lt span class pdf short link gt http adafru it clc lt span gt lt br gt I m using a 4WD robot platform and can t get anything to work The motors used in the 4WD robot platforms from some distributors have a lot of brush noise This feeds back into the Arduino circuitry and causes unstable operation This problem can be solved by soldering 3 noise suppression capacitors to the motor 1 between the motor terminals and one from each terminal to the motor casing The motors used in the 4WD robot platforms from some distributors have a lot of brush noise This feeds back into the Arduino circuitry and causes unstable operation This problem can be solved by soldering 3 noise suppression capacitors to the motor 1 between the motor terminals and one from each terminal to the motor casing lt br gt Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 8 of 37 But my motor already has a capacitor on it and it still doesn t work These motors generate a lot of brush noise and usually need the full 3 capacitor treatme
24. nt for adequate suppression These motors generate a lot of brush noise and usually need the full 3 capacitor treatment for adequate suppression lt br gt Why don t you just design capacitors into the shield They would not be effective there The noise must be suppressed at the source or the motor leads will act like antennae and broadcast it to the rest of the system They would not be effective there The noise must be suppressed at the source or the motor leads will act like antennae and broadcast it to the rest of the system lt br gt Why won t my stepper motor go any faster Since the shield is controlled by i2c the maximum step rate is limited by the i2c bus speed The default bus speed is 100KHz and can be increased to 400KHz by editing the library file in your Arduino installation folder The file can be found in hardware libraries wire utility twi h Find the line with define TWI FREQ 100000L and change it to define TWI FREQ 400000L Since the shield is controlled by i2c the maximum step rate is limited by the i2c bus speed The default bus speed is 100KHz and can be increased to 400KHz by editing the library file in your Arduino installation folder The file can be found in lt b gt lt i gt hardware libraries wire utility twi hA lt i gt lt b gt lt br gt lt br gt Find the line with lt span gt define TWI FREQ 100000L lt br gt lt span gt and change it to define TWI FREQ 400000L Adafruit Industries ht
25. o Page 7 of 37 Motors take a lot of power and can cause brownouts that reset the Arduino For that reason the shield is designed for seperate split supplies one forthe electronics and one for the motor Doing this will prevent brownouts Please read the user manual for information about appropriate power supplies Motors take a lot of power and can cause brownouts that reset the Arduino For that reason the shield is designed for seperate split supplies one forthe electronics and one for the motor Doing this will prevent brownouts Please read the user manual for information about appropriate power supplies lt br gt I m trying to build this robot and it doesn t seem to run ona 9V battery You cannot power motors from a 9V battery You must use AA batteries ora lead acid battery for motors You lt b gt cannot lt b gt power motors from a 9V battery You must use AA batteries or a lead acid battery for motors lt br gt Can this shield control small 3V motors Not really its meant for larger 5V motors It does not work for 3V motors unless you overdrive them at 5V and then they will burn out faster Not really its meant for larger 5V motors It does not work for 3V motors unless you overdrive them at 5V and then they will burn out faster lt br gt have good solid power supplies but the DC motors seem to cut out or skip Try soldering a ceramic or disc 0 1uF capacitor between the motor tabs on the
26. om 0 stopped to 255 full speed You can set the speed whenever you want myMotor gt setSpeed 100 Run the motor To run the motor call run direction where direction is FORWARD BACKWARD or RELEASE Of course the Arduino doesn t actually know if the motor is forward or backward so if you want to change which way it thinks is forward simply swap the two wires from the motor to the shield myMotor gt run FORWARD Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 27 of 37 Ye adafruit learning system Using Stepper Motors Melee ele R Meislelelelelelelelele J elele elelelele w 0000000000 elelelelelelelelelelelelele Oo E O00000 felelelelelelelelelele 000 0000000000 OO Ar ield v2 8 2 steppers or D motor g Stepper motors are great for semi precise control perfect for many robot and CNC projects This motor shield supports up to 2 stepper motors The library works identically for bi polar and uni polar motors For unipolar motors to connect up the stepper first figure out which pins connected to which coil and which pins are the center taps If its a 5 wire motor then there will be 1 that is the center tap for both coils Theres plenty of tutorials online on how to reverse engineer the coils pinout http adafru it a0O The center taps should both be connected together to the GND terminal on the motor shield output block then coil 1 should conn
27. ones on stepper motor types http adafru it aOH e Jason on reverse engineering the stepper wire pinouts http adafru it aOl Schematic click to embiggen Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 33 of 37 De adafruit learning system Library Reference Digital 170 VE 170 R T 5 D 13 1211 HoBossasss 66000060 NR Mot Servo pins ATTN EADS SD eg bai 229990000000000000 elelelelelelelelelelelelelelelelelele Bille le a Adafruit Mot or Shield v2 0 Ye steppers or OO 1 2A per motorOQO j 3A max f eT Lh Ea i Se a gt min gt nte het pte s oe m min ny Fiii i gt i ay EET EEEEEETEET nC Asserting 13 GND an lt I class Adafruit MotorShield The Adafruit MotorShield class represents a motor shield and must be instantiated before any DCMotors or StepperMotors can be used You will need to declare one Adafruit MotorShield for each shield in your system Adafruit MotorShield uint8 t addr 0x60 The constructor takes one optional parameter to specify the i2c address of the shield The default address of the constructor 0x60 matches the default address of the boards as shipped If you have more than one shield in your system each shield must have a unique address void begin uint16 t freq 1600 begin must be called in setup to initialize the shield An optional frequency parameter can be
28. out this shield design is that it is possible to stack shields Every Shield you stack can control another 2 steppers or 4 DC motors or a mix of the two You can stack up to 32 shields for a total of 64 steppers or 128 DC motors Most people will probably just stack two or maybe three but hey you never know PS if you drive 64 steppers from one of these shields send us a photo OK Note that stacking shields does not increase the servo connections those are hard wired to the Arduino digital 9 amp 10 pins If you need to control a lot of Servos you can use our 16 channel servo shield and stack it with this shield to add a crazy large of servos http adafru it 1411 Stacking shields is very easy Each shield you want to stack on top of must have stacking headers installed Check our instructions for how to do so http adafru it ciP The top shield does not have to have stacking headers unless you eventually want to put something on top of it The only thing to watch for when stacking shields is every shield must have a unique I2C address The default address is 0x60 You can adjust the address of the shields to range from Ox60 to 0x80 for a total of 32 unique addresses Addressing the Shields Each board in the chain must be assigned a unique address This is done with the address jumpers on the lower edge of the board The I2C base address for each board is 0x60 The binary address that you program with the address jumpers is a
29. sources Motor ideas and tutorials Library Reference class Adafruit MotorShield Adafruit_ MotorShield uint8 t addr 0x60 void begin uint16_t freq 1600 Adafruit_DCMotor getMotor uint8_ tn Adafruit StepperMotor getStepper uint16_t steps uint8 tn void setPWM uint8_t pin uint16_t val void setPin uint8_t pin boolean val class Adafruit DCMotor Adafruit_ DCMotor void void run uint8_t void setSpeed uint8_ t class Adafruit StepperMotor Adafruit StepperMotor void void step uint16_t steps uint8_tdir uint8 tstyle SINGLE void setSpeed uint16_t uint8_t onestep uint8_t dir uint8_t style void release void Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino 27 28 28 28 29 29 29 30 30 31 33 33 34 34 34 34 34 34 35 35 35 35 36 36 36 37 37 37 37 Page 3 of 37 s adafruit learning system Overview The original Adafruit Motorshield kit is one of our most beloved kits which is why we decided to make something even better We have upgraded the shield kit to make the bestest easiest way to drive DC and Stepper motors This shield will make quick work of your next robotics project We kept the ability to drive up to 4 DC motors or 2 stepper motors but added many improvements Instead of a L293D darlington driver we now have the TB6612 MOSFET driver with 1 2A per channel and 3A peak current capability It also has much lower voltage drops a
30. tep has no delay void release void The release function removes all power from the motor Call this function to reduce power requirements if holding torque is not required to maintain position Adafruit Industries Last Updated 2013 09 17 11 45 26 AM EDT Page 37 of 37
31. tor shield v2 for arduino Page 14 of 37 OK next up take the 2x3 pin header and place it with the short legs down into the top corner where it says SERVO 1 and SERVO 2 You might have to sort of angle the part a little to get it to fit into both sets of 3 pin holes we did this so it wont fall out easily when you turn it over Then flip the board over and solder the 6 pins 2 Finally break off a 2 pin piece of header and place it next to the POWER terminal block short legs down tape it in place if necessary and solder it in Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 15 of 37 Installing with Stacking Headers You will need to purchase Arduino stacking headers for this step the shield does not come with them http adafru it 85 Start by sliding the 10 pin 2 x 8 pin and 6 pin stacking headers into the outer rows of the shield from the top Then flip the board over so its resting on the four headers Pull on the legs if necessary to straighten them out Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 16 of 37 Tack one pin of each header to get them set in place before more soldering If the headers go crooked you can re heat the one pin while re positioning to straighten them up Once you ve tacked and straightened all the headers go back and solder the remaining pins for each header t af r vv Ge w J
32. tp learn adafruit com adafruit motor shield v2 for arduino Page 9 of 37 Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 10 of 37 De adafruit learning system Install Headers amp Terminals 9000000000 90000000 0119010 999000000 29000000 Melelolololelelelelelelelolelelolele oooooooooooooooooo went Belelelolelefelelelelefelelelelelele 000000000000000000 m OOOOOOOOOOOOOOOOOOO 0000000000000000000_ no k 2 00 A stef 4 A pe or OO Id 4 Installing Standard Headers The shield comes with 0 1 standard header Standard header does not permit stacking but it is mechanically stronger and they re much less expensive too If you want to stack a shield on top do not perform this step as it is not possible to uninstall the headers once soldered in Skip down to the bottom for the stacking tutorial Break apart the 0 1 header into 6 8 and or 10 pin long pieces and slip the long ends into the headers of your Arduino Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 11 of 37 Place the assembled shield on top of the header ed Arduino so that all of the short parts of the header are sticking through the outer set of pads Solder each one of the pins into the shield to make a secure connection Next you will attach the terminal blocks power jumper and servo connections Adafruit Industries http learn adafruit
33. ve adafruit learning system Adafruit Motor Shield V2 for Arduino Created by Ladyada pen f Last updated on 2013 09 17 11 45 22 AM EL Guide Contents Guide Contents 2 Overview 4 FAQ 6 Install Headers amp Terminals 11 Installing Standard Headers 11 Installing Terminal Blocks and more 13 Installing with Stacking Headers 16 Install Software 18 Running the Example Code 18 DC Motor 18 Stepper Motor Test 20 Powering Motors 22 Voltage requirements 22 Current requirements 22 Setting up your shield for powering Hobby Servos 22 Setting up your shield for powering DC Motors 22 lf you would like to have a single DC power supply for the Arduino and motors 23 lf you would like to have the Arduino powered off of USB and the motors powered off of a DC power supply 23 lf you would like to have 2 seperate DC power supplies for the Arduino and motors 23 Using RC Servos 25 Powering Servos 25 Using DC Motors 26 Connecting DC Motors 26 Include the required libraries 26 Create the Adafruit MotorShield object 26 Create the DC motor object 26 Connect to the Controller 27 Set default soeed 27 Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduino Page 2 of 37 Run the motor Using Stepper Motors Include the required libraries Create the Adafruit MotorShield object Create the stepper motor object Set default speed Run the motor Stacking Shields Addressing the Shields Writing Code for Multiple Shields Re
34. you can connect any other i2c sensor or driver to the SDA SCL pins as long as they do not use address 0x60 the default address of the shield If you want to use the servo connections they are on pins 9 and 10 If you do not use the connector then those pins are simply not used You can use any other pins for any other use The shield uses the SDA and SCL i2c pins to control DC and stepper motors On the Arduino UNO these are also Known as A4 and A5 On the Mega these are also known as Digital 20 and 21 On the Leonardo these are also known as digital 2 and 3 Do not use those pins on those Arduinos with this shield with anything other than an i2c sensor driver lt br gt lt br gt Since the shield uses I2C to communicate you can connect any other i2c sensor or driver to the SDA SCL pins as long as they do not use address 0x60 the default address of the shield lt br gt lt br gt lIf you want to use the servo connections they are on pins 9 and 10 If you do not use the connector then those pins are simply not used lt br gt lt br gt You can use any other pins for any other use lt br gt How can I connect to the unused pins All pins are broken out into 0 1 spaced header along the edges of the shield All pins are broken out into 0 1 spaced header along the edges of the shield lt br gt My Arduino freaks out when the motors are running Is the shield broken Adafruit Industries http learn adafruit com adafruit motor shield v2 for arduin
Download Pdf Manuals
Related Search
Related Contents
Swinger Shock Service Manual 取扱説明書 - ウェルネスリンク NIGHT VISION MONOCULAR “HELIOS Manuel utilisateur 「まな板・型物 総合カタログ」(PDF: 2062KB) VFU-10SA1 SD Formatter 3.1 User`s Manual #10788942#32905966共通説明書 Istruzioni Orayonne Plus BENDIX BW7450 User's Manual Copyright © All rights reserved.
Failed to retrieve file