MBL1330 Arduino Serial Connection

5 years 9 months ago #29532956 by phanter
Hey there

I read a few threads here and tried their solutions. But i also have problems to get it work. I want to control the MBL1330 with an Arduino Mega.
But i don't get it working.
It seems, that the controller doesn't recognize any signal.
I used the wiring explained in the datasheets(Roboteq_controller_userman_v17, Chapter: Connecting to Arduino and other TTL Serial Microcomputers)

I checked the outgoing signal from my arduino with my oscilloscope. I see a clearly signal at the end of my wires.(Inverted, 0: 5V, 1: 0V)
In the roborun utility I disabled the watchdog and set the connection to an inverted 115200 baud rate. I also did some modification to the configurations, like the pole pair and max speed.

I can control the motor perfectly using the roborun utility. But when i try it via the arduino... no chance. I don't get response from the controller.
I started with a small example, posted a few times in this forum.
void setup() {
  // put your setup code here, to run once:

  Serial.begin(115200);  //set serial baud to 115200 bps

  Serial.println("^rwd 1 0"); //disable motor controller serial watchdog
}

void loop() {
  // put your main code here, to run repeatedly:
  delay(5000); //hold 5 sec
  Serial.println("!G 1 500"); //forward @ 50% power
  delay(5000); //run for 5 sec
  Serial.println("!G 1 0"); //stop
}

Also a more complex one:
#include "Arduino.h"
#include "Wire.h"
#include "Stream.h"

//The setup function is called once at startup of the sketch

String inputString; // a string to hold incoming data
String echo;
boolean stringComplete = false;

void setup()
{
	// put your setup code here, to run once:
	Serial.begin(9600);
	Serial1.begin(115200);  //set serial baud to 115200 bps
	inputString.reserve(128);
	stringComplete = false;

	 Serial1.println("^rwd 1 0"); //disable motor controller watchdog
	Serial.println("Setup done");
}

void loop()
{
	Serial.println("Loop begin");
	// put your main code here, to run repeatedly:
	delay(5000); //hold 5 sec
	Serial1.println("!G 500"); //forward
	echo = Serial1.readString();
	Serial.println(echo);
	delay(5000); //run for 5 sec
	Serial1.println("!G 0"); //stop
	echo = Serial1.readString();
	Serial.println(echo);

	// I use arduino Mega, Serial1 to connect to the RoboteQ and Serial to see the results on the Serial Monitor of the Arduino IDE
	Serial1.println("?A"); // Here I am requesting some telemetry elements to the roboteq and I am using Serial1 on arduino Mega
	unsigned long recTime = millis(); // Here I am starting to compose the incoming string
	while (Serial1.available() > 0 || millis() - recTime < 50)
	{
		char inChar = (char) Serial1.read();     // get the new byte:
		inputString += inChar;
		if (inputString.indexOf("A=") < inputString.lastIndexOf('\r'))
			stringComplete = true;
	}

if(stringComplete)
{
	Serial.println(inputString); // Print entire string from controller on the Serial Monitor of your IDE

}

}

But I still had no luck to get the motor running or get any feedback.

It seems there is a problem, that the controller doesn't understand the commands getting from the arduino.

Maybe i missed something... but by now i don't have any idea's anymore.

I would appreciate a hint or advice!

Thanks in advance
David
Attachments:

Please Log in or Create an account to join the conversation.

5 years 9 months ago #29532975 by phanter
Nobody has an idea for me? :(

Please Log in or Create an account to join the conversation.

5 years 9 months ago #29532978 by blake
Sorry for the late reply.

You will not in the description of that wiring diagram that you've used that it is only compatible with specific motor controllers. This wiring will not work with the MBL1330. To connect the MBL1330 to your Arduino you will need to use an RS232 - TTL adapter. We offer one on our website that we can confirm works perfectly well:

dev.roboteq.com/dev1/index.php/component...r-detail?Itemid=1154

Please Log in or Create an account to join the conversation.

5 years 9 months ago #29532982 by phanter
Ohhhh noo. So many hours lost, I spent to get running it with this configuration.

Thanks for that advice. I hope ,it will work with this adapter.

Please Log in or Create an account to join the conversation.

3 years 7 months ago #29534735 by giantpt
Hi phantom... any luck with it?

Please Log in or Create an account to join the conversation.

Moderators: tonysantoni
Time to create page: 0.076 seconds