Controlling the ComXim Programmable Electric Turntable: A Guide Using COM Port and C#

The ComXim programmable electric turntable is straightforward to control. It offers a comprehensive command set for various control functions, including angle control, speed control, action control, and combined behavior control. Additionally, the turntable sends feedback to the control device upon completing specified actions.
Connection and Command Basics
Regardless of whether you connect via USB (which creates a COM port in the operating system after driver installation), Bluetooth, or WiFi, the control commands remain the same. The primary difference lies in the connection process. Once connected, the programming and control commands are identical.
Here’s how you can use COM port communication to control the turntable, with examples using C# and Visual Studio:
Steps to Control the Turntable Using COM Port
1. Create a Project in Visual Studio
- Open Visual Studio.
- Create a new project:
- Go to File > New > Project.
- Select Windows Forms App (.NET Framework) or Console App (.NET Framework), based on your preference.
- Name your project and click Create.
2. Add and Configure SerialPort
- In the Solution Explorer, right-click on your project and select Add > New Item.
- Choose SerialPort from the available components. This will add a
SerialPortcomponent to your project, namedserialPort1by default. - Configure the serial port properties:
- BaudRate:
115200 - Parity:
None - DataBits:
8(default) - StopBits:
One(default) - HandShake:
None
- BaudRate:
3. Open the Serial Port
Add the following code to open the serial port and handle exceptions:
using System;
using System.IO.Ports;
using System.Windows.Forms;
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
// Configure the serial port
serialPort1.BaudRate = 115200;
serialPort1.Parity = Parity.None;
serialPort1.DataBits = 8;
serialPort1.StopBits = StopBits.One;
serialPort1.Handshake = Handshake.None;
// Open the serial port
try
{
serialPort1.Open();
MessageBox.Show("Serial port opened successfully.");
}
catch (Exception ex)
{
MessageBox.Show("Error opening serial port: " + ex.Message);
}
}
}
4. Send Commands to Control the Turntable
To send a command to the turntable, use the Write method of the SerialPort class. For example:
private void SendCommand(string command)
{
if (serialPort1.IsOpen)
{
try
{
serialPort1.Write(command);
MessageBox.Show("Command sent: " + command);
}
catch (Exception ex)
{
MessageBox.Show("Error sending command: " + ex.Message);
}
}
else
{
MessageBox.Show("Serial port is not open.");
}
}
private void buttonSendCommand_Click(object sender, EventArgs e)
{
SendCommand("CT+START(1,1,1,90,3,4);");
}
Command String Examples
Example 1: Command to Rotate Right
- Command:
CT+START(1,1,1,90,3,4);- Direction:
1(Right/Counterclockwise) - Turn Mode:
1(Intermittent Rotation) - Angle:
90degrees - Pause Time:
3seconds after each 90-degree rotation - Times:
4rotations - Shutter Control:
1(Trigger the shutter to take a photo after each pause)
- Direction:
Explanation: This command sets the turntable to rotate right by 90 degrees, pause for 3 seconds, repeat this action 4 times, and trigger the shutter each time after pausing.
Example 2: Command to Rotate Left
- Command:
CT+START(0,1,1,90,3,4);- Direction:
0(Left/Clockwise) - Turn Mode:
1(Intermittent Rotation) - Angle:
90degrees - Pause Time:
3seconds after each 90-degree rotation - Times:
4rotations - Shutter Control:
1(Trigger the shutter to take a photo after each pause)
- Direction:
Explanation: This command sets the turntable to rotate left by 90 degrees, pause for 3 seconds, repeat this action 4 times, and trigger the shutter each time after pausing.
By following these steps, you can effectively control the ComXim programmable electric turntable using COM port communication in C# and Visual Studio.