2MC Communication Protocol

Last modified by Eric Nantel on 2023/03/20 12:53

Using the LSS-2MC Code

Using the LSS-2MC with it's example code will allows the user to control two brushed DC or a single bipolar stepper motor. Being an ongoing project check the available functions bellow.

 Description Action Query ConfigDefault Units Notes
 ID # QIDCID215 / 216none (integer from 0 to 250)Note: ID 254 is a "broadcast" which all servos / modules respond to. 
 Motor Mode QMMCMM 0 / 10 = Stepper Mode / 1 = Brushed DC Mode
 Gyre direction (G)GQGCG11 / -1Gyre / rotation direction: To invert the polarity or direction 
 Baud rate QBCB115200none (integer) 
 Model String QMS LSS-2MC-XX

DBR = HBridge
ST = Stepper

 RESETRESET   NoneSoft reset. See command for details.
 LimpL   NoneMM0 = Stop / MM1 = Coast to a stop
 Halt & HoldH   NoneMM0 = Stop & Hold / MM1 Stop with brake
 Motion Mode Q   0 = Holding / 1 = Stepping / 2 = Speed / 3 = Angle
DC Motor / H-Bridge
 Raw Duty-cycle MoveRDMQRDM 0-255 / 255Set duty-cycle and truncated to 255 if exceeded
Stepper Motor
 Wheel mode in DegreesWDQWD 0°/s-9000 / 9000 in tenths of degs/sec
Identification Number (ID)

Identification number connected to the 2MC Board can be configured via the CID command described below. The factory default ID (as per the sketch loaded at the factory) for all 2MC pins is indicated in the Pin / ID  table above. Since LSS & 2MC devices are intended to be daisy chained, in order to respond differently from one another, the user must set a different ID number for each pin. Devices connected to pins which use the same ID and baud rate will therefore all receive and react to the same commands.

Note: Most people will keep the default ID unless using multiple LSS-2MC on the same communication bus.


Configure ID (CID)

Ex: #215CID200<cr>
This command will change the ID of the H-Bridge connected to pin D9 & D10 from 215 to 200. 

Query ID (QID)

Ex: #215QID<cr> might return *215QID215

Motor Mode (MM)

Our example code allows for two types of motors to be used, either Brushed DC or Stepper. One need to set the mode in which they want to use the LSS-2MC.


Configure Motor Mode (MM)

Ex: #215CMM0<cr> should return *215QMM0<cr>
Configure the LSS-2MC for a single Stepper motor and will use all four outputs on a single ID. (default: 215)

Ex: #215CMM1<cr> should return *215QMM1<cr>
Configure the LSS-2MC for dual Brushed DD motor and will operate on two different IDs. (default: 215 & 216)

Query Motor Mode (QMM)

Ex: #215QMM<cr> might return *215QMM0<cr>
Query the motor mode.

Gyre Rotation Direction (G)
 Ex: #215G-1<cr>
Reverse the polarity / rotation for the given output.
Baud Rate (B)

Since it's intended to be daisy chained with LSS, in order to respond to the same serial bus, all LSS / 2MCs in a project should be set to the same baud rate. Setting different baud rates may create issues. Available baud rates are: 9600 bps, 19200 bps, 38400 bps, 57600 bps, 115.2 kbps, 230.4 kbps, 250.0 kbps, 460.8 kbps, 500.0 kbps. 2MC  Board is shipped with a baud rate set to 115200. 


Configure Baud Rate (CB)

Ex: #215CB9600<cr>
Sending this command will change the baud rate associated of the 2IO associated with ID 207 to 9600 bits per second.

Important Note: the 2MC new baud rate takes effect immediately after sending the CB command.

Query Baud Rate (QB)

Ex: #215QB<cr> might return *207QB115200<cr>
Since the command to query the baud rate must be done at the 2MC's existing baud rate, it can simply be used to confirm the CB configuration command was correctly received.

Query Model String (QMS)

Ex: #215QMS<cr> might return *215QMSLSS-2MC-DBR<cr>
This reply means that the LSS-2MC is in DC Brushed Mode (MM1)

Ex: #215QMS<cr> might return *216QMSLSS-2MC-ST<cr>
This reply means that the LSS-2MC is in Stepper Mode (MM0)

Reset (RESET)

Ex: #215RESET<cr>
This command does a "soft reset" (no power cycle required) and reverts all commands to those stored in EEPROM (default values). This command works with the 2MC IDs (215 & 216 by default) and the broadcast ID (254). 

Limp (L)

Ex: #215L<cr>
This action causes the Stepper or DC Motor to go "limp".

Ex: #254L<cr>
It's possible to use this command as an emergency safety in broadcast.

Halt & Hold (H)

Stepper Mode (MM0)

Ex: #215H<cr>
Motor will stop and hold it's position.


Brushed DC Mode (MM1)

Ex: #215H<cr>
Motor will stop with brake feature.

Motion Mode

Ex: #215Q<cr> might return *215Q0<cr>
This reply means that the LSS-2MC is in Holding mode

0 = Holding
1 = Stepping
2 = Speed
3 = Angle

Raw Duty-cycle Move (RDM)

Ex: #215RDM255<cr>
This will send, in Brushed DC mode (MM1), the output to it's maximum.

Ex: #215RDM-255<cr>
This will send, in Brushed DC mode (MM1), the output to it's maximum but with the polarity reversed from the example above.

Ex: #215QRDM<cr> might return *215QRDM255<cr>
This command queries the raw duty-cycle move value.

Wheel Mode in Degrees (WD)

Ex: #215WD900<cr> 
This command sets the stepper to wheel mode where it will rotate in the desired direction at the selected speed. The example above would have the stepper rotate at 90.0 degrees per second clockwise (assuming factory default configurations).

Created by Eric Nantel on 2022/10/26 07:14
Copyright RobotShop 2018