New Project

CONNECT

Adafruit Motor Shield Pin Structure and Software Functions

  • Page Views 924
  • Spread the love
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  
    •  

    Adafruit Motor Shield , I’m talking from pins, libraries and software.Why the most preferred, is making rapid prototyping. First, the library board to look at the overall structure of the pin and then use the card and I’ll explain the meaning of the function. Using the library card is also a great advantage in terms of software.

     

    Adafruit Motor Shield General Information

    The nature of the way we look at P 4 dc motor as can be seen, 2 2 servo motors and stepper motors can take.That is just not designed to drive DC motors. This aspect is also advantageous. Arduino we wear the pins on the Arduino UNO is closed no matter where in addition we need to get out of the arduino has additional pins on the shield. So these pins are used as normal arduino pins. As to be seen in figure digital analog 0 to 5 and 0 to 13 contain additional pins. Furthermore, the supply pins are given a separate output. These models are no pins in addition defined as the change in some shield. In this case, you can get the same output pin to an additional cable while installing the shield i pins. It has a working voltage between 5-12v. Each channel provides 600 mAh flow.

    Adafruit Shield Libraries and Functions

    You can download the library here >> AfMotor Library

    #include <AFMotor.h> : Library loading function

    DC Motor Control Functions:

    AF_DCMotor : In this function definition is done with DC motors. There are two issues in driving dc motor. First channel number, and the second is the PWM frequency.

    1 and 2. channel frequency identification for item ;

    MOTOR12_1KHZ // 1khz frequency
    MOTOR12_2KHZ // 2khz frequency
    MOTOR12_8KHZ // 8khz frequency
    MOTOR12_64KHZ // 64khz frequency

    3 and 4. channel frequency identification for item ;

    MOTOR34_1KHZ // 1khz frequency
    MOTOR34_8KHZ // 8khz frequency
    MOTOR34_64KHZ // 64khz frequency

    There are two ways you can make the engine definitions.

    First definition:

    AF_DCMotor motor1(1); The number in parentheses here gives the channel number. Outside the “motor1” if the definition is the name we assign to channel 1. In this way we define a default frequency value as we enter the PWM frequency will be defined as 1kHz.

    Secand definition:

    AF_DCMotor left_motor(1, MOTOR12_64KHZ); Here, we describe the channel 1 again. Channel name “left_motor” as we have defined. We enter our frequency value in this definition. the first portion of the channel name in parentheses is our frequency value and the second part.

    • If you choose high-frequency humming engines of less income but reduces the torque of the motor.

    Speed of Motor Function:

     SetSpeed Function: This function can adjust the speed of the motor from 0 to 255 values.

    motor1.setspeed (180); >> In this way the “motor1” We have set the pace with which we enter values in parentheses is the engine channels.

    Motion Function of Engine:

    run function: we stop the operation of the motor back and forth with this function.

    Direction processing functions are provided with English terms.

    • FORWARD – forward
    • BACKWARD – back
    • RELEASE – stop

    motor1.run(FORWARD); In this way the “motor1” has been set to the forward direction of the motor is channel.

    motor.run(BACKWARDS); // Go back
    motor.run(RELEASE); // Stop

     

    Stepper Motor Control Functions

    2 one can take stepper motor as seen in the figure above. Channels 1 and 2 the first step, 3 and 4 channel allows us to control the second stepper motor.

    AF Stepper: This function makes the definition of stepper motor.
    AF stepper motor_name (step, channel number)
    The above structure is a general description of the stepper motor function.
    We call the stepper motor function with af_stepp travelers.

    “motor_name” part is the name you give to your stepper motor.

    “step” is a step in the number of revolutions of the stepper motor is entered.

    “channel number” of the stepper motor to which we want to connect to the channel number of the channel is entered. So the left side right side was 2 channel 1 channel. We must enter 1 or 2.

    Sample identification:

    AF_Stepper Stepper1(200, 1); >> With this definition of “Stepper1” called the 200 steps of the stepper motor information 1 indicates that the defined channel

    step (step, direction, mode): This identification of step and direction information to move the stepper motor mode is where you entered.

    step : Here few steps back to the engine information is entered.

    direction : The motor direction of rotation is entered here. Aspect functions “FORWARD” and “BACKWARD” is defined as.

    mode : Here the movement of the stepper motor type is entered. These;

    • SINGLE : It operates the motor with energizing a coil. Power saving is useful in places that require but is not very common. It gives less torque motor.
    • DOUBLE: Run the motor with energizing the two coils. Engine gives full torque.
    • INTERLEAVE : Coil simultaneously to reduce by half the pitch angle, giving energy.This results in increased resolution and doubles the number of steps. For example, step 200 engine with 1.8 degrees, 0.9 degrees 400 steps, this function takes the value.
    • MICROSTEP: Smooth motor for driving. Commonly used functions. It provides a smooth transition between steps. But decreases torque.

    Example function: Stepper1.step(150, FORWARD, DOUBLE); >> Here “Stepper1” with engine 150 is step “DOUBLE” would return information on the mode entered.

    setSpeed(rpm) >> Function is used to adjust the stepper motor’s rpm. Rpm bracketed values are entered
    Example function: Stepper1.setSpeed(10); >> In this way, “Stepper1” We define value is the speed of the engine.

    OneStep (direction, mode) >> This function is available for single-step stepper motors.FORWARD or BACKWARD express written direction to the direction indicated in parentheses. We are also doing our definition above, using the same mode of expression mode.
    Example function: Stepper1.onestep(FORWARD, DOUBLE); >> In this way “Stepper1” is the direction of the engine and advanced mode “DOUBLE” We specify.

    release() >> This function stops the motor torque and the amount of energy that does not interruptand engine keeps the same torque.
    Example function: Stepper1.release(); >> In this way, “Stepper1” the engine is stops.

    Servo Motor Control

    Drive over 2 servo input located on.The driver to drive the servo does not have its own library functions. You can control servos using the normal servo library. Servo1 entry by arduino digital pins on the 9th,Servo2 is connected to the input pins by the arduino’s 10.dijital. Whether the user’s convenience it made 2 servo input.

    servo1.attach(9); or servo1.attach(10); >> You can introduce a servo motor to this entry.

    Example project >>  http://make.robimek.com/arduino-line-follower-robot/

     

    Share

    What did they say ?

    First Comment About You!!

    avatar
    wpDiscuz

    BE A FACEBOOK FAN

    Instagram