L298N Motor Shield

Hello
I have the card L298N Motor Shield V3 flamingoeda

I did not find its manual
I saw the version 2
http://cgi.ebay.fr/Arduino-Motor-controller-Shield-V2-L298N-drive-2-motors-/200546297653

but the problem: there are two buttons difference from the old version:
On "V2"there is a switch "VA"that can be put into "VEX" or "V5V"
On "V3" there are two new switches:

  • "VLC" it can be set ON or OFF
  • "VLO" you can turn it "ON" or "OFF"

I understand that when you want to supply power from the arduino you set the VM switch to VIN, and to VEX if you want to supply power from an external battery that you plug in "5V" and "Gnd" (Can we use a higher voltage such as 12V ? )

I await your reply eagerly

Thank you

In the eBay auction you pointed to they say that the VM switch is for the motors and the VA switch is for the logic. I'm not sure but I think that means if the power supply you are using for the motors is suitable for the Arduino Vin (6 to 20 volts for the Diecimila) then you can power the Arduino from the same source. That's just a guess.

If you have a multimeter, see if the VA switch connects the Vin pin (near Analog In 1) to the VEX connector.

It's OK
http://translate.google.com.hk/translate?hl=zh-CN&ie=UTF-8&sl=zh-CN&tl=en&u=http://blog.flamingoeda.com/2011/02/18/arduino-l298n-%25E7%2594%25B5%25E6%259C%25BA%25E9%25A9%25B1%25E5%258A%25A8%25E6%2589%25A9%25E5%25B1%2595%25E6%259D%25BF-v03-%25E4%25BD%25BF%25E7%2594%25A8%25E6%2589%258B%25E5%2586%258C/&prev=_t

http://translate.google.com.hk/translate?hl=zh-CN&ie=UTF-8&sl=zh-CN&tl=en&u=http://blog.flamingoeda.com/2011/02/18/arduino-l298n-%25E7%2594%25B5%25E6%259C%25BA%25E9%25A9%25B1%25E5%258A%25A8%25E6%2589%25A9%25E5%25B1%2595%25E6%259D%25BF-v03-%25E4%25BD%25BF%25E7%2594%25A8%25E6%2589%258B%25E5%2586%258C/&prev=_t
It explains everything, of course it's just a crappy translation but at least you can tell which case is which...

Two cases :

  • If you're going to supply your motors internally (through your Arduino) you're going to be limited from 6v to 12v :
    You set the swiches as follows :
    VLO: OFF
    VLC: ON
    VM : Vin

  • If you want to supply the motors externally (from 12v to 20v), set the switches as follows :
    VLO: ON
    VLC: OFF
    VM : Vex

  • If you want to supply the motors externally (from 24v to 46v), set the switches as follows :
    VLO: OFF
    VLC: ON
    VM : Vex

On this shield, we use pin 13 and pin 12 as direction of motor A (MA), and pin 10 as speed of MA. For motor B (MB), pin 11 and pin 8 as direction and pin 9 as speed.

Here below is an example code,

// motor A
int dir1PinA = 13;
int dir2PinA = 12;
int speedPinA = 10;
// motor B
// motor A
int dir1PinB = 11;
int dir2PinB = 8;

int speedPinB = 9;
unsigned long time;
int speed;
int dir;
void setup() {
pinMode(dir1PinA, OUTPUT);
pinMode(dir2PinA, OUTPUT);
pinMode(speedPinA, OUTPUT);
pinMode(dir1PinB, OUTPUT);
pinMode(dir2PinB, OUTPUT);

pinMode(speedPinB, OUTPUT);
time = millis();
speed = 0;
dir = 1;
}
void loop() {
analogWrite(speedPinA, speed);
analogWrite(speedPinB, 255 - speed);
// set direction
if (1 == dir) {
digitalWrite(dir1PinA, LOW);

digitalWrite(dir2PinA, HIGH);
digitalWrite(dir1PinB, HIGH);
digitalWrite(dir2PinB, LOW);
} else {
digitalWrite(dir1PinA, HIGH);
digitalWrite(dir2PinA, LOW);
digitalWrite(dir1PinB, LOW);
digitalWrite(dir2PinB, HIGH);

}
if (millis() - time > 5000) {
time = millis();
speed += 20;
if (speed > 255) {
speed = 0;
}
if (1 == dir) {
dir = 0;
} else {
dir =1;
}
}
}