Strange behavior of Pololu LVDS motor controller

Hi everyone. I am a student building an autonomous robot for a school project and I got problems for MONTHS with this Pololu Low-Voltage Dual Serial Motor Controller. It’s the only controller I found that suited those darn toy motors included in the cheap DFRobot chassis I bought, since these got a max voltage of about 7V.

My problem(s) is that the motor controller behave strangely, which mean that SOMETIMES (sometime this doesn’t happen for some reason), one side of the motors simply stop (controller light turns off) when there is mechanical resistance (like a floor). Also, the controller seem to be unable to make the robot turns (left or right). The controller LEDs light up (red on one side, green on the other side) and the motors seems to get some power during about a milisecond, but, in the end, nothing moves.

For the first problem, I attempted to switch the motors sides to see if it was the motor that had the weakness, but the problem remained, confirming that the motor controller is the problem. I am using a Duralite 9.9V high current battery system (All voltages are rock solid), the Super Carrier Board regulator generate my 5V logic supply and a 25W variable Dimension Engineering switching regulator (adjusted at 6.85V) power the motors (pin 1 of the controller).

I have been working my test code for some time now, so it became a little bit more complicated than a few test line. However, the potentially problematic section is only the serial commands subroutines. Everything else is just to display data on the LCD and read button.

The complete setup:
DFRobot 4WD chassis (with gear motors)
Parallax Basic Stamp 2p24 MCU
Parallax Super Carrier Board
Parallax Ping sensors with brackets
Parallax serial LCD screen
Robotics connection I/O interface board
Robotics Connection I2C line following sensor
Pololu Low-Voltage Dual Serial Motor Controller
Duralite 9.9V A123 battery

The files attached include a picture of the robot and a test program that displays data on a serial LCD and command the motor controller using buttons.
My program are mostly written in english but data is displayed in french. I can translate it if anybody requires it.

Thank you for your help and I’m sorry for my faulty English.
Dan

EDIT: Attaching files did not work. The picture is here: http://imageshack.us/photo/my-images/11/robotpololu.jpg/

The subroutines I use to set the controller:

Forward:
  SEROUT MCserin, BaudRate, [ $80, 0, 7, 127 ]  'RIGHT
  PAUSE 25
  SEROUT MCserin, BaudRate, [ $80, 0, 5, 127 ]  'LEFT
  RETURN

Brake:
  SEROUT MCserin, BaudRate, [ $80, 0, 7, 0 ] 'RIGHT
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 5, 0 ] 'LEFT
  RETURN

Backward:
  SEROUT MCserin, BaudRate, [ $80, 0, 6, 127 ]  'RIGHT
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 4, 127 ]  'LEFT
RETURN

LeftRotate:
  SEROUT MCserin, BaudRate, [ $80, 0, 7, 100 ]  'RIGHT
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 4, 100 ]  'LEFT
RETURN

RightRotate:
  SEROUT MCserin, BaudRate, [ $80, 0, 6, 100 ]  'RIGHT
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 5, 100 ]  'LEFT
RETURN

And heres the full code, if anyone needs it. (some parts are in French)

' Robot Subroutines

' {$STAMP BS2p}
' {$PBASIC 2.5}


' ----------[ IDENTIFICATION PINS ]----------------------------------------------------------

FollowerSerin                PIN  0
FollowerCLK                  PIN  1
LeftEncoder                  PIN  2
RightEncoder                 PIN  3
MCserin                      PIN  4
MCreset                      PIN  5
RightPing                    PIN  6
CenterPing                   PIN  7
LeftPing                     PIN  8
LCDSerin                     PIN  9
Piezo                        PIN 10
SW1                          PIN 11
SW2                          PIN 12
SW3                          PIN 13
SW4                          PIN 14

' ----------[ CONSTANTES ]-------------------------------------------------------------------

CmConstant            CON 904       ' 2260 for BS2 ; 904 for BS2P
InConstant            CON 356       ' 890 for BS2  ; 356 for BS2P

BaudRate              CON 240       ' Baud Rate: 9600 = [ bs2 = 84 ] [ bs2p = 240 ]

' ----------[ VARIABLES ]--------------------------------------------------------------------

counter               VAR Nib

' ----------[ INITIALISATION ]---------------------------------------------------------------

PAUSE 20

SEROUT LCDSerin, BaudRate, [ 22, 17, 12 ]

PAUSE 5

SEROUT LCDSerin, BaudRate, [ 148, "***INITIALISATION***" ]

GOSUB Brake

GOSUB StartSound

GOSUB ResetDisplay


' ----------[ ROUTINE PRINCIPALE ]-----------------------------------------------------------

DO
  PAUSE 5
  IF SW1 = 0 THEN
    GOSUB ForwardTenSeconds
  ELSEIF SW2 = 0 THEN
    GOSUB BackwardFiveSeconds
  ELSEIF SW3 = 0 THEN
    GOSUB LeftTurn
  ELSEIF SW4 = 0 THEN
    GOSUB RightTurn
  ENDIF
LOOP


' ----------[ SOUS-ROUTINES NAVIGATION ]-----------------------------------------------------

ForwardTenSeconds:
  SEROUT LCDSerin, BaudRate, [ 168, "Marche avant", 188, "  Durée: "]
  GOSUB Forward
  FOR counter = 10 TO 1
    SEROUT LCDSerin, BaudRate, [ 197, DEC counter, " " ]
    PAUSE 1000
  NEXT
  GOSUB Brake
  GOSUB ResetMC
  GOSUB ResetDisplay
  GOSUB EndSound
RETURN

BackwardFiveSeconds:
  SEROUT LCDSerin, BaudRate, [ 168, "Marche arriere", 188, "  Durée: "]
  GOSUB Backward
  FOR counter = 5 TO 1
    SEROUT LCDSerin, BaudRate, [ 197, DEC counter ]
    PAUSE 1000
  NEXT
  GOSUB Brake
  GOSUB ResetMC
  GOSUB ResetDisplay
  GOSUB EndSound
RETURN

LeftTurn:
  SEROUT LCDSerin, BaudRate, [ 168, "Rotation gauche", 188, "  Durée: "]
  GOSUB LeftRotate
  FOR counter = 2 TO 1
    SEROUT LCDSerin, BaudRate, [ 197, DEC counter ]
    PAUSE 1000
  NEXT
  GOSUB Brake
  GOSUB ResetMC
  GOSUB ResetDisplay
  GOSUB EndSound
RETURN

RightTurn:
  SEROUT LCDSerin, BaudRate, [ 168, "Rotation droite", 188, "  Durée: "]
  GOSUB RightRotate
  FOR counter = 2 TO 1
    SEROUT LCDSerin, BaudRate, [ 197, DEC counter ]
    PAUSE 1000
  NEXT
  GOSUB Brake
  GOSUB ResetMC
  GOSUB ResetDisplay
  GOSUB EndSound
RETURN

' ----------[ SOUS-ROUTINES INTERFACE ]------------------------------------------------------



' ----------[ SOUS-ROUTINES MOTEURS ]--------------------------------------------------------

' Toujours  [ $80, 0 puisque 1. start bit et 2. device type

' Pour avoir la valeur du bit 3, multiplier le numero du moteur par 2 et ajouter 1
' si la direction est avant. ( moteur no. 2 et 3).

Forward:
  SEROUT MCserin, BaudRate, [ $80, 0, 7, 127 ]  'DROITE
  PAUSE 25
  SEROUT MCserin, BaudRate, [ $80, 0, 5, 127 ]  'GAUCHE
  RETURN

Brake:
  SEROUT MCserin, BaudRate, [ $80, 0, 7, 0 ] 'DROITE
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 5, 0 ] 'GAUCHE
  RETURN

Backward:
  SEROUT MCserin, BaudRate, [ $80, 0, 6, 127 ]  'DROITE
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 4, 127 ]  'GAUCHE
RETURN

LeftRotate:
  SEROUT MCserin, BaudRate, [ $80, 0, 7, 100 ]  'DROITE
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 4, 100 ]  'GAUCHE
RETURN

RightRotate:
  SEROUT MCserin, BaudRate, [ $80, 0, 6, 100 ]  'DROITE
  PAUSE 2
  SEROUT MCserin, BaudRate, [ $80, 0, 5, 100 ]  'GAUCHE
RETURN



' ----------[ SOUS-ROUTINES CONSTANTES ]-----------------------------------------------------

ResetDisplay:
  SEROUT LCDSerin, BaudRate, [ 12 ]
  PAUSE 10
  SEROUT LCDSerin, BaudRate, [ 128, " |Test des moteurs", 148, " |_________________", 146, "|D", 166, "|G", 186, "|R", 206, "|A" ]
  RETURN

ResetMC:
  LOW MCReset
  PAUSE 2
  HIGH MCReset
  RETURN

StartSound:
  PAUSE 100
  FREQOUT piezo, 566, 796
  FREQOUT piezo, 566, 875
  FREQOUT piezo, 566, 955
  FREQOUT piezo, 566, 849
  FREQOUT piezo, 472, 1000
  PAUSE 200
  RETURN

EndSound:
  PAUSE 250
  FREQOUT piezo, 566, 1000
  FREQOUT piezo, 566, 1000
  FREQOUT piezo, 566, 1000
  RETURN

Hello.

Strange behavior like that is usually indicative of a noise problem. There are various threads here with similar problems, and you should look through those. If you continue having problems after doing basic things to avoid noise problems, you should post some photos that better show the details of your power and wiring setup.

Also, the point of the low-voltage motor controller is to use motors running on a few volts; if you’re trying to get really close to the 7V limit, and going through a regulator, you should just use a higher-voltage controller straight from the battery.

- Jan

Thank you for your answer. I’m sorry for my late reply. Had a few problems with my network.

Well, I have been busy doing some modification to my motor wiring. Before, the 2 motors (Those: http://www.dfrobot.com/index.php?route=product/product&keyword=Geared+motor&category_id=0&description=1&model=1&product_id=100 ) on each side of the robot were serially connected, which caused losses of power. Also, the capacitors (0.1 uF ceramic) on each of the 4 motors were connected from one pin to the chassis (which isn’t connected to anything, rendering them useless). So, I modified the motors to be connected in parallel and soldered the capacitors correctly (soldered to each pins of the motor). It’s kind of difficult to explain so I’ll post a photo of it in the next post.

Anyway, it didn’t changed anything. Same behavior. I checked the ripple with a scope (analog) and… Nearly 2V of ripple on the supply line. Way more on the motor line (I can’t have a clear waveform, or I got 6.5V of ripple…). There is definitely a noise problem.

But still, I don’t understand why the controller can’t turn . I really can’t make one motor turn forward and the other backward. I played a little with the code and all I got is the motors moving less than a millimeter while making a slight sound. I really need help here.

The reason why I can’t use another controller is because Its the only one that can drive these damn motors. I didn’t find any other controller that could drive a motor under 6 volts, while this is my max voltage. Also, the reason I’m using a regulator is because I changed the battery for a more powerful one, but without knowing that it’s voltage easily reached 10V after charging. I didn’t have a multimeter near me when I did this modification, and the controller expectantly exploded when I started it up. So I bought another controller and a regulator to avoid this. Good thing the school paid for it…

Anyway, thanks for the help, I know it’s kind of hard to understand me…

Hello.

I’ll let Jan continue to assist you with your LVSMC noise issues, but I just want to let you know that all of our DC motor controllers will work with 6 V motors, and we have much better options for the motors you linked than the LVSMC (e.g. the qik 2s9v1). It seems like you might be fundamentally misunderstanding how a motor driver works or what the input voltage range specification means. Also, you can likely run your motors at voltages above 6 V, though this can adversely affect the lifetime of the motors.

- Ben

Well, I know this setup is far from perfect (I got a LOT of logistic errors with that project) but I was stuck with a tight budget and little experience at first. And yes, I might be misunderstanding some characteristics of motor controllers, I must admit. What I was searching for these motors was a motor controller able to drive these from 0V to about 6-7V at 3 amps continuous, since these consume so much current (about 400mA each one without load with a 4 Amp peak for all 4) and I got 4 of them. And well, at that time, the only controller available at my local store (Robotshop, I couldn’t order from anywhere else) that met these criteria was the LVDS. If I could restart all this over, I would have done this project quite differently.

EDIT: Wait… I think I missed something… Well, What does the input voltage range specification means? because I guess that is something I really got wrong…

All of our motor controllers are capable of effectively supplying a motor with voltages ranging from 0 V to very close to the controller’s input voltage. They do this by PWMing the input voltage at a duty cycle you can specify. If you are not familiar with the concept of pulse-width modulation (PWM), you can find out more about it here:

en.wikipedia.org/wiki/Pulse-width_modulation

In short, if you want to drive your motors at 3 V and your power supply is 6 V, you would use a 50% duty cycle, meaning that the motor driver output repeatedly cycles between equal periods of on (6 V) and off (0 V), which produces an average motor voltage of 3 V. You could even use a 12 V power supply and just limit your motor controller speeds to 50% or less. LVDSMC is good if you want to control low-voltage, high-current motors like these, which have a recommended operating voltage of 3 V.

Does this make sense?

Also, the motors you linked to have a stall current of 470 mA at 6 V according to their product page. Where are you getting your 4 A peak current from?

- Ben

Well, I understand now… My error was that I misinterpreted the input voltage. I thought that when a MC was rated 6V-30V, It was meant to be driven at 30V with intermediate voltages ranging from 6V… Let’s say that I feel quite dumb. Like you said, I really misinterpreted how a motor controller works…

Anyway, even if this is not the most appropriate controller, I should be able to drive these motors, right? Well, It’s already working, but I can’t make a motor turn reverse while the other is forward. I can do full reverse and full forward (I can do ramping to turn) but it’s not very useful for an autonomous robot.

BTW, I fixed my random behavior problem. Motors are running fine (except for that last condition).

Thank you Ben for pointing out that flaw in my understanding of MC operation!

It should be able to get things working with the LVDSMC, but I need to know more about how you have everything connected. As Jan mentioned in his earlier post, we need a detailed list of your connections, and some pictures of your setup would be helpful.

At the point where you have such clear noise problems, it doesn’t make sense to proceed. You should not expect things to work under conditions like this, so your goal should be to first address the noise. One thing to try is a better power supply. Can you see what happens if you use a 3-cell battery pack?

- Ben

Hi again. I am sorry for the delay, just had the Internet re-plugged in my room after moving.
While I was waiting, I did some programming. I was easily able to do a line following program (which worked better than expected) and a simple obstacle-avoiding program. The motor controller worked perfectly, with the exception of sharp turns, which needs one motor forward and the other backward(And it still doesn’t work). This is the only thing that doesn’t work as expected. The noise doesn’t seem to cause any problems, as there is almost no noise on the motor lines while attempting a sharp turn. The noise is only present on the Motor In-out lines, not on the logic supply which is a completely different circuit. I just wanted to point that out. Also, while using 2 4 amp lab power supplies in parallel (Quite overkill, but anyway…) to power to MC, the same situation occur. I don’t have any other battery I could use, but my actual battery is (supposed to be) for RC planes, which should be able (referring to specs) to power much bigger motors.
I got a Visio diagram of everything electronics on my robot I did for school. Just need to translate it and make a few modifications then I will post it here. Everything should be more clear then.
Also, I’m uploading a bunch of pictures of my robot here right now.
EDIT: Please take note that these pictures are from different steps of my robot construction. There was some change during development especially regarding the power system.

EDIT 2: Attached my block diagram. Finished translating. There is a small error regarding the MCU I/O pinout: I2C line follower pins must be P0 and P1. The optical encoders are now connected to P2-P3.

Thanks for helping me!

Dany
SchémaBlocENG.pdf (319 KB)

Thank you for the pictures of your robot. I’m glad to hear you were able to (mostly) get it working.

I still suspect you have a noise problem (even if you have two completely isolated circuits–and this is not the case with the LVDSMC–one could induce noise in the other).

In general, going from full-speed forward directly to full-speed reverse is rough on a motor and motor controller, as the motor can briefly draw nearly twice its stall current. In such cases, it can be helpful (as you have already discovered), to ramp the speed up over a short period of time. I don’t understand why you say this isn’t useful for an autonomous robot, however. If you have a capable enough microcontroller, you can build the acceleration-limiting into your motor control functions.

When you were using your lab power supplies, what voltage did you have them set to? One thing that worries me is that if you had them set to 6 V and were experiencing 2 V of ripple, you were exceeding (or coming very close to exceeding) the LVDSMC’s 7 V operating voltage limit. I’m interested in finding out if your problems persist at lower voltages (e.g. 3 V).

- Ben

How could I solve this noise problem? Add caps in parallel to the existing ones? (got tons of ceramic 0.1 uF)

This is on my project board. It wasn’t a priority for me as I didn’t used the MC at high speed. But now that you say it, I should spend some time on that…
Also, when I was saying that it wasn’t very useful for an autonomous robot, I was talking about the fact that I couldn’t make the robot spin on itself. I wasn’t very clear…

Uh-oh… Yes, the PS was at 6V. I didn’t know about my noise problems back then (Nearly two months ago, when I received the controller). Well, now I have an adjustable regulator and a good battery, so I’ll do as you say (lower the Vmot to 3V) and do some tests. Didn’t think about this one… Luckily it didn’t explode like the first one!

At least I’m learning quite a bit from my errors!
Thanks!

Dany

Here are some general tips for reducing the effects of motor noise:

pololu.com/docs/0J15/9

It sounds like adding acceleration-limiting to your software might also take care of it (maybe something like taking 100 ms to get from rest to full speed). Note that your robot can still spin in place with such speed ramping. Ideally each motor will take the same amount of time to reach full speed from rest, so your robot will spin in place while gradually ramping up to full-speed rotation.

I’m also hoping that using a lower input voltage will make the problems go away.

- Ben