MCMTII

=MCMTII= Other languages : voir la page en français.

Link to official webpage (in French). MCMTII is an open telescope motor control unit. It uses micro-controllers to command stepper motors. It has a hand controller, a serial (RS232) interface for set-up and control and a SBIG ST-4-compatible interface for autoguiding.

Recent versions of the MCMTII (starting from 2011), which have undergone a few evolutions since MCMTII has been described on the website, only work with Windows and the non-free PRISM software in versions 7 or 8, or the Ascom driver. MCMTII software is developed by Alcor System, so is PRISM. The purpose of this page is to provide resources that will enable the MCMTII to be controlled by free software on other POSIX-compatible operating systems.

The source available from the download page is quite old. Fortunately, the authors have been kind enough to give us the current versions (August 2012). There are two ways to understand the serial protocol for the MCMTII, using source from both sides of the serial link:
 * the source archive for the communication DLL. The archive contains sources of the setup program used to configure the MCMTII, and of the DLL used by PRISM or by the Ascom driver. Here is a local copy of the archive available on the website, version 1.2.3.8. Here is the current version (2012.08) of the DLL, given by the developers. The code is in Delphi language for Windows.
 * the code of the micro-controllers, a single C file, is available on the official download page too, and is actually easier to read than the DLL's code to understand the serial protocol. Here is the local copy of the website's C file (v2.7.1), and Here is the copy of the current version (v2.7.5, August 2012).

Implementing the library for POSIX systems
The obvious choice would be to code a portable (POSIX) C library. However, it must be considered that the right choice is not the obvious choice, but the most useful choice. Is it better to write a library or an API? If it's an API, in what programming language? Software that will be using the library must be studied before starting to write crazy things.

The INDI abstraction layer allows any kind of device to describe its capabilities and allows user-end programs to use devices without knowing about them in the first place. It sound promising. A few classes of standard devices, like telescope or focuser exist and define the basic interface that should be provided by an INDI driver. Obviously, if a device supports more functionalities than the standard interface, the INDI driver can extend it. The Guider Interface will probably be useful too. About the implementation of an INDI driver, a MCMTII library should be used, like what has been done with Ascom.

A software LX200 interface for the MCMTII could be created too. That would make more software compatible with it easily if INDI is not used.

The code of the current implementation is stored on a subversion repository, located at https://free-astro.vinvin.tf/svn/MCMTII/. It is read-only for anonymous users, you need to get an account (contact) to have a write access.

Update April 25th, 2013: first slewing (GoTo) tests on live the real hardware. It works fine when there is no mount flipping involved, with the INDI driver, tested with XEphem and Skychart. The lib detects the flip status from the first synced position and slewing can then be used on the same half-part of the sky.

Update January 5th, 2013: first live test, serial link connection, basic commands (device ready?, version getting, EEPROM content getting, encoder value getting, slewing order, stop slewing order) confirmed to be operational. GoTo fixing for the INDI Telescope Driver is on the way, using the gathered data.

Update December 2012: a C library has been made to control the MCMTII, called libmcmtii. It supports GoTo and guiding, virtual hand-controller operation, getting and displaying the EEPROM data, getting the version, changing the current guiding speed. It does not support any writing to the EEPROM, using the MCMTII's periodic error correction. Code is on the SVN base.

An INDI Telescope driver has been made for the MCMTII, using libmcmtii. Skychart and XEphem have been tested offline and are able to use the telescope. Code is on the SVN base.

Use in existing GoTo software
Stellarium can interact with mounts in two ways, and for only two functionalities: send GoTo and receive current position. The first way is to establish a direct serial link with the mount, in which case it needs to have a file in the Telescope control plug-in that creates the connection and interacts with the mount. The second way is to use a standalone server that communicates with Stellarium with a simple protocol. In both cases, the code is C++, and a library giving access to MCMTII would be a good start. There is no INDI support in Stellarium.

Cartes du Ciel (skychart), XEphem and KStars use INDI to communicate with the telescopes. There are two issues regarding the default Telescope driver interface: there is no "allow flip" property, or any other flip control way, and the coordinates are given in absolute RA/DEC which need to get converted to local HA/DEC values. A property could be added to control the flip, or the flip can be done automatically on GoTo and not on guiding for example.

XEphem configuration: see the nice documentation. The strings to enter in the configuration window's goto and marker lines are  and.

Skychart configuration: put the telescope type to "MCMTII Telescope" in the telescope settings window (and INDI driver interface).

Use in existing Autoguiding software
See the full list of autoguiding software. To sum up, nothing is really working fine right now on Linux for amateur telescope autoguiding.

GoQat establishes a direct serial link with the mount (only the Losmandy Gemini) and opens the camera with the V4L2 or Unicap API. INDI support may be coming soon, for cameras to begin with. Adding support for a new mount will be complicated because lots of things are based on the capabilities of the Gemini mount. Code is C.

OpenPHD Guiding mainly uses INDI to communicate with the telescopic mount and the camera. It also supports V4L2 natively for the camera, but there does not seem to be a native alternative for mounts supported in POSIX systems. Code is C, with a bit of C++.

It should be noted that simply displaying the guiding camera image in VGA format and detecting a star in it already eats 95% CPU in OpenPHD Guiding (because it stacks frames for long exposures if the camera does not support it) and 60% in GoQat, with an AMD64 2.0GHz CPU).

RS232 protocol
The protocol for the serial link is quite simple, based on request-response exchanges.

The first byte is the axis identifier, because there are two micro-controllers in the MCMTII, one for the right-ascension and one for the declination axis. is `E0' for alpha axis (right ascension), `E1' for delta axis (declination). In the request and response fields of the tables below, values or identifiers represent bytes, and they are separated by commas. PIC is big-endian; most data listed in the requests or replies 2- (or more) byte long must be converted if the computer is little-endian (Intel). Numbers below are in hexadecimal, characters enclosed in quotes mean that's the ASCII value, as in many programming languages. Comments are between parentheses.

There are two main modes of operation of the MCMTII: the guiding mode and the slewing mode. Additionally, there are some specific modes such as the EEPROM update mode and the parking mode, not yet documented here.
 * when guiding, the main task is to provide a constant motor rotation rate. It gives priority to the clocks and backgrounds the processing of the serial link. All commands are replied with an ACK even if they are not processed correctly.
 * when slewing, the main task is to provide an accurate positioning. It gives priority to steps counting. Only 2-byte serial commands, with the heavyweight bit high (non-ASCII commands), are processed as interruptions. The list of these commands is just below. During the slewing, a specific timer is used to adjust the number of steps to move to, as function of the time spent to slew. Slewing mode is entered when medium or max speed are used (by physical or virtual hand controller or 'p' command).
 * when flashing the EEPROM, commands are 16 bytes long.

Below is the table of the three non-ASCII, 2-byte, interrupting commands.

ASCII commands, 8 bytes, non-interrupting, are structured as follows.

The 5 bytes composed of the identifier and the 4 data bytes are those listed in the tables below. The identifier is the ASCII value of a letter, which are always lower than 7F and thus don't throw interrupts. The 4 data bytes are cut to 7 bit values to prevent interruptions, a 5th byte is added and contains the heavyweight-bit value for these 4 bytes. The last byte is a checksum. Below are lists of ASCII commands, separated in three categories: the list of usual runtime commands, the list of periodic error correction commands, and the list of setup commands.

Bytes from the response buffer are referenced as {i} where i is the ith byte. KING refers to a method for refraction compensation by offsetting the telescope pointing. from SomeFunction indicates in what function of the DLL the command is used.

ASCII commands for periodic error correction (PEC)
The commands listed below are used when the internal PEC is used. In most cases (in PRISM for example), this code is not used, and the PEC is managed on the computer side by software changing the current guiding speed periodically (see the 'R' command above). The MCMTII's internal PEC records the changes of guiding speed and replays them when activated.

ASCII commands for telescope setup
For save setup, ('L' command), there are two bytes read  (decimal values), else, only one. See code of procedure  in Setup.pas (from the DLL code) or better, the defines at the beginning of the C code of the microcontroller. Speeds, power, precisions and corrections are set using these commands.

EEPROM content