8 Laser Controller
alphonse edited this page 2025-04-06 01:08:30 +00:00

Background

The PAS has 3 lasers (blue, green, and red) that are all housed in a single module in the instrument. The laser modulation is done with the PWM output of a Raspberry Pi Pico 2 development board (RP 2350 chipset). The Pico accepts serial commands from the host computer and controls the laser settings accordingly.

Definitions and conventions

  • Center Frequency: The center frequecy should be set to the resonant frequency of the cell. The firmware will set the frequency of the green laser to the center frequency. It will set the frequency of the blue laser to the center frequency - 6 Hz and the red to the center frequency + 6 Hz. Must be an integer.
  • Blue Laser: The laser connected to pin 1.
  • Green Laser: The laser connected to pin 4.
  • Red Laser: The laser connected to pin 9.
  • Frequency Sweep: Begin at center_frequency - n Hz and increase the frequency by 1 Hz every 2 seconds until reaching center_frequency + n, where n is any integer. This is not currently useful -- use the sweep software instead!
  • Indicator LED: By default, the Pico will flash the on-board LED when powered on. This may be turned off with toggle.off.
  • For ADC reads, the rate is hard-coded to 10000 S/sec and 1000 samples total.

Serial Communication

Any serial monitor program can be used to connect to the Pico. An easy solution is to install/open the Arduino IDE, choose the Pico in the Port menu, and then open the serial monitor. Other options include Minicom and Putty (see below for Minicom instructions).

Note that the Arduino serial monitor, or any other serial interface, must be closed when performing a frequency sweep!

Serial commands

The Pico laser controller operates at a 115200 baud and assumes a line end of \n.

The Pico laser controller understands the commands in the table below. Any other commands will return Command not recognized. Default values in bold. When echo is True, the Pico will echo each command received to the serial port and send a confirmation string once the requested action has been taken.

Command Action
*idn? Return identification string
f.[x] Set the center frequency to x.
The center frequency = green frequency.
Blue freq. is set to x - 6 Hz.
Red freq. is set to x + 6 Hz.
f.? Return the current center frequency.
[b/g/r].[on/off] Turn the blue/green/red laser on/off.
sweep.[n] Conduct a frequency sweep in range center freq. +/- n
toggle.[on/off] Toggle the indicator LED on/off.
echo Toggle command echo on and off.
adc.read Get waveform on pin 26.

Connecting with Minicom

The command to connect with Minicom is:

minicom --device /dev/ttyACM0 --baudrate 115200 -w

The device name/number may change.

Once in minicom, press CTRL+a, z then e for echo mode.

Controlling the Lasers in Julia

The lasers can be controlled directly via the serial port, or via wrapper functions in Julia.

  1. Open a new Julia REPL by opening the terminal and typing julia.
  2. Type ] to enter the pkg> prompt, then type activate Photoacoustic.
  3. Press backspace to exit pkg, then (when back at the julia> prompt), type using Photoacoustic.
  4. Now, you can use Julia to turn the lasers on and off with the commands blueOff(), blueOn(), greenOff(), ..., and so on. The functions take no arguments.