L298N Stepper Motor Driver Controller Board for Arduino: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Image:Motor-driver-controller-board-for-arduino-120542.jpg|thumb|right|300px|Motor Driver Controller Board for Arduino SKU 120542 driving one High Torque 30RPM 12V DC Geared Motor (SKU 91627) with a Mystery 11.1V 2200mAh Lithium Polymer Rechargeable Battery (SKU 46058)]] |
[[Image:Motor-driver-controller-board-for-arduino-120542.jpg|thumb|right|300px|Motor Driver Controller Board for Arduino SKU 120542 driving one High Torque 30RPM 12V DC Geared Motor (SKU 91627) with a Mystery 11.1V 2200mAh Lithium Polymer Rechargeable Battery (SKU 46058)]] |
||
[[Image:WildTrumper_arduino_120542.jpg|thumb|right|300px|Motor Driver Controller Board for Arduino SKU 120542 driving Wild Trumper]] |
|||
[[Image:LynxMotion_A4WD1_arduino_120542.jpg|thumb|right|300px|Motor Driver Controller Board for Arduino SKU 120542 driving driving Robotic Base LynxMotion A4WD1]] |
|||
[[Image:LynxMotionA4WD1c.jpg|300px|thumb|right|Base robot LynxMotion A4WD1]] |
|||
[[Image:Robair_configuration1-photo1.jpg|300px|thumb|right|Configuration 1]] |
|||
Line 22: | Line 30: | ||
==Programme de test== |
|||
Code de test d'après http://mchobby.be/wiki/index.php?title=Pont-H_L298N |
Code de test d'après http://mchobby.be/wiki/index.php?title=Pont-H_L298N |
||
<pre> |
<pre> |
||
Line 42: | Line 51: | ||
int curSpeedB=0; |
int curSpeedB=0; |
||
int batteryLevel; |
int batteryLevel; |
||
int batteryNominalLevel=111; // 11.1V |
int batteryNominalLevel=111; // 11.1V with Mystery 11.1V 2200mAh Lithium Polymer Rechargeable Battery (SKU 46058) |
||
int MAX_SPEED=200; |
int MAX_SPEED=200; |
||
int curAccelerationStep=32; |
int curAccelerationStep=32; |
||
Line 172: | Line 181: | ||
</pre> |
</pre> |
||
==Pilotage via le moniteur série de l'IDE Arduino== |
==Pilotage via le moniteur série de l'IDE Arduino== |
||
Line 186: | Line 194: | ||
* 4 |
* 4 |
||
* 5 |
* 5 |
||
* |
|||
<pre> |
|||
</pre> |
|||
==Test== |
|||
* [http://dx.com/p/high-torque-30rpm-12v-dc-geared-motor-91627 High Torque 30RPM 12V DC Geared Motor (SKU 91627)] (works fine) |
|||
* [[Base robot LynxMotion A4WD1 Aluminium]] (works fine) |
|||
* [[Wild Thumper]] (not enough powerful) |
|||
==Projets @ AIR== |
==Projets @ AIR== |
Latest revision as of 09:06, 10 May 2013
http://www.dealextreme.com/p/l298n-stepper-motor-driver-controller-board-for-arduino-120542
AKA Keyes L298
Montage
ENA : Commande PWM du moteur A IN1 : Entrée de commande de sens du pont A IN2 : Entrée de commande de sens du pont A IN3 : Entrée de commande de sens du pont B IN4 : Entrée de commande de sens du pont B ENB : Commande PWM du moteur B GND : Masse +5V : Sortie régulée en 5V
Programme de test
Code de test d'après http://mchobby.be/wiki/index.php?title=Pont-H_L298N
// from http://mchobby.be/wiki/index.php?title=Pont-H_L298N //-- MOTEUR A -- int ENA=5; //Connecté à Arduino pin 5(sortie pwm) int IN1=2; //Connecté à Arduino pin 2 int IN2=3; //Connecté à Arduino pin 3 //-- MOTEUR B -- int ENB=6; //Connecté à Arduino pin 6(Sortie pwm) int IN3=4; //Connecté à Arduino pin 4 int IN4=7; //Connecté à Arduino pin 7 int curDirA=0; // 1=forward, -1=reverse int curSpeedA=0; int curDirB=0; // 1=forward, -1=reverse int curSpeedB=0; int batteryLevel; int batteryNominalLevel=111; // 11.1V with Mystery 11.1V 2200mAh Lithium Polymer Rechargeable Battery (SKU 46058) int MAX_SPEED=200; int curAccelerationStep=32; void setup() { configAB(); } void loop() { int i; stopAB(); delay(1000); forwardA(); reverseB(); for(i=0; i<255; i+=32) { speedA(i); speedB(i); delay(500); } delay(5000); for(i=255; i>0; i-=32) { speedA(i); speedB(i); delay(500); } stopAB(); delay(1000); forwardB(); reverseA(); for(i=0; i<255; i+=32) { speedA(i); speedB(i); delay(500); } delay(5000); for(i=255; i>0; i-=32) { speedA(i); speedB(i); delay(500); } } void configAB() { pinMode(ENA,OUTPUT); pinMode(ENB,OUTPUT); pinMode(IN1,OUTPUT); pinMode(IN2,OUTPUT); pinMode(IN3,OUTPUT); pinMode(IN4,OUTPUT); } void stopA() { digitalWrite(ENA,LOW);// Moteur A - Ne pas tourner (désactivation moteur) } void stopB() { digitalWrite(ENB,LOW);// Moteur B - Ne pas tourner (désactivation moteur) } void stopAB() { stopA(); stopB(); //delay(??); } void forwardA() { if(curDirA==1) return; stopA(); curDirA=1; digitalWrite(IN1,LOW); digitalWrite(IN2,HIGH); } void reverseA() { if(curDirA==-1) return; stopA(); curDirA=-1; digitalWrite(IN1,HIGH); digitalWrite(IN2,LOW); } void forwardB() { if(curDirB==1) return; stopB(); curDirB=1; digitalWrite(IN3,LOW); digitalWrite(IN4,HIGH); } void reverseB() { if(curDirB==-1) return; stopB(); curDirB=-1; digitalWrite(IN3,HIGH); digitalWrite(IN4,LOW); } void speedA(int speed) { if(curDirA==0) return; curSpeedA=(speed>=MAX_SPEED)?MAX_SPEED:speed; analogWrite(ENA,curSpeedA); } void speedB(int speed) { if(curDirB==0) return; curSpeedB=(speed>=MAX_SPEED)?MAX_SPEED:speed; analogWrite(ENB,curSpeedB); } void speedAB(int speed) { speedA(speed); speedB(speed); } void rotate() { forwardA(); reverseB(); } void antirotate() { forwardB(); reverseA(); }
Pilotage via le moniteur série de l'IDE Arduino
Liste des commandes sur 1 octet
- s or S
- f
- x
- l
- r
- 1
- 2
- 3
- 4
- 5
Test
- High Torque 30RPM 12V DC Geared Motor (SKU 91627) (works fine)
- Base robot LynxMotion A4WD1 Aluminium (works fine)
- Wild Thumper (not enough powerful)