Troubles with dual serial motor controller

heya,
I have a dual serial motor controller, SMC01A, which I just got today. Unfortunately, I can’t seem to get it to work. I have it hooked up to my arduino, I think correctly, and am powering it with either a 6v 4xAA pack or a 12v 8xAA pack and with either battery, my motor twitches when it gets a command to change direction, but otherwise does not run.
I hooked up my multimeter to the motor outputs, and it only registers maybe 3-4 mV, which is probably just electrical noise if anything. I don’t have an oscilloscope.
is my motor controller just dead or what?
I bought it pre-assembled, but I did have to solder on the connector, which I thought I did a decent job on, but who freaking knows…
I did not remove the IC’s from their csockets when I soldered them, could that have fried them?
any help is appreciated…

Hello,

The soldering you described shouldn’t cause any damage to the ICs. Getting the motor to twitch is a good start; that it does not keep turning could be indicative of several problems, including electrical noise, the motor being too big for the controller, and bad code. What kind of motor are you using? Can you post pictures and (the relevant parts of) your code?

- Jan

hey Jan, Thanks for responding. I am using RM3 motors which I ordered from you guys, which have been put into a tamiya 70097 gearbox in place of the stock FA-130 motors. I am powering it as I mentioned above, I tried with both a 12v and 6v pack. I tried sticking a 10uF cap(all I had…I think people usually used 0.1uF for this?) across the power leads between the battery pack and motor controller but it didn’t seem to do anything. I will try to post some pictures when i get home, but here is the test code for my arduino I was trying to run. This is borrowed from a guy on letsmakerobots.com, the only difference between my setup and his as far as I know is that he was using the MICRO dual serial motor controller, though I believed they were a compatible serial protocol.

#include <softwareserial.h>

#define LEFT_MOTOR  2
#define RIGHT_MOTOR 3

#define FORWARD 1
#define REVERSE 0


byte motor_controller_pin = 3;
byte motor_controller_reset_pin = 4;

// for rx on all unidirectional software serial objects
byte unused_pin = 10;


unsigned char mc_command[4];

SoftwareSerial motor_controller = SoftwareSerial(unused_pin, motor_controller_pin);


//==========================================================================================

void setup()
{
   pinMode(motor_controller_pin, OUTPUT);
   pinMode(motor_controller_reset_pin, OUTPUT);
   pinMode(unused_pin, INPUT);

   motor_controller.begin(9600);

   mc_init();
}

//==========================================================================================

void loop()
{
   // accelerate forward
   for(int i = 0; i <= 130; i += 10)
   {  
      mc_send_command(LEFT_MOTOR, FORWARD, i);
      mc_send_command(RIGHT_MOTOR, FORWARD, i);

      delay(250);
   }

   delay(3000);

   // decelerate
   for(int i = 130; i >= 0; i -= 10)
   {
      mc_send_command(LEFT_MOTOR, FORWARD, i);
      mc_send_command(RIGHT_MOTOR, FORWARD, i);

      delay(250);
   }

   delay(3000);

   // accelerate backward
   for(int i = 0; i <= 130; i += 10)
   {
      mc_send_command(LEFT_MOTOR, REVERSE, i);
      mc_send_command(RIGHT_MOTOR, REVERSE, i);

      delay(250);
   }

   delay(3000);

   // decelerate
   for(int i = 130; i >= 0; i -= 10)
   {
      mc_send_command(LEFT_MOTOR, REVERSE, i);
      mc_send_command(RIGHT_MOTOR, REVERSE, i);

      delay(250);
   }

   delay(3000);
}


//==========================================================================================


void mc_init()
{
   // start up motor controller
   digitalWrite(motor_controller_reset_pin, HIGH);

   // let motor controller wake up
   delay(100);
}


void mc_send_command(byte motor, byte direction, byte speed)
{
   direction = constrain(direction, 0,   1);
   speed     = constrain(speed,   0, 127);

   mc_command[0] = 0x80; // start byte
   mc_command[1] = 0x00; // Device type byte
   mc_command[2] = (2 * motor) + (direction == FORWARD ? FORWARD : REVERSE); // Motor number and direction byte
   mc_command[3] = speed; // Motor speed (0 to 127)

   // send data
   for(int i = 0; i < 4; i++)
   { motor_controller.print(mc_command[i], BYTE); }
}

Well, that sounds like it should generally work. The motor controller already has a 100 uF cap on the power input, so the 10 uF probably isn’t doing much there. You really should get the 0.1 uF caps on the motors, though, and 12 V is pretty high for them. What does the rest of your circuit look like? Also, you might simplify your program to send just once command to the motor controller so you can better narrow down what the problem might be.

- Jan

I had tried simplifying it to just send 127 to both motor outputs, but it did even less than the code i posted.

This is my setup, drawn for clarity in MS paint

and here is a photo, the 6v power is connected through the breadboard, and I had stuck the cap across the power rail at the top.

at this point i’m thinkin it’s dead :frowning: . I’m stumped anyway. This should work, and it just doesn’t…
Is it possible to return/exchange it??

It looks like you don’t have ground connected between the boards, which definitely shouldn’t work. You can see the connection in the user’s guide drawing:

(Your 9V battery would be lumped in with the green robot controller box.)

- Jan

OK I connected the ground from the arduino’s ground to the ground on the breadboard for the motor controller supply.

Now if the code just tries to set the motor speeds to 127 in the loop it just appears to run the first time when the arduino starts up. After that it just sits there and does nothing, though the loop continues to run(I have it switching on and off an LED on each run)

If the code sends 127 at setup, and then nothing in the loop, it runs for maybe 30-40 seconds, then stops…

If the code does the whole accelerate, decelerate, reverse thing, it appears to initially accelerate, then stops and does nothing else. (code as in previous post)

If I tap the reset button on the controller it will again run for a few seconds, occasionally making it through the loop routine twice, but no more than that yet. The arduino itself appears to keep running normally.

All versions of this code are using the same mc_send_command routine as above.
It’s doing more, which is encouraging, but still not what i’d hoped.
I’m still trying some different things with the code, not sure how to get it to be more responsive, that is, to be able to repeatedly set the motor speed differently and have it not stop responding after the first loop…
I will keep updating this post as I figure out more today, I will also try to get some 0.1 uF caps to put across the motor leads, as now since I finally hooked it up right, it appears to be locking up after starting, so I’m gonna try to eliminate any noise from the motors…
Jan, thanks very much for your help so far, I didn’t spot that, I just thought ground was ground, didn’t know they had to be connected actually. Why is that anyway? In any case, thanks again, and if you have any further suggestions to help me get this running smoother they are greatly appreciated!!

At this point, you’re probably down to noise problems. If you have simple code from someone else that they claim works and it sometimes works and sometimes doesn’t for you, it’s quite likely that it’s a hardware issue, such as noise. You really need those caps on the motors, and you should get that ground connection more direct than through the breadboard.

Ground is not at all some absolute, magical spot or value; it’s usually just what you call 0V. (If you physically ground a node on your circuit, it would probably be a bad idea to call some other node ground.) Consider a 1.5V battery: all it promises is that one end will have a voltage 1.5V higher than the other. You can consider the negative terminal to be ground (0V) and the positive terminal to be 1.5V, or you can consider the positive terminal to be ground and the negative terminal -1.5V. When you put two identical cells in series, you have three nodes. You can call them ground, 1.5V, and 3V; -.1.5V, ground, and 1.5V; or -3V, -1.5V, and ground.

The I/O lines on your Arduino board are the same in that though they have a predefined ground, the rest of the world can’t tell from just looking at just the I/O line. The motor controller input line has some place it tends to be relative to the motor controller ground (e.g. 2.5V), and when you connect your output to them, that node you create will remain at 2.5V. So, although you’re trying to set the line to 0 or 5V, as far as the motor controller is concerned, the line is at 2.5V and the node you’re calling ground (that it doesn’t know about) is moving between 2.5V (when you’re trying to set the pin low) and -2.5V (when you’re trying to set the pin high–since the pin is still at 2.5V and it’s 5V above ground).

Only by connecting the grounds of the two sides can you forcibly move the motor controller input around. If the ground connection is perfect, the input will want to make the node 2.5V, and the Arduino will want to make it 5V, and the Arduino will win because it’s an output (low impedance) that can deliver the current to change the value at the (high impedance) input on the motor controller.

I mentioned the thing about a perfect connection because in real life, it won’t be, so you’ll have different voltages on the two ends of the wire you’re using to connect the grounds. If you call the Arduino side 0V, you might get 0.1V on the motor controller side; the control signal will similarly be 5V on one end and 4.9V on the other. To the motor controller, that looks like 4.8V on its input, which is safely above its threshold to consider a pin high.

Did that help?

- Jan

I have soldered 0.1 uf caps across the motor leads, but I still get the same behavior. Do you have any more ideas how I can reduce the noise, because it is apparently still an issue…
THanks,
-buhatkj

The main other thing is to improve the wiring. Did you get the breadboard out of the picture? You should keep your power wires short and the relevant pairs twisted together. I guess I also don’t fully trust the connection you have from your wires plugged into the connectors. They’re made for square posts, so you might be better off soldering your wires onto those.

- Jan