Lets create a replacement for the HP5508A interferometer display.


Helium-Neon Laser based interferometers are fun to play with, and the appropriate lasers come up relatively cheaply on ebay from time to time. However, the necessary display is quite a rare find, and when you do find it, it is pricey.

So I wanted to make a microcontroller based replacement.

At its core, the control unit is two counters that run up to about 3 Mhz or so. The electrical signal from the laser as well as the sensor is a  capacitatively coupled differential signal. We can approximate the input stage of the HP5508A and use a UA9637 to turn that into something the microcontroller can deal with.

I chose a PIC based microcontroller reference board from Digilent, because they are cheap and good. This will also make it very easy to reproduce for anyone who would like to do so. The board I chose is the ChipKit DP32.

Very few external parts are necessary. And the breadboard area makes it easy to install them. Here is a picture how to wire it up:

To program the firmware on the DP32 board, all that is needed is MPIDE, available at: http://chipkit.net/started/install-chipkit-software/

I used the mpide-0023-windows-20140821 version. After decompressing the files, simply launch MPIDE.exe

Next, depending on the OS and version you are running, you may have to install the driver to get this board recognized on your computer. The drivers are included in the MPIDE development environment in the drivers\chipKIT Drivers subfolder.

Next, download this file and open it in MPIDE: https://sites.google.com/site/janbeck/interferometer.pde

Then, select the DP32 board from the menu by going through Tools->Board->ChipKIT->chipKIT DP32

You should now be able to compile the file by going to Sketch->Verify/Compile

Next, we have to program the board. The programming procedure for the DP32 board is as follows.

1. Make sure you are plugged into the USB port
2. Press the reset button

3. keep the reset button held and press the  PGM button

4. Keep the PGM button pressed and release the reset button

5. Release the PGM button.

The LED1 on the board should now blink rapidly.

Then, just go to File->Upload to I/O Board

Wait a few seconds. The board will be programmed, reboot and come back up as a serial port. It will start pumping out data as soon as you open the port. You can check by going to Tools->Serial Monitor. 

The chosen baud rate seems to make no difference(as a USB connection is not actually a serial port), but the rate set in the code is 115200.

You now have a working HP5508A replacement. If you are content with a serial display, you are done. But if you want a full GUI, then you can find one here:

The message format is as follows:

String   Firmware Variable          Function
   0      displayREFCount          REFCount  - PrevREFCount
   1      displayMEASCount         MEASCount - PrevMEASCount
   2      displayTotalDistance     Distance
   3      displayVelocityCount     Distance  - PrevDistance
   4      displayPhase             Interpolation
   5      displaySequenceNumber    Serial Number
   6      displayLowSpeedCode      Low speed data select (see below)
   7      displayLowSpeedData      Low speed data (see below)

displayLowSpeedData format (which one is sent depends on displayLowSpeedCode):

Code    Firmware Variable     Function
0                            No extra data
1      LaserPower            Laser beam power
2      MEASSignalLevel       MEAS signal power
3      Temperature Sensor 1  Temperature 1
4      Temperature Sensor 2  Temperature 2
5      Pressure Sensor       Pressure
6      Humidity Sensor       Relative humidity
7                            ID: 1=actual data, 0=Test Mode
8+ Spare

The design of the firmware is based on 3 free-running counters:

The first  counter (1) runs/counts on the internal clock
The second counter (2) (using the Timer3 hardware) runs/counts on one of the two external signals from the interferometer
The third  counter (3) (using the Timer5 hardware)     runs/counts on one of the two external signals from the interferometer

(1) raises an interrupt on overflow.
Since all three are 16 bit counters and (1) runs much faster than the other two, it can check for overflows for them

Because the USB connection is used for both programming and data transfer, there is a peculiarity with the DP32 function that affects the USB enumeration when it gets plugged into the computer. To make this work, the setup() function calls a delay(1000). This is probably not necessary if you port this code to another board that has a dedicated USB bus.

There are two functions that do all the actual work. One function, "handlerForTimer1Ints()", handles the (1) overflow interrupt, which happens at a rate of about 610.35 Hz.

The other function, "loop()", handles the transfer of the data over the USB bus.

Here a picture of the first two units, one of which went to Sam Goldwasser.


Google Group


Jan Beck,
Oct 24, 2015, 1:12 PM