Linux Quickstart#

Prerequisites#

  1. Verify that the USB Controller is listed as an available serial device:

    • Run the command $ dmesg | grep FTDI and you should see something like FTDI USB Serial Device converter now attached to ttyUSB0. This means that the device is accessible at /dev/ttyUSB0.

      (You can also run the command ls -l /dev/serial/by-id to get the ttyUSB number.)

  2. Verify permissions to access the USB Controller

    • Check permissions on the device, for example $ ls -l /dev/ttyUSB0. If the permissions are rw-rw-rw-, then it means all users have access and you can skip to the installation steps.

    • If you do not have access to the device, there are two ways you can gain access to it.

    • (Permanent) You can add yourself to the group that does have access (typically ‘dialout’) by running the following. This will persist across reboots.
      • $ sudo usermod -a -G dialout $USER

      • $ sudo reboot (This will reboot your machine)

    • (One-time) You can give permissions to all users for this session. This will reset on reboot.
      • $ sudo chmod 666 /dev/ttyUSB0

  3. Install CMake if necessary. It is used to build the library and applications

    • $ sudo apt-get install cmake

  4. Install OpenCV (OpenCV is used for application windowing)

    • $ sudo apt-get install libopencv-dev

Contents#

  1. The Mirrorcle Software Suite - Linux is typically provided as a USB flash drive or FTP download link and contains a folder with all applications and SDKs. It is recommended to extract this to the ~/MirrorcleTech/ directory.

  2. ~/MirrorcleTech/bin/ contains the Applications,
    • MTIDevice-Demo - demonstrates a variety of ways to drive MEMS mirrors in point to point, scanning, rastering, and other modes.

    • MTILinearRaster - controls the two axes (tip and tilt) of a MEMS mirror in a laser-beam steering system to deflect the laser beam in a line by line raster patter optimal for laser marking, bio-medical imaging and similar applications.

    • MirrorcleListDevices - a small tool to scan the ports for MTI devices. It will report any Mirrorcle MEMS Controllers available for connection whether by USB connection or wireless (Bluetooth) and their respective COM ports.

  3. ~/MirrorcleTech/SDK-Linux/ contains the C++ Linux SDK with example projects
    • Debug/ pre-built CMake folder to re-compile and run the application from. Typing $ make in this folder will rebuild the application (based on the src/ directory)

    • src/ contains source files of the MTIDevice-Demo application as well as the CMakeLists for the project

    • lib/ contains the debug and release MTIDevice libraries (“_d” denotes debug)

    • include/ contains all needed header files

    • data/ contains resources required by the MTIDevice-Demo application. Note that the mtidevice.ini file in this folder should be changed to reflect the recommended device parameters for the device in use.

Running the Provided Demos#

Run the compiled executable from ~/MirrorcleTech/SDK-Linux/bin/

  1. From ~/MirrorcleTech/SDK-Linux/bin/

    • $ ./MTIDevice-Demo for MTIDevice-Demo

    • $ ./MTILinearRaster for MTILinearRaster

    • $ ./MirrorcleListDevices for MirrorcleListDevices

Note

Users should try to preserve the Applications delivered by Mirrorcle in the ~/MirrorcleTech/bin/ directory in original form.

Compiling the Linux SDK Examples#

If targeting a Debug build:

  1. From the ~/MirrorcleTech/SDK-Linux/ folder

    • $ mkdir Debug

    • $ cd Debug

    • $ cmake -DCMAKE_BUILD_TYPE=Debug ../src/

    • $ make

After the build completes, the MTIDevice-Demo executable will be in the MirrorcleTech/SDK-Linux/Debug folder

If targeting a Release build:

  1. From the ~/MirrorcleTech/SDK-Linux/ folder

    • $ mkdir Release

    • $ cd Release

    • $ cmake -DCMAKE_BUILD_TYPE=Release ../src/

    • $ make

After the build completes, the MTIDevice-Demo executable will be in the MirrorcleTech/SDK-Linux/Release folder