Has anyone interfaced this dc motor driver with arduino.
I tried to run pwm forward. it worked fine. But while giving logic high on direction pin and pwm, burns the mosfets.
The link to the board is shown below
My Arduino Code is shown below. Command 'R' Burns Mosfet.
char inByte; // incoming serial byte
void setup()
{
// start serial port at 9600 bps:
Serial.begin(9600);
TCCR1B = TCCR1B & 0b11111000 | 0x03; //pwm freq 488hz
pinMode(3, OUTPUT); //M1 PWM input for Motor1
pinMode(11, OUTPUT); //M1 PWM input for Motor2
pinMode(6, OUTPUT); //M1 Direction
pinMode(7, OUTPUT); //M1 Brake
}
void loop()
{
// if we get a valid byte, read analog ins:
if (Serial.available()) {
// get incoming byte:
inByte = Serial.read();
}
if (inByte == 'W') {
analogWrite(3, 20); //pwm motor 1
analogWrite(11, 20); //pwm motor 2
digitalWrite(6, LOW); //Default Forward Direction
digitalWrite(7, LOW); //No Brake
}
if (inByte == 'A') {
analogWrite(3, 40);
analogWrite(11, 40);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
if (inByte == 'D') {
analogWrite(3, 60);
analogWrite(11, 60);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
if (inByte == 'S') {
analogWrite(3, 0);
analogWrite(11, 0);
digitalWrite(6, LOW);
digitalWrite(7, HIGH); //Brake
}
if (inByte == 'R') {
analogWrite(3, 20);
analogWrite(11, 20);
digitalWrite(6, HIGH); //Reverse Direction
digitalWrite(7, LOW); //No Brake
}
else {
analogWrite(3, 0);
analogWrite(11, 0);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
}
}
If anyone have tried with arduino, please provide sample code.
Thanks
dheeraj