Dual motor controller problems

Hello,
I’m working on a micro mouse project and we are using the micro dual motor controller and we are having some problems with it. We are sending the serial data with 9600BAUD and we followed the setup for how to control it.
We hooked it up and there was a delay and the wheel started turning, and then about a second later it got a little faster, and then it stopped. Sometimes it looped that action. Also I tried the whole reset line thing and that didn’t really help… Any idea anyone?

Hello,

There are a few things that could be going on, so it would help if you gave more information. It would also be good to isolate your problem by reducing the system to the simplest form where the problem still shows up. What does your code do in that simplest case?

In general, you could have power, heat, or noise problems. Is the motor controller getting hot? What are you using for a power supply?

- Jan

We got the motor control to work a little bit… for some reason it cannot go backwards. Also when we use a different speed other than 0x7f, it goes for a few seconds and stops. Also its weird but when we write the speed in binary that’s when that stop thing happens, but it will not in hex… what could be happening?

Our code is as follows:

// ----------------------------|
// --- Beginning of Program ---|
// ----------------------------|







// ----------------------------------|
// --- Subroutine Initializations ---|
// ----------------------------------|

void init(void);
void sermotor(char data);
void send_motor0();
void send_motor1(char speed, char direction);
void mot_config();

// ---------------------------------------|
// --- Global Variable Initializations ---|
// ---------------------------------------|
		// Map Data Initialization


unsigned char map[16][16];

// ---------------------|
// --- Main Function ---|
// ---------------------|
void main()
{
	overlay char i;
	init();				// Initialization of System Functions
	PORTDbits.RD7=0;
	Delay10TCYx(5);		//10us delay
	PORTDbits.RD7=1;

	for(i=0;i<120;i++)	//100ms delay
	Delay100TCYx(50);
	mot_config();


while(1)
	{
	send_motor0();
	}

}	


// -----------------------|
// --- Initializations ---|
// -----------------------|
void init()
{
	TRISD = 0x00;			// TRISD set for outputs
	TRISC = 0x80;			// Explanations??
	TRISA = 0xF0;			 // Explanations??
	TXSTA1 = 0x20;			// Explanations??
	SPBRG1 = 0x1F;			// Explanations??
	RCSTA1 = 0x90;			// Explanations??
}




// -------------------------
// Motor Control Subroutines
// -------------------------


void mot_config()
{
	sermotor(0x80);
	sermotor(0x02);
	sermotor(0b00000000);
}




//FIX THESE FUNCTIONS!
// Transmit to Motor Control to control Motor 1
void send_motor0()
{
	sermotor(0x80);				// Leave these alone
	sermotor(0x00);				// Leave these alone
	sermotor(0b00000001); // Send Motor Number and Direction
	sermotor(0b01110000);			// Send Motor Speed (0 to 127 [0x00 ~ 0x7F])
}


void send_motor1(char speed, char direction)
{
	sermotor(0b10000000);				// Leave these alone
	sermotor(0b00000000);				// Leave these alone
	sermotor(0b11110000); // Send Motor Number and Direction
	sermotor(direction);			// Send Motor Speed (0 to 127 [0x00 ~ 0x7F])

}







//Transmit data via Serial
void sermotor(char data)
{
	putc1USART(data);
	while(!Busy1USART())
	{}
	PIR1bits.TX1IF=0;
}

Hello,

The configuration should not be done every time you run your program since you will wear out the memory where the configuration is stored.

You still have not answered the question of if the motor driver chip is getting hot. Also, you’re not clear on what you’re calling your binary version, but “send_motor1” sends an invalid value in the third byte.

Your program is also not the simplest program yet. What happens when you send a single command to the motor controller? If you want other people to be able to help you, you have to first isolate the problem as much as you possible, and then provide more details about what you are observing.

- Jan

I’ve tried using the motor controller you’ve mentioned. Apparently, it doesn’t work too well when you operate it continuously(even though it’s rated at 2 A, we ran only at max 1.2 A). The driver chip gets hot very quickly. Attaching a heatsink/fan to the chip didn’t even help much. Since you’ve actually seen your motors running w/ the controller, I think it is a heating issue. For continuous motor operation, which your micromouse requires, I’d recommend using the low-voltage dual serial motor controller that Pololu now offers. This controller made a world of difference for my robotics project and the chip barely even got warm.