Stepper Motor Controller for Scanning Raman Spectrometer

We have a fairly old Raman spectrometer (from 1980s) in modern physics laboratory. The model is SPEX1403 with spectral resolution 0.15cm^-1. This is not a modern CCD spectrometer which just readout all the pixels to get the spectrum in a second. This spectrometer need to rely on a stepper motor moving gratings scanning across the desirable spectrum range.

IMG_4216 4
SPEX1403 Spectrometer


However, the controller of this spectrometer is too old and finally fails. Thanks to the carefully protection and maintenance of professors, the optical and mechanical parts of the spectrometer are still working smoothly. Instead of throwing it away, I decided to design a new generation of controller to give it a second life.

IMG_4222 3
Specontrol for SPEX1403/4

I choose STM32 as the microcontroller, using USB CDC (AKA: Virtual COM Port, VCP) as the communication interface. The system is really simple and mostly bases on a piece of cheap STM32F3-Discovery board.

I also rewrite the LabVIEW driver for this homemade controller.

IMG_4223 3
Experiment Setup

Measurement of Electron Drift in Gas

This project aims at measuring the velocity of drifting electrons triggered by UV laser, which can be considered as a prototype of the TPC (Time Projection Chamber) laser calibration system. The introduction includes the following aspects: the design of the system, data collection, data analysis and preliminary results.

Whole System

High voltage is applied to the MPC (Multiwire Proportional Chamber) to generate a uniform electric field. Treated as a point-like particle, the laser-stimulated electrons in the field will reach a constant velocity in the working gas soon after their appearance. Since the accelerating time is short, we can assume the drifting time is approximately proportional to the drifting distance. Through a linear fit, we can get the drifting velocity of certain kind of working gas.

The Drift Chamber

The system is designed under the principle of automatic control. The motion of MPC is dominated by a stepper motor, which is controlled by computer. The theoretical precision of motion is approximately 1 μm. The amplified signals of Laser and MPC are sampled and shown on oscilloscope. The connection between computer and oscilloscope ensures the arbitrariness of data collection. We write a LabView program to manage both of these. Abundant data are collected on each position and then exports to a file.

Apparatus Sketch
Data Acquisition based on LabVIEW

In order to calculate the drifting velocity from amplitude varied data, special strategy should be applied. For each group, we find the average of maximum and minimum. Then we fit the data (either ascending or descending slope) to obtain its linear regression equation and solve for the time on that average level. The average of these time spots can be considered as the drifting time of the point. Linear fit these drifting time points to derive the drifting velocity.

Signal Analysis & Fitting

The working gas we adopted was 9.97% Methane in Argon. We sampled 20 times for each point, with total 10 sampling points in all. The drifting velocity we find is  u=(4.840±0.053)×10^4 m/s and is also supported by other researches.

Drift Time vs Drift Distance
Results from other sources


Tabletop weather station

This is a super wireless tabletop weather station.

It collects all weather information including temperature, barometric pressure, humidity from its remote stations thorough wireless connection. The wireless connection is provided by NRF24L01 2.4GHz IC along with a protocol written by myself.

This is the main station sitting on my desk. Cold outside in Beijing!


This main station is connected to ethernet through wired connection, and has a simple HTTP interface for user interaction.

The remote station, installed in our balcony. Solar cell powered so no extra wire is needed to work 24/7.


Data collected by main station (from several remote stations) will be uploaded to my server and saved into database. A php script is used to render some graph for analysis.


FPGA based high speed real time data recorder

This project builds a FPGA controlled analog card that can transfer sampled analog data to computer through USB 2.0 interface. I have achieved over 30MB/s stable real time data recording using this device. Data are received by a libusb based python script and written into hard drive. So the recording length is totally limited by the free space of your hard drive.

This is the device itself.

Analog Device: AD8023 40MS/s 10bit ADC, Xilinx: Spartan-6 XC6SLX25 FPGA, Cypress: CY7C68013 USB 2.0 controller


A hertz level sine wave recorded by this device. The data file is 200MB in size and I use mmap to speed up the reading process and prevent memory overflow. I have tested to record for more than a minute, it did not lose any packet!fpga_analog_recorder