1A Motor Shield For Arduino

IMG_9341

 

Description of the Product

Mishmash 1A Motor Shield is Arduino-compatible board based on L293 chip. The board can control two DC 5-volt motors with maximal current of 500 mA. It is ideal for small wheeled platforms like DFRobot MiniQ or Mishmash Mitya. The shield might be powered either directly from Arduino or from external power supply.

Capabilities

 

  • Support of two motors which are controlled by 4 PWM signals

  • Input power 1 – 4.5 V

  • Peak current 1 A

  • Peak current of the motor 1st channel 500 mA

  • 5 analog inputs/outputs which enable to connect sensors using standard 3-wire cables

  • 3 digital inputs/outputs which enable to connect peripherals using standard 3-wire cables

  • Possibility of PWM signal generation at one of the digital outputs

  • Convenient connection of HC-SR94 sonar

  • UART support

  • Button of motor power supply on/off

  • Convenient library for work with the shield

 

How it works

 

Shield Work Instruction

Main Elements

front-general

POWER (black button) – power supply on/off

M1 – 1st motor power supply input

M2 – 2nd motor power supply input

RESET – reset of the shield

POWER select – select of the power supply configuration

Power Supply Configuration

 

 jumper1

Motors are powered via 5 V shield step-up stabilizer.

jumper2

Arduino is powered via 5 V shield step-up stabilizer. Being powered so, Arduino is effectively protected from interference that comes from motors.

jumper3

Motors are powered via Arduino power input.

jumper4

Arduino is powered via 5 V shield step-up stabilizer.

jumper5

Motors are powered via 5 V Arduino stabilizer.

Connection of the Peripherals

front_connect_analog.jpg

Connection of analog sensors

front_connect_digital

Connection of digital sensors

Pinout

 

Pin                                    Function

Digital pin 3                      PWM signal for control of motor 1

Digital pin 6                      PWM signal for control of motor 1 (backwards)

Digital pin 9                      PWM signal for control of motor 2

Digital pin 10                    PWM signal for control of motor (backwards)

The Library

 

We have written a convenient library MiniQDriver which helps control motors with Mishmash 1A Motor Shield.Download the library following this link. Copy it into Libraries folder (it has to be in the folder where Arduino IDE is installed). If you want to write your own sketch on the base of our library, add our library in your sketch: Sketch→Import Library→MiniQDriver.

Description of Constructors and Main Methods

 

MiniQDriver

 

Constructors

 

MiniQDriver();

Default constructor

MiniQDriver(leftForwardMotor, leftBackwardMotor, rightForwardMotor, rightBackwardMotor);

Constructor which enables user to configure the connection of the shield. Parameters of the constructor define pins on the shield.

Methods

 

setPins(leftForwardMotor, leftBackwardMotor, rightForwardMotor, rightBackwardMotor);

This method changes the configuration of the shield connection. The parameters set the numbers of pins.

void setSpeedPercent(int speedInPercent);

This method sets the speed of movement in per cent.

int getSpeedPercent();

This method returns the speed of movement in per cent. In some cases, value might be out of 0…100 range.

setSpeedConvert(int minSpeed,int maxSpeed);

This method sets the rule of transformation of the speed from per cent into values of PWM-signal. If we change the range of values of PWM-signal, the percentage doesn’t change.

Formula: speed=minSpeed+speedInPercent*(maxSpeed-minSpeed)/100;

MinSpeed is 0 and maxSpeed is 255 by default.

void setSpeedPWM(int speed);

This method sets the speed of movement in values of PWM-signal.

int getSpeedPWM();

This method returns the speed of movement in values of PWM-signal.

void setMode(int mode);

This method sets the regime of movement.

 

Acceptable values of the parameter:

 

STOP – motors stop

MOVE_FORWARD – moving forward

MOVE_BACKWARD – moving backward

TURN_LEFT – turning left

TURN_RIGHT – turning right

 

If incorrect parameter is set, the method sets STOP regime.

 

int getMode();

This method returns the regime of movement.

void pause();

This method stops the motors, memorize the speed and regime of movement.

void resume();

This method resumes the movement which was stopped by pause().

Additional Notes

 

After all the necessary movements are finished, the robot should be stopped by command setMode(STOP) or setSpeedPWM(0).

If minSpeed parameter of setSpeedConvert function was bigger than 0 then

setSpeedPercent(0) wouldn’t stop the robot chassis.

Default pinout:

Left Forward Motor 9

Left Backward Motor 10

Right Forward Motor 3

Right Backward Motor 6

If speed is set by method setSpeedPWM after setSpeedConvert is customized, then getSpeedPercent returns values which may be out of 0…100 range.

Example of a piece of code

#include
MiniQDriver miniQ;
void setup() {
//
//
// ()
// ,
//
miniQ.setMode(MOVE_FORWARD);//
for(int i=0;i<255;i++){//
miniQ.setSpeedPWM(i);//
delay(10);
}

miniQ.setSpeedConvert(127,255);//
miniQ.setMode(MOVE_BACKWARD);//
// 0% = 128, 100% = 255
for(int i=100;i>0;i—){//
miniQ.setSpeedPercent(i);//
delay(20);
}

miniQ.setSpeedPercent(25);// , =128+128*25/100=160
miniQ.setMode(TURN_LEFT);//
delay(500);
miniQ.pause();//
delay(1000);
miniQ.resume();//
delay(500);

miniQ.setSpeedConvert(0,255);//
miniQ.setSpeedPercent(100);// , =255
miniQ.setMode(TURN_RIGHT);//
delay(250);
miniQ.pause();//
delay(1000);
miniQ.resume();//
delay(250);
miniQ.pause();//
//! , !
}
// the loop routine runs over and over again forever:
void loop() {

}



Обсуждение закрыто.