Linux Quickstart#
Prerequisites#
Verify that the USB Controller is listed as an available serial device:
- Run the command
$ dmesg | grep FTDI
and you should see something likeFTDI 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.)
- Run the command
Verify permissions to access the USB Controller
Check permissions on the device, for example
$ ls -l /dev/ttyUSB0
. If the permissions arerw-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
Install CMake if necessary. It is used to build the library and applications
$ sudo apt-get install cmake
Install OpenCV (OpenCV is used for application windowing)
$ sudo apt-get install libopencv-dev
Contents#
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.
- ~/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.
- ~/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/
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:
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:
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
Linux Operating Systems with Command-Line Interface (No GUI)#
Most applications within the Mirrorcle Software Suite generate plots to display waveform data. These plots require a GUI-compatible display environment to function properly. Otherwise, the following error will appear: Gtk-WARNING **: cannot open display:
.
One workaround in this environment which allows the console portion of the application to function without the plots showing is to create a virtual display in buffer using the Xvfb application.
Xvfb must be installed first (e.g. sudo apt install xvfb). This installation offers two options to create a virtual display in memory, redirecting any display content (plots and Imager windows) to an internal buffer instead of a real display:
Manual Method:
Xvfb :10 &
export DISPLAY=:10
Run the application:
./<Application Name>
Using xvfb-run:
Use the
xvfb-run
command to automatically handle the virtual display setup and run the application in one step:xvfb-run ./<Application Name>