Dagu Rover 5 + TReX Jr Dual Motor Controller DMC02

Hi everyone,

I bought a dagu rover 5 Tracked Chassis with TReX Jr Dual Motor Controller DMC02.

I want to communicate with the motor controller in serial mode. I bought a USB to TTL cable. This one : adafruit.com/product/954

I connected the battery and my USB cable and evrything looks fine :

I install USB driver on my laptop, my COM seems to be well installed but when i send command in HEX format i only receive echo, and the pololu TRex Configurator tool can’t connect to the TRex, the message is : Could not detect a TRex motor controler on port COM4.

The LED FeedBack are correct, the Blue for power and the RED for Serial are turn ON. I do not know what I 've missed, any ideas ?

Sorry for my English :slight_smile:

I sorry for new post but i found the solution.

If I used “TReXConfigurator_1_0_0_5.application” instead of “TReXConfigurator.application” everything works fine.

I have one more question. Do you any C API to control the motor. With methods like moveForward(10) which will connect to the network, set an accelaration and send it ?


I am glad you figured out the problem. Thanks for letting us know.

We do not have a C API.

- Grant

Ok thanks for the answer, so i try to write something simple to send command in C but i don’t have any result.

I tried to set an acceleration with this code :

[code]#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <errno.h>
#include <stdio.h>
#include <termios.h>
#include <fcntl.h>

#define BAUD B19200

float _targetSpeed;
int _targetAngle;
float _targetDistance;
float _currentDistance;
int _isParked;
int fd = 0;
int w = 0;
char err[100];
struct termios settings;

void main()

	/* Config port settings*/
	fd = open("/dev/ttyUSB0",O_RDWR);// | O_NOCTTY | O_NDELAY
	if(fd < 0)
		perror("open port: Unable to open ttyUSB0 --- \n");
		strcpy(err,"open port: Unable to open ttyUSB0 --- \n");
	{  printf("Open Success\n");
	tcgetattr(fd, &settings);

	cfsetospeed(&settings, BAUD); /* baud rate */
	settings.c_cflag &= PARENB; /* no parity */
	settings.c_cflag &= CSTOPB; /* 1 stop bit */
	settings.c_cflag &= CSIZE;
	settings.c_cflag |= CS8 | CLOCAL; /* 8 bits */
	//settings.c_lflag = ICANON; /* canonical mode */
	//settings.c_oflag &= OPOST; /* raw output */
	tcsetattr(fd, TCSANOW, &settings); /* apply the settings */
	tcflush(fd, TCOFLUSH);
	int var;
	var = 0x83;
	w = write (fd,"0xC5",2); //Accelerate motor 1
	printf("Sent w = %d", w);
            w = write (fd,"0x7F",2); //Accelerate motor 1

	//char buf [100];
	//int n = read (fd, buf, sizeof buf);
	//printf("A recu w = %d", n);


I see that the green led turn on when packet are received and w = 2 but nothing append for the acceleration. I have try without “” and using &var, Any ideas ?


It looks like you are sending ASCII data instead of sending binary bytes, and that you have the number of bytes incorrectly set to 2. Instead of trying to send something like this:

You should write the byte like this:

Also, it looks like you might be using the &= operator in a way is not appropriate. You should take a look at the equivalent code in this C code example, and use it as a starting point for writing your own code.

- Grant