Low voltage dual serial motor controller

Hi newbie here. I need some help with my low voltage dual serial motor controller. (and tamiya double gearbox)

I have a 6v 1.2Ah battery that runs my microprocessor, I tried running it off this too (as at a rough estimate from figures in the instructions) it uses about 90mA.
After reading a lot in this forum I have changed my motor controller from a dual serial to a micro dual serial to the one I have now. It doesnt seem to overheat, but after looking at the specs (“motors run on 3-6 volts and draw up to a few amps”) I have concluded my battery is not powerful enough. So I also have a 6v 4Ah which I tried, but surely you cant have the + of 2 batterys going to the - of 1? what should I do (I dont believe my microcontroller’s demo board can handle anything much more than 1000mA)

Please help. Thanks.

I also have capacitors soldered across the motor terminals as in the instructions, and always have the battery fully charged.

The motor controller works fine connecting it to the 6v 1.2Ah battery without the motors connected (the LEDs work) but with the motors connected they try but dont really move much.

Always glad to see people breaking into robotics.

You are quite right, if you want to use a different battery to power your motors, you should connect its positive terminal to the “motor supply pin” and its negative terminal to the “ground” pin, but you then also need to tie the ground of your microcontroller to the ground of your motor controller. Look at the picture on page 4 of the guide, and pretend that your smaller battery is plugged into some other part of the “Robot Controller” box. If your microcontroller has a free ground pin you could connect that to your motor battery, or you could even connect the negative terminals of the two batteries together.

Now, you are right to be cautious, since it is easy to blow stuff up while figuring out the wiring. You want to be very careful not to connect your battery, or any voltage greater than 5.5V directly to the logic supply pin, or a little puff of smoke will come out of your motor controller and you will have to send it back to Pololu for repair. What kind of microcontroller are you using, and what is your current wiring setup (a picture is worth many words)?

-Adam

I am using a parallax Javelin stamp and demo board (which regulates the logic supply to 5v) I connected the 6v 4Ah battery to the microprocessor anyway, and used the “Vin” (unregulated supply) for the motor supply, however I still get the same problem. The motor controller seems to work without the motors as the appropriate LEDs light up with the correct commands. The power is surely there, but yet with the motors connected it just attempts to move (theres a flash from the correct LED and a slight movement from the correct motor) but then doesnt do anything

I didn’t even know Parallax made a Java stamp, neat! Can you post your source code? Hopefully it’s just a simple bug.

Also, assuming for the moment that the rest of the wiring is fine, what are you doing with the motor controller’s reset line?

-Adam

I have a very complex program which links with sensors and things, but even with a simple test program (as shown below) I still get the same prob. Also presumably theres nothing wrong with the code if the LEDs are lighting correctly

source:


import stamp.core.Uart;
import stamp.core.CPU;

public class MotorTester{

  public static void main(){
    //set up uart called mc
    Uart mc = new Uart(Uart.dirTransmit,CPU.pin15,Uart.dontInvert,Uart.speed4800,Uart.stop1);
    //set reset line to +5v
    CPU.writePin(CPU.pin0, true);
    //delay - give the mc a chance to get ready (very long time - several seconds)
    CPU.delay(30000);
    CPU.delay(30000);
    //send start byte
    mc.sendByte(0x80);
    //send motor controller type byte
    mc.sendByte(0x00);
    //send motor number and direction byte
    mc.sendByte(0x07);
    //send speed byte
    mc.sendByte(0x7f);

  }
}

I have tried this with different speeds motor numbers and directions.

The reason for motor number being 7 is; on the low volatge motor controller the defualt config is 2 motors with numbers 2 and 3

so motor 3 backwards would be 3x2+1=7

I never used the Stamps much, and I just did some quick reading on the Javelin and I am drooling over its ability to assign uart TX and RX to any pin. Your code looks very good, but I have a theory:

I’m not sure if this is how the Javelins operate, but it is possible that when your program is done running, the Stamp goes into an idle state, bringing pin0 to its default low. This would produce the behavior you have been seeing, LED’s light, the correct motor twitches, but then the motor controller is pulled into its reset state and everything stops. Can you check pin0 with a voltmeter when its done executing your code? If it is low, try putting a while(true) loop at the end of your main function and see if that fixes things (if the Javelin compiler has an optimization function turn it off, a gotchya of AVR’s). You might also want to try the universal “0” as your motor number, just in case.

Worth a shot, does it work?

-Adam

Hi again,
I have tested it with my multimeter and it measures 4.95v as i’d expect. Also the fact that this worked for several seconds using the micro dual serial controller with the exact same program confirms it. I am really stumped. Im going into my university’s lab later, hopefully then I can find the problem, I’ll let you know if I do

Now that is really unusual. If your identical setup worked with the micro dual serial controller then you should be fine. The low voltage dual serial motor controller uses the same protocol, device type, default settings, even the same PIC!

The last thing I can think of is to make sure your Javelin is connected to the logic level serial input and reset pins 4 and 5 (along the row of 9 pins on one side of the board), rather than the RS-232 serial input and reset pins in the group of three on the opposite end of the board (of course, if you had made this mistake I doubt your motors or LEDs would be twitching!). If you want you could use these three pins to test your motor controller from a computer serial port, but seeing as you already had a working setup I don’t really think you should.

If you swap the micro dual serial motor controller back for the low voltage one, and (without changing anything else) your motors turn, there’s almost definitely something wrong with your LVDSMC, and it’s time to contact Pololu about repairing/replacing it.

Sorry you’re having so much trouble. By the way, considering you had built a system with a microcontroller you programmed sending serial commands to a motor controller and getting motors to turn, I wouldn’t have thought of you as a “newbie”!

-Adam

Hello,

If adding motors makes things stop working, you probably have a noise or power problem. Basically, once you actually have a bigger load, your voltages aren’t staying where you think they are, and the motor controller is probably resetting.

For instance, it sounds like you might be routing your motor supply power through your Stamp, which surely isn’t made to be a distribution board for many amps. Your motor supply should use the thickest, shortest wires that are practical and connect directly from your power supply to the motor controller. Remember, the same current has to flow through the negative side, also, so both battery terminals need to connect well to the motor controller.

It’s also possible that you’re picking up noise on the control lines, causing the controller to reset. Make sure to keep the logic lines as separated as possible from the high-power lines. Twisting the motor leads can also help.

When you’re in your lab, check the logic power and signal lines on a scope to make sure there are no glitches. For the Vcc and reset lines, you can add capacitors to clean them up.

- Jan

I am using a BasicStamp2 to control the low voltage dual motor controller and I had some flaky behavior for a while and am still not positive about what was wrong. When reading the manual it seemed to say that if you are not using the reset line that it needs to be tied to a 5v supply. I used a jumper wire to connect the VCC to RST and it seemed to work fine for motor0, but motor1 would start to spin and then stop responding to commands. I took off the jumper and and connected it to nothing, and now everything works exactly as expected. Was I supposed to use a resistor or something, and why does it work when not connected to anything. I wish the manual, which is otherwise great, would be a bit more clear on this point.

Thanks for your input.

Usually the Pololu manuals are more specific about weather a reset pin must be connected for the controller to operate, or if it can be left disconnected, but you’re right, this one is a little ambiguous. They do say that you must keep the reset pin high, but they go on to say that connecting it is recommended, but not required. There is probably a pull-up resistor (either on the board or internal to the microcontroller) that brings the pin high when it is disconnected. You might try verifying this with a voltmeter.

In general, when you connect a logic I/O pin directly to a power line, yes, you want a current-limiting resistor of some sort for your hardware’s protection! Glad it still seems to work.

-Adam

Thanks for the quick reply. I am a software engineer by day and just became a hobby robotocist a couple of months ago, so I’m not very well acquainted with all the particulars of hardware yet.

I wasn’t sure if the VCC line would be any different than connecting to a pinout of the microcontroller as they show no resistor in the schematic and the both are a regulated 5v, but I’m guessing that there is some sort of built in resistor to prevent too much current being drawn through the mc?

For future reference, when the manual says to use a pull down resistor so that the motors stop if the mc gets reset, are they talking about a ~10k ohm resistor connected to ground, pinout and RST?

Thanks again.

By the way, I was at the University of Michigan to present at a computational linguistics conference a couple of summers ago and I was quite impressed by the campus, the city and the uni. Good choice!

Yeah, I like the University and Ann Arbor a lot.

In general, it’s okay to wire logic chips directly to each other, since they limit the amount of current they will output to reasonably safe levels for other input pins.

And yes, the pull down resistor would be a 5-10KOhm resistor between the reset/pinout and ground. This way, when the microcontroller pinout pulls the reset pin high, very little waste current flows through the resistor to ground, but should the microcontroller get reset or switched off, the resistor will immediately pull the reset pin low, rather than leaving it high or floating.

-Adam

Did you first program your mc for two motor operation

void USART_Init (unsigned int ubrr)
{ 
   //set buad rate at 9600 
   UBRR0H = (unsigned char)(ubrr>>8); 
   UBRR0L = (unsigned char) ubrr; 
   //enable reciever & transmitter 
   UCSR0B = (1 <<RXEN0) | (1 << TXEN0); // Parenths were wrong here 
   //Set frame format for 8bit with 1 stop 
   UCSR0C |= bit(2)| bit(1);
   UCSR0C &= nbit(3);
}
void UART_Trans(unsigned char data)
{ 
   //wait for transmit empty 
   while (!(UCSR0A & (1<<UDRE0))); 
   UDR0 = data; 
} 
//name this something
{
	USART_Init (MYUBRR);
	USART_Trans (0x80); //Start Bit
	USART_Trans (0x02); //Device select
	USART_Trans (0x00); //Motors 0 &1
}