杯具 L298P 2A直流电机驱动问题
2014-11-273.3万
AI 快速预览详细
本文讨论了使用L298P驱动板连接4个直流电机时遇到的供电问题。具体表现为M2口电压为2V多,M1口电压为3V多,电流测试时小车停掉。文章详细分析了UNO板和L298P驱动板的可能故障,并提供了具体的排查步骤。通过万用表测试发现M1口电流异常,导致小车停掉的具体故障现象。建议检查UNO板和L298P驱动板的电源连接,确保供电正常。
|
我的是4WD移动平台,用L298P 连接了4个直流电机(前轮两只接M2,后轮两只接M1,并联),采用VIN主板直供,UNO电源是9V电池,本来启动正常,然后用万用表测试了一下电压,M2是2V多,M1是3V多,然后再想用万用表测试一下M1口的电流大小。。。结果就杯具了。。。刚连上,万用表闪过一个1.XA的电流,然后小车就停掉。。。 然后就再也无法用UNO的电池供电启动电机了。。。。 PS: USB供电可以启动,驱动板用外接电源也可以启动, 请问有谁知道这个问题是UNO板的问题还是L298P的问题? |




int E1 = 10;
int M1 = 12;
int E2 = 11;
int M2 = 13;
应该就可以解决你的问题了
// # Editor : Lauren from DFRobot
// # Date : 17.01.2012
// # Product name: Wheel Encoders for DFRobot 3PA and 4WD Rovers
// # Product SKU : SEN0038
// # Description:
// # The sketch for using the encoder on the DFRobot Mobile platform
// # Connection:
// # left wheel encoder -> Digital pin 2
// # right wheel encoder -> Digital pin 3
// #
#define LEFT 0
#define RIGHT 1
long coder[2] = {
0,0};
int lastSpeed[2] = {
0,0};
int E1 = 5;
int M1 = 4;
int E2 = 6;
int M2 = 7;
int BOARDLED = 13;
void setup()
{
pinMode(M1, OUTPUT);
pinMode(M2, OUTPUT);
pinMode(BOARDLED, OUTPUT);
Serial.begin(9600); //init the Serial port to print the data
attachInterrupt(LEFT, LwheelSpeed, CHANGE); //init the interrupt mode for the digital pin 2
attachInterrupt(RIGHT, RwheelSpeed, CHANGE); //init the interrupt mode for the digital pin 3
}
void loop()
{
digitalWrite(BOARDLED, LOW);
int value = 250;
//for(value = 0 ; value <= 255; value+=5)
{
digitalWrite(M1, LOW);
digitalWrite(M2, LOW);
analogWrite(E1, value); //PWM调速
analogWrite(E2, value); //PWM调速
delay(10);
PrintSpeed();
}
}
void PrintSpeed()
{
static unsigned long timer = 0; //print manager timer
if(millis() - timer > 80){
Serial.print("Coder value: ");
Serial.print(coder[LEFT]);
Serial.print("[Left Wheel] ");
Serial.print(coder[RIGHT]);
Serial.println("[Right Wheel]");
lastSpeed[LEFT] = coder[LEFT]; //record the latest speed value
lastSpeed[RIGHT] = coder[RIGHT];
coder[LEFT] = 0; //clear the data buffer
coder[RIGHT] = 0;
timer = millis();
}
}
void LwheelSpeed()
{
coder[LEFT] ++; //count the left wheel encoder interrupts
}
void RwheelSpeed()
{
coder[RIGHT] ++; //count the right wheel encoder interrupts
}
代码贴上。
[font=微软雅黑, Verdana, Arial]图1
[/font]
[font=微软雅黑, Verdana, Arial]图2
[/font]
[font=微软雅黑, Verdana, Arial]你能确定是图1还是图2吗?如果是图2 的话,你的软件程序有错了,因为图2的控制脚是用到D10 D11 D12 D13的脚[/font]
这部分是编码器