MDD10a crashing arduino?

Autonomous Robot, Manual Robot, DC Motor Driver, Stepper Motor Driver, Servo, Multi PWM chip.....

MDD10a crashing arduino?

Postby eameres » Sun Jul 24, 2022 4:03 am

I'm experiencing random hanging/crashes in my Arduino Robot application. Please help!

I'm using a MDD10a with an Arduino Mega, along with an older generation Sparkfun USB host shield that has a BlueTooth dongle in it, as well as a serial connection to a DFRobot MP3 player board and to an IMU 6050 vial I2C. I am controlling the motors of a small robot. The motors are ServoCity's 12v Econ GearMotors. The whole thing is run from 2 7.4 lipo batteries run in series, for about 15v.

The MDD10A is run from the Mega's 44-47 pins and the PWM frequency is set to the highest to avoid board and motor, like so


int dir1pin =47; //Motor Direction pin (goes to DIR1)
int spe1pin =46; //Motor Speed pin (goes to PWM1)
int dir2pin =45; //Motor Direction pin (goes to DIR2)
int spe2pin =44; //Motor Speed pin (goes to PWM2)

////////////////PIN MODE DEFINATIONS//////////////////////
pinMode(dir1pin,OUTPUT);
pinMode(spe1pin,OUTPUT);
pinMode(dir2pin,OUTPUT);
pinMode(spe2pin,OUTPUT);

TCCR5B = TCCR5B & B11111000 | B00000001; // for PWM frequency of 31372.55 Hz

The problem is that everything seems to randomly hang intermittently if the motors are attached. I assumed it was some type of motor noise, so I put .1mf ceramic caps across the motor leads and between the leads and the motor housings. I also twisted the motor wires and ran each leg through its own little ferrite ring. It still happens though, sometimes right away, sometimes not for a long while.

The motors are run with these few lines:


void _writeToMotors()
{
digitalWrite(dir1pin,motordirection1);
digitalWrite(dir2pin,motordirection2);
analogWrite(spe1pin,motorspeed1); //increase the speed of the motor from 0 to 255
analogWrite(spe2pin,motorspeed2); //increase the speed of the motor from 0 to 255
}
eameres
Fledgling
 
Posts: 1
Joined: Sun Jul 24, 2022 3:46 am

Return to Robot Controller

Who is online

Users browsing this forum: No registered users and 6 guests

cron