I am having a problem with the TREX Dual Motor Controller DMC01. I am connecting to it via a Raspberry Pi serial connection and running Node JS on the Raspberry Pi.
I can set the motors to move forward and backwards using the serial commands 0xC0 to 0xC3 for motor 1, 0xC8 to 0xCB for motor 2. However, I cannot make it accelerate instead using the 0xC4-0xC7, 0xCC-0xCF commands. When I try these commands, it doesn’t seem to do anything.
Using the motor setting speed means the vehicle jumps forward and flips over backwards; I need it to accelerate more gently.
I am using the compact protocol.
To move forward, the following code works after establishing the serial connection:
serialConnection.write("0xC2"); serialConnection.write("0x30"); serialConnection.write("0xCA"); serialConnection.write("0x30");
This moves both motors forward. The data byte doesn’t seem to work properly in that the speed doesn’t change when I change the value, but there is no movement if I don’t include.
If I try a similar set of commands with accelerate instead, it doesn’t work, even if I set it to max speed.
serialConnection.write("0xC6"); serialConnection.write("0x7F"); serialConnection.write("0xCE"); serialConnection.write("0x7F");
This should set an acceleration, but the motors never move.
Furthermore, I’m having difficulties setting the acceleration parameters. I give the command to set them, but there is no change. For example, for motor one to set the acceleration to 20:
0xAF 0x0E 0x20
Any help would be appreciated. Thanks very much!