Simple Motor Controller 18V7 + mega2560 +Motor

Hello.
My current setup:
Simple Motor Controller 18V7 (Tx to the Rx in the arduino)
Arduino mega2560
Motor and 9V batteries

1: I tried different method tests but the DC motor doesn’t move.
2: After installing Windows drivers and software, The command port for the controller didn’t appear in the Ports list in the computer’s Device Manager.(also i tried different USB port and restart computer).
3: I have a question why the error LED light on when I connect the anode battery to the GND on the controller ?
When I first weld the condenser backwards to errors with the controller bard pololu 18V7, it running heated up.Then I put it to the right position. I am afraid that it is the reason why it doesn’t work.

Hello.

If you connected the capacitor backwards, then turned it around so it was connected correctly, the capacitor might be damaged and could be causing a problem (possibly a short). Could you post some pictures of both sides of the board? Also, could you try removing the capacitor and connecting just the Simple Motor Controller to your computer via USB (with nothing else connected to it)?

If the Simple Motor Controller is still not showing up in your Device Manager, could you try using a different USB port on your computer? If that does not work, could you try using a different USB cable?

-Brandon

Thank you for your answer!!
I have sloved that problem and it runs well using the Pololu Simple Motor control center. but when i used the mega2560 to control the motor through the SMC, the motor failed running. The code I used is the manual provided and I am sure that the wires tied rightly. I really want to know the reason !

I am glad you solved the first problem you were having. Could you post pictures of your setup that show all of your connections? Could you be more specific about which code you are using (e.g. post the code here or link to it directly)? Also, could you post your Simple Motor Controller settings file? You can save your settings file by selecting the “Save Settings File…” option from the “File” menu within the Simple Motor Control Center (with the controller connected via USB).

-Brandon

Thanks for your reply!
I tried these codes respectively which pasted blow:the first one is from the manul and the other is what I have to test.

[code]#include <SoftwareSerial.h>
#define rxPin 3 // pin 3 connects to SMC TX (not used in this example)
#define txPin 18 // pin 18 connects to SMC RX
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

// required to allow motors to move
// must be called when controller restarts and after any error
void exitSafeStart()
{
mySerial.print(0x83, BYTE);
}

// speed should be a number from -3200 to 3200
void setMotorSpeed(int speed)
{
if (speed < 0)
{
mySerial.print(0x86, BYTE); // motor reverse command
speed = -speed; // make speed positive
}
else
{
mySerial.print(0x85, BYTE); // motor forward command
}
mySerial.print((unsigned char)(speed & 0x1F), BYTE);
mySerial.print((unsigned char)(speed >> 5), BYTE);
}

void setup()
{
// initialize software serial object with baud rate of 38.4 kbps
mySerial.begin(38400);

// the Simple Motor Controller must be running for at least 1 ms
// before we try to send serial data, so we delay here for 5 ms
delay(5);

// if the Simple Motor Controller has automatic baud detection
// enabled, we first need to send it the byte 0xAA (170 in decimal)
// so that it can learn the baud rate
mySerial.print(0xAA, BYTE); // send baud-indicator byte

// next we need to send the Exit Safe Start command, which
// clears the safe-start violation and lets the motor run
exitSafeStart(); // clear the safe-start violation and let the motor run
}

void loop()
{
setMotorSpeed(3200); // full-speed forward
delay(1000);
setMotorSpeed(-3200); // full-speed reverse
delay(1000);
}

[/code]

[code]void setup()
{
// initialize software serial object with baud rate of 38.4 kbps
Serial1.begin(38400);
// the Simple Motor Controller must be running for at least 1 ms
// before we try to send serial data, so we delay here for 5 ms
delay(5);
// if the Simple Motor Controller has automatic baud detection
// enabled, we first need to send it the byte 0xAA (170 in decimal)
// so that it can learn the baud rate
Serial1.print(0xAA, BYTE);
// next we need to send the Exit Safe Start command, which
// clears the safe-start violation and lets the motor run
exitSafeStart();
}

void loop()
{
setMotorSpeed(3200); // full speed is 3200
delay(1000);
setMotorSpeed(-3200); // full speed is 3200
delay(1000);
}
// required to allow motors to move
// must be called when controller restarts and after any error
void exitSafeStart()
{
Serial1.print(0x83, BYTE);
}

// speed should be a number from -3200 to 3200
void setMotorSpeed(int speed)
{
if (speed < 0)
{
Serial1.print(0x86, BYTE); // motor reverse command
speed = -speed; // make speed positive
}
else
{
Serial1.print(0x85, BYTE); // motor forward command
}
Serial1.print((unsigned char)(speed & 0x1F), BYTE);
Serial1.print((unsigned char)(speed >> 5), BYTE);
}
-------------------------------------------------------------[/code]
all of these are all failed to control the motor. waiting for your answer!

Hello again!



This is the configuration of the circuit which I used.
This first step I adjusted it in the Pololu simple motor control center which is shown in the picture blow. The motor runs well.


The next step I unpluged the mini USB and then downloaded the code to arduino. but the motor has no response.


I also tried to changing the wires but no progress. thanks again.

-Luman

It looks like your code is slightly different from the “Simple Example” Arduino code found in the “Arduino Examples” section of the Simple Motor Control user’s guide. The example codes uses Serial.write to send bytes containing the raw value, whereas your code uses Serial.print, which sends readable ASCII text. Could you try replacing your Serial.print commands with Serial.write?

By the way, I noticed you are using a 9V battery for your motor power supply; we generally do not recommend 9V batteries for motor applications, since they cannot source much current.

-Brandon

Thank you very much.
I changed the code(code example) and tried again but it still not worked.
by the way, could I use the 12V battery as a power supply?

-Luman

I modified your first code to use write instead of print and tested it with an Arduino Uno, and it worked for me (I also changed the pin used for TX so that it will work with an Arduino Uno). Could you post the code you tried after you changed it? Also, could you post your Simple Motor Controller settings file? As I mentioned in one of my previous posts, you can save the settings file by selecting the “Save Settings File…” option from the “File” menu within the Simple Motor Control Center (with the controller connected via USB).

-Brandon

Hello again~
I used the arduino uno board with tx pin plugin rx pin in the SMcontroller and at that time, the yellow status LED give off a brief flash once per second. the setting file and the code posted on below. thank you very much!

smc_settings.txt (2.96 KB)