Dual Serial Motor Controller-Individual Motor Control issue

Motor Controller: Low-Voltage Dual Serial Motor Controller
Micro Controller: Basic Stamp 2
Desired Operation: 2 motor mode, default motor numbers
Motors: Tamiya 70168
Power: Motor: Power 2 - 1.5v AA / Micro/Motor Controller – 5v regulated on Basic Stamp Homework Board
Wiring Deviations: 0.1uF capacitors aren’t installed

Hello,

I am new to motor/microcontrollers and have been experiencing difficulty controlling two motors independently. The motors will only respond to the following commands.

If I use 1 as the motor number both motors turn in one direction.

SEROUT 0, 84, [$80, 0, 1, 127]

If I use 0 as the motor number both motors turn in the opposite direction.

SEROUT 0, 84, [$80, 0, 0, 127]

I tried using the default motor numbers and others (0-20) just for testing with no luck.

I am fairly sure I am the cause of the problem since I didn’t read the documentation all the way through. I started by issuing the configuration command at the start of my test program:

SEROUT 0, 84,[$80,2,2]
LOW 2 'reset motor controller
HIGH 2
PAUSE 100

I also had a return statement at the end of my test program which would cause the application to loop.

I figured it would be a good idea to start from scratch but I am having some trouble getting there. Does anyone have a BS2 script to erase the motor controller eeprom and reset the factory defaults?

Any other suggestions would be greatly appreciated!

Thanks,
Eric

Hello.

It sounds like your motor controller got set to single-motor mode. Your SEROUT 0, 84, [$80, 2, 2] line should restore the defaults. If you run that without the immediate reset, do you see the LEDs flash in the expected fashion? After that, you should get individual motor control.

- Jan

Hi Jan,

Thank you for the quick response. If I run the script below, I get a solid green LED and motor connected to M1± starts running.

’ {$STAMP BS2}
’ {$PBASIC 2.5}

SEROUT 0, 84,[$80,2,2]
END

If I add a pause/reset, it will run for the amount of time definned for the pause and then stop when reset.

’ {$STAMP BS2}
’ {$PBASIC 2.5}

SEROUT 0, 84,[$80,2,2]
PAUSE 4000

LOW 2 'reset motor controller
HIGH 2

END

Thanks,
Eric

That shouldn’t be happening. Can you try without the motor connected?

- Jan

I disconnected both motors and ran the script below. The LED went solid green for 4 seconds.

’ {$STAMP BS2}
’ {$PBASIC 2.5}

SEROUT 0, 84,[$80,2,2]
PAUSE 4000

LOW 2 'reset motor controller
HIGH 2
END

Thanks,
Eric

Can you try putting the reset stuff before the serout command? In other words, make pin 0 high, then toggle the reset line, then send the configuration command.

- Jan

Hi Jan,

No luck. :frowning: Same behavior with the following script:

’ {$STAMP BS2}
’ {$PBASIC 2.5}

HIGH 0
LOW 2
HIGH 2
PAUSE 100

SEROUT 0, 84,[$80,2,2]
PAUSE 4000

LOW 2 'reset motor controller
HIGH 2

END

Can you try sending the three bytes separately, with big pauses or debug statements in between, and find out when the LED turns on?

- Jan

Hi,

The green LED turns on M1 motor turns when the 3rd byte is sent. I think I did it right but the script is below:

HIGH 0
LOW 2
HIGH 2
PAUSE 1000

SEROUT 0, 84,[$80]
DEBUG CLS, "Serout 1"
PAUSE 5000

SEROUT 0, 84,[2]
DEBUG CLS, "Serout 2"
PAUSE 5000

SEROUT 0, 84,[2] ’ LED TURNS ON HERE AND MOTOR 1 STARTS TURNING
DEBUG CLS, “Serout 3”

I don’t have any explanation for the behavior (if you aren’t doing anything wrong), but it’s very unlikely for a problem with the motor controller to fail in this way. You shouldn’t be doing the test with the motor connected since that brings your power setup more into play, and you could also try using our serial transmitter utility (connect a computer serial port to the RS-232 input) to take your BASIC Stamp out of the picture. If all that leads to the same results or if you’re sick of testing, you can send the unit back to us for us to evaluate.

- Jan

I appreciated all your help. I will likely send it back and let the experts take a look.

Thanks,
Eric