AdaFruit Motor Shield Utiliser

De MCHobby - Wiki
Révision datée du 17 décembre 2012 à 11:41 par Admin (discussion | contributions) (Page créée avec « {{Motor-Shield-Nav}} == First Install the Arduino Library == Before you can use the Motor shield, you must install the AF_Motor Arduino library - this will instruct the Ard... »)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)
Sauter à la navigation Sauter à la recherche

First Install the Arduino Library

Before you can use the Motor shield, you must install the AF_Motor Arduino library - this will instruct the Arduino how to talk to the Adafruit Motor shield, and it isn't optional!

  1. First, grab the library from github
  2. Uncompress the ZIP file onto your desktop
  3. Rename the uncompressed folder AFMotor
  4. Check that inside AFMotor is AFMotor.cpp and AFMotor.h files. If not, check the steps above
  5. Place the AFMotor folder into your arduinosketchfolder/libraries folder. For Windows, this will probably be something like MY Documents/Arduino/libraries for Mac it will be something like Documents/arduino/libraries. If this is the first time you are installing a library, you'll need to create the libraries folder. Make sure to call it libraries exactly, no caps, no other name.
  6. Check that inside the libraries folder there is the AFMotor folder, and inside AFMotor is AFMotor.cpp AFMotor.h and some other files
  7. Quit and restart the IDE. You should now have a submenu called File->Examples->AFMotor->MotorParty

Powering your DC motors, voltage and current requirements

Motors need a lot of energy, especially cheap motors since they're less efficient. 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 4.5V to 25V.

Current requirements

The second thing 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 600 mA per motor, with 1.2A peak current. Note that once you head towards 1A you'll probably want to put a heatsink on the motor driver, otherwise you will get thermal failure, possibly burning out the chip.

On using the SN754410

Some people use the SN754410 motor driver chip because it is pin-compatible, has output diodes and can provide 1A per motor, 2A peak. After careful reading of the datasheet and discussion with TI tech support and power engineers it appears that the output diodes were designed for ESD protection only and that using them as kickback-protection is a hack and not guaranteed for performance. For that reason the kit does not come with the SN754410 and instead uses the L293D with integrated kickback-protection diodes. If you're willing to risk it, and need the extra currrent, feel free to buy SN754410's and replace the provided chips.

Need more power?

Buy another set of L293D drivers and solder them right on top of the ones on the board (piggyback). Voila, double the current capability! You can solder 2 more chips on top before it probably isnt going to get you much benefit

Les moteurs et les piles de 9v

You can't run motors off of a 9V battery so don't even 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 on the power line from sharing power supplies and/or not having a powerful enough supply!

How to set up the Arduino + Shield for powering motors

Servos are powered off of the same regulated 5V that the Arduino uses. This is OK for the small hobby servos suggested. If you want something beefier, cut the trace going to + on the servo connectors and wire up your own 5-6V supply!

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 5V line. This is a very very very bad idea unless you are sure you know what you're doing!

There are two places you can get your motor 'high voltage supply' from. One is the DC jack on the Arduino board and the other is the 2-terminal block on the shield that is labeled EXT_PWR. 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. However the EXT_PWR terminals on the shield do not have a protection diode (for a fairly good reason). Be utterly careful not to plug it in backwards or you will destroy the motor shield and/or your Arduino!

Here's how it works:

ADF-MOTOR-SHIELD-USE-ALIM.jpg

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com

Toute référence, mention ou extrait de cette traduction doit être explicitement accompagné du texte suivant : «  Traduction par MCHobby (www.MCHobby.be) - Vente de kit et composants » avec un lien vers la source (donc cette page) et ce quelque soit le média utilisé.

L'utilisation commercial de la traduction (texte) et/ou réalisation, même partielle, pourrait être soumis à redevance. Dans tous les cas de figures, vous devez également obtenir l'accord du(des) détenteur initial des droits. Celui de MC Hobby s'arrêtant au travail de traduction proprement dit.