Micro Measurement Display 2 (µMD2)

Installation and Operation Manual

Version 1.00 (14-Nov-2019)

Copyright © 1994-2019
Sam Goldwasser and Jan Beck
--- All Rights Reserved ---

For contact info, please see the Sci.Electronics.Repair FAQ Email Links Page.

Reproduction of this document in whole or in part is permitted if both of the following conditions are satisfied:
  1. This notice is included in its entirety at the beginning.
  2. There is no charge except to cover the costs of copying.

Table of Contents


Author and Copyright

Author: Samuel M. Goldwasser

For contact info, please see the Sci.Electronics.Repair FAQ Email Links Page.

Copyright © 1994-2016
All Rights Reserved

Reproduction of this document in whole or in part is permitted if both of the following conditions are satisfied:

1. This notice is included in its entirety at the beginning.
2. There is no charge except to cover the costs of copying.


µMD2 is intended for use in hobbyist, experimental, research, and other applications where a bug in the hardware, firmware, or software, will not have a significant impact on the future of the Universe or anything else. While every effort has been made to avoid this possibility, µMD2 is an on-going development effort. We will not be responsible for any consequences of such bugs including but not limited to damage to the wafer FAB you picked up on eBay for $1.98 + shipping, financial loss from the use of 37 spools of ABS due to the office 3-D printer fabricating a part 25.4x too large in all dimensions, or bruising to your pet's ego from any number of causes directly or indirectly related to µMD2. ;-)


Thanks to Jan Beck for selecting the chipKIT DP32 and writing and testing initial versions of the firmware and GUI. And for getting me interested in actually getting involved in this project. If anyone had told me six months ago that I'd be writing code in C, MIPS assembly language, and Visual Basic - and enjoying it (sort of) - I would have suggested they were certifiably nuts. ;-) Jan maintains the master GUI source code as well as slightly different versions of the firmware and a development blog on the overall project. And a version of the firmware providing basic readout of displacement on any Bluetooth wireless device with a terminal APP, or with a bit more polished presentation (though not the complete GUI) on Android devices, may be found on Jan's Web site. See that and more under "References".


The complete date for even a pre-Alpha version of the µMD2 system has yet to be determined but is not likely to be anytime soon, and may never happen. So, it would be best to go with µMD1 in the meantime.

Note: Links to Web pages external to this document will open in a single separate tab or window depending on your browser's settings.

µMD2 is an inexpensive system for precision readout of displacement (change in position), angle, straightness, and more in metrology applications. It is designed and optimized for both two-frequency HeNe laser (heterodyne) interferometry and single frequency (homodyne) interferometry, as well as other measurement applications using optical or mechanical encoders with Quad-SIN/COS, Quad-A/B, or up/down pulsed signals.

While targeted for experimenters, hobbyists, and researchers, there is no reason why µMD2 can't also be of value in science and industry. The hardware platform is a readily available inexpensive microcontroller development board which communicates via USB to a Windows PC, laptop, netbook, or tablet as shown below.

Typical Heterodyne Interferometer Setup using µMD2

Note that µMD2 refers specifically to the combination of the Teensy 4.0-based hardware and firmware. It's possible there could be µMD3, µMD4, .... µMDn - or µMD0 - in the future using the same GUI. :) µMD1 is already taken, and is a lower cost display which is fully adequate for many applications. See Micro Measurement Display 1 (uMD1) Installation and Operation Manual. The Windows Graphics User Interface - µMD is the same for both systems.

This document provides installation and operating instructions for the µMD2 hardware and software using the Teensy 4.0 development board plugged into a custom PCB (or "shield") dubbed "SG-µMD2" which is currently under development. It include the required interfaces for heterodyne, homodyne, or encoder inputs as well as a small local LCD display for basic readout and status. Maybe. ;-)

It is assumed the reader is familiar with laser interferometry in general as well as HP/Agilent/Keysight lasers and interferometer optics. If not, back up and start with Sam's Laser FAQ: Interferometers for Precision Measurement in Metrology Applications and the lasers in the chapter: Stabilized HeNe lasers or more specifically Commercial Stabilized HeNe Lasers.

Mote: Throughout this document, "µMD2 board" or simply "board" refers to the combination of the Teensy 4.0 development board and the SG-µMD2 shield.

µMD2 Specifications

Specifications are subject to change without notice. :-)

Computer and Operating System Requirements

Everything that follows assumes the use of Windows. If you're really smart and run Linux instead, sorry. ;-) The Arduino IDE, MPIDE, UECIDE, and the µMD2 GUI are known to work under Win XP, Vista, 7, and 10, and should be fine on Win 8 as well. Microsoft Net Framework 4.0 or higher is required to run µMD2. Net 4.0 or a more recent version is probably on your computer already but the latest version is available free from the Microsoft Web site.

Assembly using the chipKIT DP32 Board

Electronic Parts List using the chipKit DP32

The following are the components required to put together a single axis system, multiple axis system, and one with environmental sensors using the chipKit DP32 board. All parts are available from major electronics distributors like Digikey and should total no more than around $30 to $35 for a basic system, perhaps $10 more for the deluxe version.

Note: Environment sensors are a works in progress. The parts may change, so it is recommended that these not be added just yet. Or perhaps forever as the engineers quit in protest due to support issues with the sensor C programming libraries. :( :)

Parts for single axis system without environmental sensors

All resistors are 1/4 W for chipKIT, 1/8 W for SG-µMD2, though 1/4 W resistors can be installed standing up. Typical connectors are TE Connectivity AMP MTA-100 series header (PN 640454-4), shell (PN 1375820-4), and pins (PN 1375819-1), though similar parts are available from Molex and others. (However, header and shell/pins may need to come from the same manufacturer.) And you're perfectly free to use your own favorite parts for these, or wire the cables in directly. An electronics distributor like Digikey will have all these parts (except now for the chipKIT DP32).

Additional parts for 2 or 3 axis system

For a system with 2 or 3 axes, double everything associated with the RS422 line receivers and add a 4 pin header, shell, and 4 pins for each additional axis.

Additional parts for temperature, pressure, and humidity sensors

Since environment sensors are a works in progress, it is recommended that these not be added just yet. Currently, due to timing issues, the sensors are updated ONLY when the µMD2 board is reset. (Sensors are entirely disabled in the firmware by default.) We may be switching to a SHT20 I2C humidity/temperature sensor in place of the AM2301. It's about $10 installed on a PCB like the BMP180. The I2C bus timing is handled in hardware so there should be far fewer timing issues. However, it's quite likely these will never be completed, sorry. Or, you can try Jan Beck's version of the board and firmware which supposedly works with the sensors (but doesn't have the sub-wavelength interpolation).

Note that as a practical matter, for hobbyist or experimental use, it's probably more than adequate to enter environmental compensation parameters manually (or use the defaults), so including the sensors is not essential. The errors will be no more than a few parts per million for typical variations in indoor ambient conditions.

For remote environmental sensor support, the following are required.

The only reason the 5 and 6 pin headers are listed for these is so they will be different than the 4 pin headers for the interferometer signals and prevent accidental wrong connections. The headers and connectors can be omitted entirely if the sensors are mounted on the µMD2 board or cables can be soldered in permanently.

Note that "BMP180" and "SHT20" actually refers to the itty-bitty SMD sensor modules itselves. You really don't want to deal with those. :) Thus, they are usually provided soldered to a small PCB with the required support circuitry. There may be several versions of the PCBs for these sensor. For example, one for the BMP180 has a built-in 3.3 V so it can run from 5 VDC power. Both are shown in the schematic but only one of them is needed. :) Either can be used here since we have both 5 V (VIN) and 3.3 V available. Important: There are at least two different pinouts for the 5 pin version and yours may not agree with the photo, below. Adjust pin connections accordingly. This likely also applies to the SHT20.

These sensors are available on eBay and many other sources. On eBay, the BMP180 PCB without regulator is going for less than $1, the AM2302 for around $3, and the SHT20 on PCB for around $10.

Schematic using the chipKIT DP32

Here is the schematic for µMD2 parts used with the chipKIT DP32 version along with the optional environmental sensors. Only the top circuits using U1 are required for a single channel system. (The schematic of the chipKIT DP32 board itself may be found at chipKIT DP32 Schematics (PDF).)

µMD2 Interferometer Signal Inputs and Sensors Schematic

The only jumper that should remain for a system without environmental sensors is the one for voltage select on JP7 in the lower left of the photo, above.

chipKIT DP32 Jumper Settings

Remove all jumpers if the chipKIT DP32 board was purchased from an electronics distributor.

SG-µMD2 PCB Board Top View (Signal Labeling)

For a single axis system without environmental sensors, the only jumper that should remain is the one on JP7 in the lower left of the photo, above.

Wiring the chipKIT DP32 Board

This will require a low power soldering iron (preferably grounded and temperature-controlled) and rosin core solder. Your 250 watt Weller soldering gun or propane torch is NOT appropriate. ;-)

Pins on the UA9637/9 DIP are numbered counterclockwise as shown below, or starting at the dot or dimple if your part doesn't have a notch.

Pins on the chipKIT board are labeled on the silkscreen but there are at least two different revisions and the numbering isn't the same!

   Pin   Arduino Labeling   Signal Labeling   Signal Name
  J3-1           9               RA0             RPA0
  J3-2          10               RA1             RPA1
  J3-3          11               RB0             RPB0
  J3-4          12               PGC (RB1)       RPGC (RPB1)
  J3-5          13               RB2             RPB2
  J3-6          14               RB3             RPB3
  J3-7          15               RA2             RPA2
  J3-8          16               RA3             RPA3
  J3-9          17               RB4             RPB4
  J3-10         18               RA4             RPA4
  J3-11         3.3V             3.3V            3.3V
  J3-12       VIN (5V)         VIN (5V)        VIN (5V)
  J3-13         GND              GND             GND

  J4-1           0*              RB5             RPB5
  J4-2           1*              RB7             RPB7
  J4-3           2*              RB8             RPB8
  J4-4           3*              RB9             RPB9
  J4-5           4               RB10            RPB10
  J4-6           5               RB11            RPB11
  J4-7           6               RB13            RPB13
  J4-8           7               RB14            RPB14
  J4-9           8               RB15            RPB15
  J4-10          -                -                -
  J4-11         3.3V             3.3V            3.3V
  J4-12       VIN (5V)         VIN (5V)        VIN (5V)
  J4-13         GND              GND             GND

* 5 V tolerant.

The numbers refer to standard Arduino signal "pin" designations while the RPBs refer to DP32 PORT A or B bits. The photo of the chipKIT board, below, has the Arduino designations. This is revision C and is what Digkey has been shipping. It also has the power LED, so perhaps that's an addition. :) The relevant board wiring is the same for the two versions, it's just the silkscreens that differ. But there are apparently older versions that may not be the same.

Note 1: The jumpers on JP7 are NOT in the correct position for our needs in the photo below.

Note 2: VIN MUST be +5 VDC to use the chipKit DP32 with µMD2 parts.

SG-µMD2 PCB Board Top View (Arduino Labeling)

CAUTION: Most PIC pins are NOT 5V tolerant - they will be unhappy if a 5 V signal is connected to them directly. Thus VIN (5V) or any signal that may go higher than 3.3V should NEVER be connected to them, even for an instant. Bad things may happen. 3.3V is acceptable through a current limiting resistor (just to be doubly safe, for the micro that is). Hooking raw power to what may be a logic output (accidentally or otherwise) is never a good thing! P.S. "Unhappy" and "Bad things may happen" could mean that you'll ruin the PIC chip.

Wiring the basic system - single axis, no sensors

  1. Install the 8 pin socket in any convenient location (though a suggestion is shown below). Orient it with pins 1-4 facing the DP32. Take note of the rows of pads that are connected on the PCB as indicated by white boxes surrounding them. These can be convenient to minimize jumpers and for common wiring, but may be confusing to the uninitiated. If using them, a recommended location for the DIP is near the middle of the area with connected pads straddling the long strips for power and GND. Note that the GND, 3V3, and VIN labeling apply ONLY to the single pads of J3 and J4, not the boxed in connected pads near them!

  2. Vcc (pin 1) goes to a VIN pad.

  3. GND (pin 4) goes to a GND pad.

  4. The four 150 ohm RS422 terminating resistors go between 1IN+,1IN-,2IN+,2IN- (pins 5,6,7,8) and GND pads.

  5. REF and ~REF input pins go to 2IN+ and 2IN- (pins 6 and 5) respectively. REF Return goes to GND. See note below about the returns in the cables.

  6. MEAS and ~MEAS input pins to 1IN+ and 1IN- (pins 8 and 7) respectively. MEAS Return goes to GND. See note below about the returns in the cables.

  7. 2OUT (pin 3) goes to a 150 ohm resistor. The other end of this resistor goes to a 330 ohm resistor and its other end goes to GND. The junction of the two resistors is the REF clock signal and goes to pad RB5. This voltage divider assures that the standard TTL output of the line receiver provides a 3.3 V compatible signal.

  8. 1OUT (pin 2) goes to a 150 ohm resistor. The other end of this resistor goes to a 330 ohm resistor and its other end goes to GND. The junction of the two resistors is the MEAS clock signal and goes to pad RB0. This voltage divider assures that the standard TTL output of the line receiver provides a 3.3 V compatible signal.

The graphic below shows a suggested layout for the line receiver, the required resistors, and the jumper location. 4 pin headers are shown for REF and MEAS. Their presence and type are optional but the use of some type of connectors is recommended. This view is of the bare chipKIT PCB as it would look with no other parts present.

SG-µMD2 PCB Board Pattern with Suggested Parts Layout

(If constructing a multiple axis system and/or one with environmental sensors, there is more below on the suggested layout.)

It is recommended that bypass capacitors (0.1 µF ceramic and 22 µF electrolytic typical) be installed between Vcc and GND of the line receiver(s) as close to the chip(s) as possible. While I have not seen problems with power supply noise, others have, though it's not clear under what conditions. But bypass caps are inexpensive insurance. :)

For those not familiar with the common resistor color code (Black/0, Blown/1, Red/2, Orange/3, Yellow/4, Green/5, Blue/6, Violet/7, Gray/8, White/9), the resistors shown above are 150 ohms (brown-green-brown or 15 with 1 zero) ohms and 330 ohms (33 with 1 zero) ohms. The gold stripe indicates 5 percent tolerance on the value but for the use here, tolerance doesn't matter. (It's possible the resistors you use will have 4 stripes where 3 of them are the value and the 4th is the multiplier, along with one for tolerance. If in doubt confirm the value with a multimeter.) The chart below is from Digikey. (If the link decays, a Web search will readily find another one.)

Resistor Color Code Chart (from the Digikey Web site)

Below is the suggested wiring arrangement, color coded to differentiate REF, MEAS, VIN, and GND. It's not critical, but keeping wires short will minimize confusion. For the long runs, use thin insulated hookup wire or wirewrap wire. There are no issues of high current :) so #30 AWG is fine for all connections. The short (GND connections) can be done with bare wire. This should all be on the bottom of the board. Poke the stripped end of the wire through any convenient hole that is close to and electrically connected to the correct signal, or wrap it around the end of the resistor lead or connector pin before soldering.

SG-µMD2 PCB Board Suggested Wiring Routing

For a 2 or 3 axis system, especially if adding environmental sensors, it may be desirable to squash this layout somewhat to make space for a second dual line receiver. This can be done easily by standing up some of the resistors. And/or use a quad line receiver chip. However, the layout below which replicates the pattern for a second RS422 line receiver will work. But note that most of the pads used by additional parts are NOT bussed so interconnecting them will have to be done by running jumper wires.

For the environmental sensors, the diagram shows headers to attach extension cables so that the sensors can be mounted close to the interferometer setup. It is also possible to mount them on the board directly in place of the headers. But generally, the sensors should be located where the relevant environmental conditions are present, though only the temperature is at all likely to differ, and possibly be affected by the (very slight) power dissipated on the board. (Unless your interferometer is in a vacuum chamber!) The signals are all low frequency so a reasonable cable length can be used without concern for shielding, crosstalk, or frequency response. But using twisted pairs is probably prudent for anything longer than a few feet. Also note the additional jumpers at JP4 and JP5.

Once the board has been wired, mounting it in such a way that the bottom can't touch anything and short out is highly recommended. Use standoffs in the four corner holes or something similar, and an insulating sheet under it.

Wiring the cables

The specific wiring for REF and MEAS will depend on the setup. If using HP/Agilent/Keysight lasers:

It's usually not necessary to run the REF and MEAS Return (RET) signals to the board even if there is no common ground connection between the board, and laser and interferometer optical receiver(s). The terminating resistors will provide the ground reference. In fact, under some conditions where everything is tied together with a common ground, the RET connections could add noise due to a ground loop. The line receivers only care about the difference between the REF and ~REF or MEAS and ~MEAS voltage levels as long as the absolute voltage levels are within their common mode and absolute voltage specifications. For cables of a few feet or less, it's almost certain that no connections are required for the Returns. But for long runs, shielded cable or twisted pairs may be desirable. This won't apply to most hobbyist/experimenter applications. :) There has to be a common Ground somewhere though, usually via the power supply.

Refer to the various connection diagrams in Hewlett Packard/Agilent/Keysight Stabilied HeNe Lasers.

Much more on the details of the board can be found in the Diglent chipKIT DP32 references, below.

Wiring the 2nd and 3rd axes

  1. Replicate the layout of the 8 pin socket, headers, and terminating and level shifting resistors as for the single axis system.

  2. MEAS2 and ~MEAS2 input pins go to 1IN+ and 1IN- (pins 8 and 7) respectively. MEAS2 Return goes to GND. See note above about the returns in the cables.

  3. MEAS3 and ~MEAS3 input pins go to 2IN+ and 2IN- (pins 6 and 5) respectively. MEAS3 Return goes to GND. See note above about the returns in the cables.

  4. 1OUT (pin 2) goes to a 150 ohm resistor. The other end of this resistor goes to a 330 ohm resistor and its other end goes to GND. The junction of the two resistors is the MEAS2 clock signal and goes to pad RPB2.

  5. 2OUT (pin 3) goes to a 150 ohm resistor. The other end of this resistor goes to a 330 ohm resistor and its other end goes to GND. The junction of the two resistors is the MEAS2 clock signal and goes to pad RPB3.

SG-µMD2 PCB Board Pattern with Suggested Parts Layout for Multiple Axes and Environmental Sensors

If using the suggested layout, most of the pads are NOT connected together so this will need to be done with jumpers.

Wiring the BMP180 sensor

Important: There are at least two different pinouts for the 5 pin version of the BMP180 and yours may not agree with the photo, above. Adjust pin connections accordingly. In addition, VIN may be called Vcc and 3Vo may be called 3.3V. However, they are the same function.

Select a location on the chipKIT board that does NOT have connected pads. The BMP180 can be soldered directly to the board, installed in a socket, or run remotely via a cable.

  1. Identify the version of the BMP180 you have and suitable locations on the chipKIT board that do NOT have connected pads. Use the labels on the BMP180 PCB to identify the signal pins, NOT their location.

  2. GND goes to a GND pad.
  3. SDA goes to RB9.
  4. SCL goes to RB8.
  5. Install jumpers at locations JP4 and JP5 as shown in the diagram, above.

Wiring the AM2302 sensor

Select a location on the chipKIT board that does NOT have connected pads. The AM2302 can be soldered directly to the board, installed in a socket, or run remotely via a cable.

  1. 3.3V goes to a 3V3 pad.
  2. Both GND pins go to a GND pad.
  3. DTA goes to RB7.
  4. Install a 10K ohm resistor between DTA and 3.3V.

Assembly using the SG-µMD2 Board

The SG-µMD2 Boards should be available sometime in Spring 2019. They willl be supplied totally unpopulated with a kit of parts for up to a 3 channel µMD2 system with the PIC32 preprogrammed with the boot loader and µMD2 firmware. Although this may appear to be more work than using the chipKit board, since no hand-wiring will be required, it is actually simpler in some ways as parts need only to be inserted and soldered. All parts are through-hole so soldering should be quite straightforwrad.

The first SG-µMD2 PCBs to be available will be Version 1.0. Version 1.2 will follow. They differ primarily in the LEDs and are equally good at doing their µMD2 thing. ;-) However, parts numbering has changed between them so it is essential to follow the correct assembly instructions. The version is labeled on the PCB silkscreen and bottom copper layers.

Please refer to the appropriate manual below for the parts list and detailed assembly instructions:

The µMD2 Firmware

Latest Versions of the Firmware

The (non-Alpha) versions of the firmware are absolutely guaranteed to be new and improved in terms of features, capabilities, and performance. This probably means there will be some new and improved bugs as well. The Alpha versions are even more likely to have some juicy bugs. Please contact us via the link at the top of this page should any dare to appear (or for any other legitimate reason). ;-)

Firmware Hardware Assignments and Communications Format

Here are the PIC32 Timer designations, select bits, bus addresses, and pin assignments for the interferometer input signals:

   Input   Counter   TxCKR    Bus Address    Pin    Signal   Notes
    REF    Timer3    0b0001   0xbf800A10    0/RB5    RPB5
   MEAS1   Timer5    0b0010   0xbf800E10   11/RB0    RPB0    LED4
   MEAS2   Timer4    0b0100   0xbf800C10   13/RB2    RPB2    LED2
   MEAS3   Timer2    0b0001   0xbf080810   14/RB3    RPB3    LED1
("x" designates the selected Timer.)

Other signals that are currently used are RPB7 (AM2302), and RPB8 and RPB9 (I2C bus for BMP180 and SHT20).

Most of these details are really only relevant if there is a desire to modify the firmware, which is not advised since no support will be provided if even 1 character in a comment field is changed without prior approval from µMD2 Central. :) This approval process normally requires a minimum of 3 years, 7 months, 24 days, 11 hours, 35 minutes, and 22 seconds, but often takes a lot longer. :-) For wiring using the firmware provided, only the pin assignments matter.

Depending on how the line receivers decide to behave in combination with the laser or optical receiver when there is no signal, the LEDs may provide an indication of MEAS signal status, though they do not appear to respond to MHz frequencies. The reason the LEDs on the chipKIT board are on the clock inputs at all is that there are only a very limited of pin/Timer combinations that are available and using those with the LEDs results in the fewest conflicts. For SG-µMD2, there are seprate (optional) LEDs on the all of the line receiver outputs (which also are probably not useful and don't need to be installed).

Note that if updating firmware, the GUI may also need to be updated and vice-versa.

Here is the communications format between the firmware and GUI. This information is of little relevance if using the GUI, but will be useful if writing your own application software or for data analysis. Each of the values is sent as an ASCII string representing a signed (if needed) decimal number separated by spaces at the sampling rate. The firmware maintains a FIFO buffer so that if the USB data is delayed for some reason, no data should be lost (hopefully):

 Standard (Single Axis) Data (8 values):

   0: REF Frequency Count = REF frequency/Sample Frequency
   1: MEAS Frequency Count 1 = MEAS 1 frequency/Sample Frequency
   2: Displacement 1 ( in 1/2, 1/4, or 1/8 wavelength)
   3: Velocity Count 1 = (Displacement 1 - Previous Displacement 1)/Sample Frequency
   4: Phase 1 = Signed fractional offset between Displacement increments * 256

      If Phase is not valid, then an error code is sent instead:

        0x200 = no counter 1st REF
        0x400 = no counter 2nd REF
        0x800 = no counter MEAS 1
        0x1000 = no PORTB 1st REF
        0x2000 = no PORTB 2nd REF
        0x4000 = no PORTB MEAS 1

   5: Sequence Number (Unique serial number for each sample)
   6: LowSpeedCode (See below)
   7: LowSpeedData (see below)
   The following 8 values will also be sent when Multiple Axis Mode is active:

   8: MEAS Frequency Count 2
   9: Displacement 2
  10: Velocity Count 2
  11: Phase 2
  12: MEAS Frequency Count 3
  13: Displacement 3
  14: Velocity Count 3
  15: Phase 3

  LowSpeedCode (specifies contents of LowSpeedData):

     0-99: GUI Data/Control:

      0: No Data
      1: Laser Power
      2: Signal Strength
      3: Temperature 1 (XXX.YY, °C, 0 to 70.00)
      4: Temperature 2 (XXX.YY, °C, 0 to 70.00)
      5: Pressure (XXX.YY mBar, 500.00 to 2000.00)
      6: Humidity (XXX.Y percent, 0 to 100.0)

      8: Sample Frequency (XXX.YY Hz)

     10: Firmware Version (XXX.YY)

     20: Homodyne Interferometer (if non-zero)
          Low byte: # homodyne axes
          Next byte: counts/cycle (4 for quadpulse)

     (Not all of these are currently implemented.)

   100-199: Diagnostics

   200-255: Reserved

Installing the USB Device Driver

Before µMD2 can be used, a Windows device driver must be installed. The Digilent chipKIT Quick Start Guide recommends MPIDE for the firmware development environment, which includes the device driver. Unfortunately, while its device driver is fine, versions of MPIDE we've seen so far have serious bugs in the libraries and C compiler, and it is thus NOT recommended for anything. :( :) The MPIDE references at the end of the manual are for, uh, reference only.

Installation of the device driver, which should be performed before the board is plugged in, can be done in several ways without using MPIDE. (1) is the simplest:

  1. Download and run the chipKITDriverInstaller_v10.exe file from chipKIT.net New Signed USB Drivers. chipKITDriverInstaller_v10.exe is a self extracting executable, which will extract the actual driver files and an installer application (USBDriverInstaller.exe) into the same directory as itself, and then launch the installer application.

  2. chipKITDriverInstaller_v10.zip can be downloaded from the same Web site, unzipped, and run manually if you feel more comfortable doing it that way.

  3. Search for, download, and save Stk500v2.inf, which is really the only file that Windows needs. You can point Windows to that inf file if you want to manually install the drivers at any time. Stk500v2.inf is available from several Web sites.

Once the driver has been successfully installed, plug the board into any available USB port. The red power LED (if present) should come on. (Not all versions of the chipKIT DP32 have one; apparently someone decided to save 1/10th of a cent on an earlier or later revision!) If I (Sam) sent you the chipKIT DP32 board, it will have been loaded with a version of the µMD2 firmware and at least one of the green LEDs will be lit. But by the time you've received it, the firmware will probably be out of date, so reloading will be required in any case. :) For SG-µMD2, the power LED at the very least should be on.

Windows should recognize the board and ask to install a driver. Point it to the location of Stk500v2.inf.

Once the driver is successfully installed, the board should come up as a serial port. Go to the Windows Device Manager to locate and select it.

Loading UECIDE

(If you purchased the from me directly, or via eBay, the latest released version of the firmware has been preloaded, so the following step should not be necessary unless a later release is available or you would like to hack the firmware - which is not really recommended.)

UECIDE will work with all versions of the firmware. But the only version of UECIDE I've had success compiling firmware without errors is Version 0.8.8alpha17 though I assume that more recent versions like 0.8.8alpha22 will also be satisfactory. All versions as far back as 0.8.8alpha22 and beyond are available at UECIDE on GITHUB. However not, apparently uecide-0.8.8alpha17. :( But never fear, I have archived it and will provide a link upon request, but it's not clear whether it will install correctly now (see below). So I can also provide a µMD2-ready preconfigured version via Dropbox. This is a 329 MB RAR archive which includes installation instructions in a short README file. Contact me via email if interested in either.

Other more recent versions probably work, they just hate me. :( :) And I'm not going to check: "If it ain't broke, don't fix it". ;-) I do know that the latest as of Winter 2019, uecided-0.10.5, runs but will not compile µMD2 due to changes in the compliler and #include files.

41J Blog µMD2 Build Notes has instructions for using uecide-0.8.8alpha22 (linux, but that shouldn't matter). I could not get this to work in 2019 under Windows though. In fact, there may be problems getting any of the older versions to install now. Even my working uecide-0.8.8alpha17 does not display properly in "Plugins Manager" anymore. so it cannot be configured from scratch or have anything added. However, these older versions may work properly if only the executable is replaced.

The UECIDE files should be unzipped to any convenient location on your computer. That folder can be moved wherever desired without any side effects. The executable is UECIDE.exe - add a shortcut on the Desktop. UECIDE requires around 160 MB where the excutable is located, and another 600+ MB for support files typically at C:\users\YourUserID\AppData\Local\UECIDE. The location of the data can be changed in File->Preferences or by editing the text file "preferences.txt" in this directory. If doing this after having configured UECIDE, copy all the files to the desired destination FIRST, then change the data directory in File->Preferences and exit UECIDE exit first and edit "preferences.txt". DO NOT delete the original UECIDE directory or the preferences file! :) Otherwise, the configuration information will all be lost. The required directory trees and typical disk space requirements are:

  1. UECIDE executable: This is typically under "C:\Program Files" but can be anywhere, ~160 MB.
  2. C:\users\YourUserID\AppData\Local\UECIDE: DO NOT MOVE, less than 1 MB). Includes "preferences.txt".
  3. Data Directory: This is pointed to from within "preferences.txt", 600 MB or more depending on configuration.
  4. Sketchbook Directory: This is pointed to from within "preferences.txt", and is where sketches are stored, relatively small.

UECIDE does not actually install in Windows so there are no files stored in the Windows directory and no changes to the Registry. So uninstalling it is simply a matter of deleting the first three directories.

Apparently it is possible to use newer versions of UECIDE, with a bit of trickery:

(From: Wim Huyghe.)

This is how I installed a recent version of UECIDE with the above files:

  1. Copy or move "Documents-UECIDE" to your $USER\Documents folder and rename it to UECIDE. The 3 versions of µMD2 linked from the manual are there, as well as some sensor libraries.
  2. Copy or move "Data-UECIDE" to your "$USER\AppData\Local" folder and rename it to UECIDE.
  3. Edit the "preferences.txt" file in "$USER\AppData\Local\UECIDE" so the Document, Data, and Sketch links are correct.
  4. Install latest version from UECIDE from here: https://uecide.org/download.

When UECIDE was then run, it already had the board, compiler, and libraries set up and I could compile all versions of the µMD2

Compared to most applications, UECIDE takes forever to start up even on a fast PC. So be patient. That's the bad news. The good news is that compiling and uploading is about 5 times faster than MPIDE, another reason to ignore MPIDE. Go figure. :)

The first thing UECIDE will likely do is to tell you that no boards are installed and then open the Plugin Manager. If it does not, do it manually by going to Tools->Plugin Manager. At first the pane along the left will only show the word "Plugins". But after a couple minutes, it should update with a list: Plugins, Libraries, Boards, Cores, Compilers, System. The following are required:

For each of these click on "Install". Installing the chipKIT board will probably automagically install the other chipKIT-related files and may take several minutes. Confirm that each entry has a green check mark next to it.

Close the Plugin Manager and go to "Hardware" and confirm that the proper Board (chipKIT DP32), core (chipKIT), and Compiler (pic32-tools) has been selected. Click on it if not.

Some other quirks of UECIDE that I've found:

Plug the board into any available USB port. The red power LED (if present) should come on. (Not all versions of the chipKIT DP32 have one; apparently someone decided to save 1/10th of a cent on an earlier or later revision!) If I (Sam) sent you the board, it will have been loaded with a version of the µMD2 firmware and at least one of the green LEDs will be lit. But by the time you've received it, the firmware will probably be out of date, so reloading will be required in any case. :)

Assuming the driver has already been installed, go to Hardware->Serial Terminal and select its COM port. Typically, this will be the highest number COM port, or perhaps the only one, since no one uses these for much of anything anymore.

UECIDE should remember the configuration settings automatically upon exiting.

Uploading the µMD2 Firmware

If you purchased the from me directly, or via eBay, the latest released version of the firmware has been preloaded, so the following step should not be necessary unless a later release is available or you would like to hack the firmware - which is not really recommended.

The firmware (via the links, above) is provided as a source file which probably has an extension of ".pde" or ".ino" (though the specific name doesn't matter - it's just a text file). However, the name may NOT contain any dashes "-" due to the peculiar restrictions of Java or something. Make a directory with the name of the firmware (without the extension) and put the firmware file there. For example, if the file is named umd2_FW_v123.ino, make a directory called umd2_fw_v123. and put umd2_FW_v123.ino in it. Note that case matters so the name of the directory and name of the firmware file (without the extension) must match case character-by-character exactly. Thus Interferometer.pde is not the same as interferometer.pde

  1. Plug the board into a USB port. I've occasionally seen problems using a USB port replicator though these generally are acceptable. But if the board doesn't come up, go to a direct USB port.

  2. There are 3 pushbuttons on the board. BTN1 (next to the PIC and JP6) is RESET while BTN2 is PROGRAM. (BTN3 is called USER and is unassigned.) Press RESET and hold it while also pressing PROGRAM. Release RESET and then release PROGRAM. LED1 should be flashing rapidly indicating that the board is salivating in anticipation of having new and improved firmware uploaded to it. :)

  3. Use Ctrl-O to open the firmware file. Select the directory. The source code should appear in the same window unless a file is already open, in which case a new window will appear. (If UECIDE thinks it's a firmware directory, it won't even allow you enter it to select the file but will immediately open the file. If the name of the directory and file don't match - including case - it will produce an error like "file not found".

  4. Use Ctrl-U to compile and upload the firmware to the board. This typically takes only a few seconds with UECIDE and will display each step along the way. When it starts uploading the firmware, the LEDs on the board will flash in several different patterns in anticipation of getting new and improved instructions to munch on, finally ending with 8 rapid flashes. ;-) The board will be automatically reset and start running the firmware. During this time, confirmation messages similar to the following will appear:

         * Compiling sketch...
         * Compiling core...
           > api
         * Compiling libraries...
         * Linking sketch...
       Compiling done.
       Memory usage
         * Program size: 55532 bytes
         * Memory size: 3452 bytes
         * Compilation took 5.634 seconds
       Uploading firmware...
         * Resetting board...
         * Uploading...
         * Resetting board...
         * Upload Complete

    Windows should recognize that the COM port dropped out momentarily and reappeared. The firmware will be spitting out sequences of numbers at the sampling rate. These may be viewed by going to: Tools->Serial Terminal. With no interferometer hardware, they will be rather boring with only the sixth value incrementing sequentially (Sequence Number) and the 7th and 8th values cycling among some obscure numbers (Low Speed Code and Low Speed Data). To Windows, the board appears as a COM port. Thus any application that processes COM port data can be used in place of the µMD2 GUI, should this be desired.

    If the firmware crashed somehow, Windows may display a message saying something about the USB port not working. But that shouldn't happen with any firmware downloaded from here. :) And on rare occasions a cosmic ray or hardware glitch may result in the upload failing with a checksum or other error. Just put the board in program mode and try again. If the selected COM port is incorrect, cancel and retry.

Once loaded, the firmware is retained in non-volatile memory so this only needs to be done at most once - or until a firmware update is available!

The firmware may also be compiled without uploading by using Ctrl-R. Since you haven't messed with the code, it should compile without errors. This is slightly faster for testing and doesn't use the board at all so it can be off doing whatever it pleases. :)

Important: Terminate any instances of the µMD2 GUI before uploading the firmware and put the board into program mode (again if necessary) AFTER doing this even if LED1 is flashing.

Restoring or installing the chipKIT bootloader

This should never be necessary with either the chipKIT DP32 or SG-µMD2 PCB since the bootloader is preloaded and it's almost impossible to accidentally erase it. But it would be required if you were to lay out your own PCB and purchase the PIC32MX250F128B part direct from microchip or an electronics distributor. So this section is more for my own reference. ;-)

(For the following, on the chipKIT DP32, it may be necessary to disconnect the MEAS1 circuit from the PIC32 and on SG-µMD2, the jumper/trace JP0 may need to be removed to assure that the MEAS1 line receiver does not load the P32_PGD signal.)

A PIC programmer like the microchip PICkit 3 will be required along with an in-line cable that mates with the programming connector on the board. The microchip PICkit 3 is around $50 from an electronics distributor. Far East knockoffs can be found for less than 1/3 of that on eBay but may or may not work properly. Temporarily disconnect any user circuitry with a load of less than a few k ohms from P32_PGD/RB0 (MEAS1) and P32_PGC/RB1 so the PICkit 3 can toggle those lines. For the procedure, see Restore Your chipKIT Bootloader Guide. DON'T bother with MPLAB X though as it may hang when attempting to communicate with the microprocessor. Install MPLAB V8.92, which works perfectly well. But power the board from USB, NOT the Pickit 3 - other parts load down 3.3 V power if it's provided from the programming connector, possibly the 3.3 V regulator IC. The following assumes the use of the PICkit3:

  1. Start MPLAB V8.92.
  2. Plug in the PICkit3.
  3. "Programmer", "Select Device", "PICket3".
  4. "Programmer", "Settings", "Power", Make sure "Power target circuit from PICkit3" is NOT checked.
  5. "Configure".
  6. "File", "Import" to load the chipKIT-DP32-v01000303.hex. Do NOT Open it.
  7. Power up the PIC32 board. MPLAB should recognize the PIC32 with a status word and no errors.
  8. "Programmer", "Program". Almost immediately, there should then be an acknowledgment that the programming was successful and the board will then reset into boot mode with the LED flashing.
  9. Disconnect the PICkit3.
  10. If connected to USB, the PC should recognize that it is a valid COM port. UECIDE can then be used to compile and download the firmware.

Testing the Board and Firmware

With µMD2 firmware loaded, the simplest way to test that the board is working without running the GUI is to use the "Serial Terminal" (under "Tools" in UECIDE.) With the board reset, then open the Serial Terminal. The terminal window should begin spewing forth data similar to the following:

  0 0 0 0 31232 16927 0 0
  0 0 0 0 31232 16928 0 0
  0 0 0 0 31232 16929 10 5610
  0 0 0 0 31232 16930 8 45776
  0 0 0 0 31232 16931 3 -1
  0 0 0 0 31232 16932 4 -1

If there is a display like this with the 6th number incrementing by 1, then the board is probably working.

The µMD2 GUI

Latest Version of the GUI

The GUI has been stable for several years, with only a few updates mostly relating to environmental compensation. It is compatible with all versions of the firmware.

Save the µMD2 GUI .exe file into any convenient directory. (There's a small chance that the first time it's run, an error is produced since there is no configuration file associated with it. Simply continue and the GUI will come up. When it is closed using "Finish", valid settings will be saved so that the error should ot appear again.)

Even if there is no interferometer hardware attached to the board, it is possible to confirm that the PIC is talking to the GUI. Go to "USB Port" and select the same COM as used to upload the firmware. The graph should immediately start scrolling to the left indicating that it is accepting valid data, even if it is all 0s. The display will show "No Signal" (assuming error detection is enanbled) since there are no REF or MEAS clocks. But the fact that it's scrolling means the communications link is working.

Important: DO NOT reset the board while the µMD2 GUI is running. The GUI will need to be aborted, the board may need to be reset again, and only then can the GUI be restarted.

When started, the µMD2 GUI (henceforth simply called the "GUI") comes up in Displacement mode with graphing enabled. The only action required by the user is to select the USB COM port. Once selected, the readout and graph will begin displaying the interferometer data.

Important: The GUI can be started at any time but the firmware must be running before the USB COM port is selected or else the Universe may implode. :) Confirmation of this issue is left as an exercise for the user. ;-) There is usually no need to reset the firmware when restarting the GUI. However, if the GUI behaves strangely, exitting the GUI and resetting the firmware may be required. On rare occasions, it may be necessary to cycle power to the hardware by unplugging the USB cable for a few seconds to clear some weird errors that reset alone doesn't take care of. The µMD2 Technical Department is aware of these issues and is working around the clock to resolve them so there is no need for a bug report.

Data from the board is normally sent at a rate of 457.76, 610.35, or 732.42 Hz depending on the measured REF frequency of the laser. (If you're curious, the precise sampling rate is the PIC CPU clock frequency divided by 65,536 - the number of counts between the 16 bit Timer1's overflows, used as the sample rate interrupt clock.) The CPU clock frequency is automatically changed based on the laser's REF frequency to optimize sub-count interpolation.) The data includes counts for REF, MEAS, displacement, velocity; a unique sequence number to identify samples; as well as other low speed data such as environmental sensors and diagnostics. (More info can be found a few paragraphs above.) The GUI displays are updated at approximately 60 Hz.

All the screenshots below except for interpolation use simulated data, which was more convenient for developing this manual! However, it also means you can play around and recreate these displays before building your interferometer. The screen shots showing the effects of interpolation are of actual data.

Main Window Controls and Readouts

This graphic below shows the typical GUI main window at startup.

µMD2 Main Window in Displacement Mode with Graphing Enabled (Startup Settings)

Main Window Controls

The first set are the selection buttons at the top of the window. Note that except for USB Port, these require only a single click to activate:

µMD2 Main Window with Test Mode Function Generator Triangle Displacement Waveform

These may all be accessed via Alt-first letter.

The next set are the buttons, checkboxes, and other widgets on the main window:

The format is slightly modified when Frequency mode is selected. This graphic shows the actual DFT of the triangle waveform in the one above. Note that the DFT coefficients go as 1/N rather than 1/N-squared because it's actually using the velocity data, which is a squarewave.

µMD2 Main Window in Frequency Mode with Graphing Enabled

Main Window Indicators

Next are the various fields for displaying information in the Main Window:

µMD2 Main Window Showing Most Indicator Fields

Interferometer Configuration Window

These entries provide for selection of the type of interferometer used for displacement/velocity measurements, the measurement units to be used for the Main Readout and graph, parameters for the strightness and angular optics, and whether to enable use sub-count interpolation. All interferometer configuration parameters are saved when exiting the GUI.

µMD2 Interferometer Configuration Window

Linear coefficienets:

These settings only affect linear measurements.

Units (as appropriate)

Known quirk: If neither the COM Port or Test Mode is active, switching among the Units buttons will only change the Units lable and/move the decimal point/precision without affecting the readings. Just thought you should know. ;-)

Parameters (as appropriate):


Environmental Compensation Window

This provides for entry of temperature, pressure, and humidity, or to select the use of environmental sensor data if available. All environmental compensation parameters are saved when exiting the GUI.

µMD2 Environmental Compensation window

Note: Temperature, pressure, and humidity values from installed sensors are currently only acquired when the board is reset, but are sent periodically to the GUI.

Note 1: With the current GUI, the Factors for Temperature, Pressure, and Humidity will change either based on the entered values or via the hardware sensors (if implemented). HOWEVER, their exact value is not guaranteed to be meningful and should only be considered for trends. This was supposed to be fixed when the environmental calculations were corrected using the NIST formulas, but the staff assigned to do the work took a couple years off, sorry.

Note 2: With Environmental Compensation turned OFF, the vacuum wavelength is used in calculations. Therefore, Environmental Compensation should be turned ON even if using standard values.

Test Mode Window

The primary use of Test Mode is to exercise the GUI without the need for a laser or actual interferometer hardware. :) The only other user function that is useful would to disable error detection suring setup and alignment of the laser and optics.

µMD2 Test Mode Window

Multiple Axis Support:

While the firmware handles up to three measurement axes, only limited support is provided in the GUI due to the software complexity and lack of demand at the present time. What is present should be enough to get started. It's possible this could chenge in the future but don't hold your breath in anticipation. It may never happen.

If the GUI detects data (MEAS clocks) on axes 2 or 3, the firmware and GUI enter Multiple Axis Mode utilizing an expanded communications format, and the appropriate readouts will appear as shown below.

µMD2 Main Window with Multiple Axes Active

All GUI functions apply to the primary axis, which defaults on startup to Axis 1. The primary axis is what the Main Readout, REF/MEAS/DIFF frequency displays, frequency analysis, averaging, and graph apply to. Clicking on the Axis 1, Axis 2, or Axis 3 labels will select it to be the primary axis and change the color of the selected axis label to identify it as the primary axis. The units of the primary axis are also used for the others. Error detection (if enabled) only applies to the primary axis. Averaging is NOT applied to the Axis 1, Axis 2, or Axis 3 readouts, even the one that is the same as the primary axis.

Note that in Multiple Axis Mode, the communications format sends somewhat more data over the USB COM port and the GUI must perform more computation. Thus this may cause problems for a wimpy pre-Jurassic PC operating on the hairy edge of what's possible. Once Multiple Axis Mode is entered using the interferometer hardware, the only way to return to Single Axis Mode is to restart both the firmware and GUI. This is because neither has any way to know whether dropouts of measurement clock signals are due to a beam path being momentarily interruprted or an axis actually being shut off (whatever that might mean).

Test Mode is also capable of exercising all three axes singly or in combination but the function generator data will be the same for all. This is controlled by the Multiple Axis Mode checkbox. When enabled, Axis 1, Axis 2, and Axis 3 checkboxes will appear below it with Axis 1 being the default on startup. Turning Multiple Axis Mode off will put the GUI back in Single Axis Mode. But this will be overidden when Test Mode is turned off if the USB port is enabled and the firmware is running with multiple axes.

Multiple Axis GUI support is currently under development. Specifications and behavior are subject to numerous changes without notice. ;-) However, no major features beyond what are described above are anticipated to be implemented in the GUI.

Help Menu

µMD2 About Window


Naturally, all is expected to go smoothly. But if it doesn't, here are some common problems. Some of these may be bugs in the firmware or GUI as hard as that is to believe. So, if you find something that cannot be solved based on what's below, contact us for a timely response:

Using µMD2 GUI with Homodyne Interferometers

Note that the standard µMD2 firmware does NOT support homodyne operation (either not well or not at all). A special version is available and it has no warranty whatsoever. :) See below.

While originally designed and optimized for heterodyne interferometers using two frequency HP/Agilent/Keysight and similar lasers, the µMD2 GUI can also be used with homodyne (single frequency) interferometers. The interferometer optics used with these systems are identical to those for two-frequency lasers, but the electronics typically provide baseband SIN/COS "quadrature" outputs rather than REF and MEAS frequencies. For use with µMD2, the analog signals must be converted to digital pulses to increment or decrement the displacement counters. In fact, other measurement instruments providing quadrature signals like those using high resolution optical encoders can also be used with µMD2. Firmware may use the SG-µMD2 board or an even less expensive platform like the Atmega 328 Nano 3.0. (Under $3 on eBay.) However, without some minimal additional quadrature decoding hardware, performance will be severely limited with either.

As long as the communications format is adhered to, the µMD GUI will interpret displacement correctly. So, rudimentary firmware would accept SIN/COS quadrature signals thresholded to TTL levels to increment or decrement displacement, resulting in up to 4 counts per cycle or a resolution of around 79 nm with a Linear Interferometer (LI). (but with the Interferometer Configuration set to 4X.) There is no sub-wavelength interpolation option. However, a quad-pulse converter (4 counts/cycle) multiplies the resolution by a factor of 4 compared to the same optics with a two-frequency laser. So using a Plane Mirror Interferometer (PMI) would result in a native resolution (no interpolation) of just under 40 nm. These values come about from (1) 2X from the optical path up and back, (2) 2X from the PMI, and (3) 4X from the 4 counts per cycle of the quadrature decoder. With a High Resolution PMI, the resolution becomes ~20 nm. And some commercial metrology laser systems provide increased resolution via interpolation internally. But even the basic resolution of ~40 nm is not too shaby. ;-)

However, since the counting must be done in real-time, the uninterruptable portions of the USB serial data handler are a serious limitation for implementations not using a hardware pulse converter and counter. By minimizing the size of the unused values to reduce the time spent in the serial communications, this can be somewhat improved but it's still not pretty. Using the Atmega 328 Nano 3.0 with a PMI, the speed is currently limited to less than 1 mm per second, and some GUI functions like Velocity and Frequency won't do anything useful. Inquire for a copy of this Atmega firmware if interested in hacking it. ;-)

With minimal external logic to convert the SIN/COS quadrature to digital quadrature and then to TTL pulses, this speed limitation would virtually disappear using the Teensy 4.0 with its internal counters. A PLD, discrete logic, commercial chip like the LS7083 "Encoder to Counter Interface", or even another microprocessor like the Atmega, would generate UP and DOWN pulses based on the SIN/COS signals. More modern versions of SIN/COS interpolator chips are available with multiplications factors of up to thousands (though at limited speed), though output edge rates of many Mhz are possible depending on the interpolation factor.

UP would increment the REF counter and DOWN would increment the MEAS counter. Their difference would then be the Displacement just as in the standard µMD2 firmware. Data would be sent at a fixed sample rate of 732.42 Hz and all GUI functions would be supported. A second measurement channel would use the other two counters. The internal counters can run at over 20 MHz, so perfomance would be limited mostly by the speed of the optical receiver and quad-to-pulse converter.

A hardware implementation for the converter would provide the highest performance. However, depending on the actual requirements, there may be no need to dust off those old TTL chips or PLD programmer. When using a $2 Atmega 328 Nano 3.0, the maximum speed was measured to be order of 40 kHz for each of 2 channels using quick-and-dirty polling using the pathetically slow Arduino digitalread and digitalwrite instructions. With a few minutes of optimization invoking direct PORT calls instead, the aggragate throughput went up to order of a million (X4) counts/second. That's about 4 cm/sec with a PMI. Substituting a second Teensy 4.0 or PIC32MX250F128B board (chipKIT or SG-µMD2) to be used only for the converter should result in a several fold improvement over that.

There is a version of the µMD2 firmware that supports homodyne mode with 1 or 2 channels each using pairs of internal counters (>20M counts/second max but requiring an external pulse converter to generate the up/down pulses), along with a third channel via direct polling of Quad-A-B digital inputs. The maximum speed of the third channel is under 350 counts/second but this could still be useful for some applications like the Z axis in a high resolution 3-D printer. ;) To accomodate non-interferometer measurements using optical or mechanical encoders, the entry for "Vacuum Wavelength" in the "Environmental Compensation" window (632.991372 nm for HP/Agilent lasers) has a range of 1 nm to 1,000,000 nm (1 mm) so it can be set to the appropriate resolution required for anything from an atomic force microscope to a construction crane. ;-) If a value outside this range is required, contact me. ;-)

To display rotation angles from optical encoders (or ring laser gyros) properly, there is now an option in the GUI to bypass the non-linear calculation required by the Angular Interferometer. With the "Encoder" checkbox in the Interferometer Configuration screen checked, the the angle will read correctly based on the Angular Reflector Spacing being the radius of the encoder and the wavelength being (X4) count spacing around the periphery.

The graphic below shows µMD2 being used to test a home-built ring laser gyro. It is being rotated by hand on a Lazy Susan turntable.

Screen Shot of Sam's RLG Angle Readout using µMD2

Interpolation for higher resolution is possible using the raw SIN/COS analog signals and often done in commercial systems. However, I have absolutely positively no intention of even thinking about any implementation using the existing µMD2 hardware. And as noted, the basic resolution using a single frequency HeNe laser and PMI with quad-A-B digitally thresholded signals is under 40 nm. With a HiRes PMI, it would be under 20 nm. If you need something better then that, you probably have a budget to go with it. ;-)

Summary of homodyne inputs for µMD2 (chipKit DP32 or SG-µMD2

    Pin    Signal   Counter   Function         Maximum Speed
   0/RB5    RPB5    Timer3    Axis 1 Up    >20M counts/second
  11/RB0    RPB0    Timer5    Axis 1 Down       "          "
  13/RB2    RPB2    Timer4    Axis 2 Up         "          "
  14/RB3    RPB3    Timer2    Axis 2 Down       "          "
  10/RA1    RPA1      --      Axis 3 A     350 transitions/second
  18/RA4    RPA4      --      Axis 3 B          "          "

To achieve higher performance from a less expensive platform like the Atmega, an external up/down counter could also be added, which would be read by the firmware via the digital inputs.

Support for homodyne interferometers is currently a "works-in-progress" so nothing is currently polished in the same way as µMD2 for heterodyne interferometers. :)

Quad-A/B to up/down converters

For most of these schemes, the quadrature-A/B (digital) inputs must be converted to up/down pulses to increment or decrement the counters that represent displacement. Here are several possibilities:

The first one is a discrete TTL implementations. Aynchronous Quadrature to Pulse Converter should run at 5 MHz or more. But there are a pair of discrete delays and the relative propogation delays of the 74LS04s and 74F153 are critical which may be just as bad as using monostables (which would earn you an "F" in my logic design course).

With some tweaks, the maximum speed can be greatly increased and this would fit into a small PLD or FPGA.

The next one uses an inexpensive Atmega 328 Nano 3.0:

Having said all that, here is the good stuff. :) It has been tested with a Renishaw RLE10 Fibre Optic Encoder with an RLD PMI head. In "Coarse" mode, it has the basic homodyne resolution of ~40 nm (1/16th wavelength). RLE10 "Fine" mode provides an additional 4X interpolation internally so the native resolution (with no interpolation in µMD2) is ~10 nm (1/64th wavelength). Pathetic. ;-)

Homodyne firmware and GUI

The following Beta version chipKit DP32/SG-µMD2 firmware and GUI supports homodyne operation with two high speed axes (pulse up/down) and one low speed axis (quad A-B) using the above pin assignments.

This has been tested with a Renishaw RLE10 Fibre Optic Encoder with an RLD PMI head with the Atmega-based quad to pulse converter. Using the RLE10 "Coarse" mode, it has the basic homodyne resolution of ~40 nm (1/16th wavelength). Using its "Fine" mode provides an additional 4X interpolation internally so the native resolution (with no interpolation in µMD1) is ~10 nm (1/64th wavelength). Pathetic. ;-) The graphic below shows an approximately ±400 nm change in displacement at 10 nm resolution from just gently pushing down on the optical breadboard with the PMI head and planar mirror mounted on a micrometer stage. But the micrometer is way too crude for nm-scale movement.

Screen Shot of Test of Renishaw RLE10 Fibre Optic Encoder using µMD2

There may be a high performance version of the homodyne hardware and firmware in the future. Stay tuned but don't hold your breath. :)

Where performance is a total non-concern, here is a low speed Quad-A/B USB interface for the µMD2 GUI using the Atmega 328 Nano 3.0 ONLY (no chipKit at all). Three channels should be possible with performance of up to around 350 pps on each one:

Using µMD2 for DIY LIGO?

The Laser Interferometer Gravitational wave Observatory (LIGO) uses what is basically a very special (and expensive) Michelson interferometer to detect gravitational waves emanating from colossal cosmic events millions of lightyears distant. A Web search will find many publicly aavailable references. Its sensitivity to changes in the position of its mirrors is order of 1/1,000th the diameter of a proton or about 1 attometer, 1x10-18 meters. That's about 1,000,000,000 times more sensitive than µMD2 with a Plane Mirror Interferometer. So perhaps not. ;-) (But the cost was much greater also!)

However, it would be possible to demonstrate the principles of LIGO as well as to add some of the enhancements to boost sensitivity like extending the reference arm and adding multi-pass cavities on both arms. A Single Beam Interferometer (PBS cube and 2 QWPs) might be used along with a pair of high quality mirrors in each arm to multiply the effective path length and sensitivity.

At the very least, such a setup would be a very sensitive earthquake detector, though detecting black hole or neutron star collisions is out, unless they occur in our Solar system (which would probably be bad). ;-)

The Future

As of Fall 2017, the chipKIT DP32 is no longer available from Digilent, though until Winter of 2019, it was still available direct from microchip as part number TDGL019. But now it appears to be certifiably gone and although Digkey sent me a "laser time buy" email on it, I rather doubt that's meaningful. And I've exhausted availability from all other distributers.

If you already have the chipKIT board or ordered µMD2, this isn't a real concern unless you are planning to duplicate your setup at a later date or would like a spare just in case something bad happens. In that case, getting another chipKIT DP32 board would make sense. I have purchased enough of these to handle anticipated demand for the next year or so, but a longer term solution is now called for. But the number is going down fast.

There are several options for the µMD project going forward:

  1. Design a custom PCB that would provide the functions of the chipKIT DP32 along with the line receivers, connectors, and environmental sensors. The PIC, or an equivalent, should continue to be available for the foreseeable future, though it may eventually need to be an SMT version. I have a monitor placed on microchip's "end-of-life" watch should the PIC32MX250F128B-I/SP (the 28 pin DIP version) be scheduled to go out of production. Then I could just buy up a lifetime supply. :) Laying out a PCB is no problem, but this approach would also require having the boards assembled (stuffed with parts and soldered), programmed, and tested.

  2. Switch over to another PIC-based Arduino compatible board. The recommended replacement for the chipKIT DP32 is the Digilent µC32. However, the µC32 appears to NOT have some of the essential features required for µMD2 - notably external clock inputs to the the Timers. And a separate widget board "Shield" would need to be added for the "peripherals" and both the cost and complexity is therefore somewhat greater.

    For this to be viable, the PIC must have a minimum of 4 high speed counters (microchip calls them "Timers") whose clock inputs can be configured to connect to external pins. Surprisinigly, most PIC32 parts even in packages with many more pins do not have this capability.

  3. Redo µMD2 using a different microprocessor or FPGA. (µMD2!) A possible solution is the Cypress CY8CKIT-059 PSoC® 5LP Prototyping Kit With Onboard Programmer and Debugger. This has a microprocessor with FPGA so it could be an opportunity to greatly boost performance including support for lasers like the Zygo 7701/2 which have a 20 MHz REF frequency, along with better sub-wavelength interpolation and potentially even support for closed-loop control.

    Needless to say, this would be a very complex undertaking and the justification may simply not be there. Only a small number of hobbyist/experimenter types even care about the sub-wavelength interpolation, let alone Zygo support. And I have no intention of developing µMD2 for serious commercial release.

I have already begun (1) and prototypes are now available. Parts have also been ordered. This PCB includes the layout for the line receivers and environmental sensors as well as most other chipKIT features except for the EEPROM (though there is space for it). It's all through-hole except for the USB Micro B connector, which can be either through-hole or SMT. This project will proceed, but with enough chipKIT DP32 boards in stock for awhile, there should be a smooth transition.

The only downside to this approach for the user is that I do NOT intend to populate the PCBs, even for basic PIC32 functions. So a bit more soldering is involved. See the specific info in the section:

Assembly using the SG-µMD2 Board

If someone were interested in working with Jan and myself on (2) or (3) (or some other option not listed), please contact me via the link at the top of this page. However, I have no current plans to do (2) or (3) on my own.


These links open in a single new window or tab.

chipKIT DP32

  1. chipKIT DP32 Overview (PDF).
  2. chipKIT DP32 Schematics (PDF).
  3. chipKIT DP32 Reference Manual (PDF).
  4. chipKIT DP32 Reference Manual (Web page). This one appears to be much more complete.


  1. >Assembly Instructions for SG-µMD2 PCB.


  1. Install chipKIT Software
  2. MPIDE Quick Start Guide


  1. UECIDE: The Universal Embedded Computing IDE
  2. UECIDE on GITHUB (Download most versions)


  1. Arduino IDE, Refernce, Tutorials, more
  2. Atmega 328 Nano 3.0
  3. How to Burn a Bootloader to Clone Adruino Nano 3.0
  4. Arduino Playground: Rotary Encoders
  5. Encoder Library, for Measuring Quadrature Encoded Position or Rotation Signals


  1. AM2302 Digital Humidity and Temperature Sensor Datasheet
  2. BMP180 Temperature and Pressure Sensor Datasheet
  3. Sensirion - Humidity & Temperature Sensor SHT2x Datasheet
  4. MPL115A2 Humidity/Temperature Sensor Datasheet

Jan Beck's Information

  1. Interferometer Project Pages
  2. Github µMD1 GUI Source Code Repository
  3. Short Video Describing Jan's and Sam's Boards