Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Knowledge Base Home
  • Contact Us
  • Home
  • Moku:Lab
  • Software integrations
  • MATLAB examples

MATLAB: Laser Lock Box (basic)

Written by Paul Cracknell

Updated at December 22nd, 2020

Contact Us

If you still have questions or prefer to get help directly from an agent, please submit a request.
We’ll get back to you as soon as possible.

Please fill out the contact form below and we will reply as soon as possible.

  • Moku:Go
    Moku:Go Arbitrary Waveform Generator Moku:Go Data Logger Moku:Go Frequency Response Analyzer Moku:Go Logic Analyzer & Pattern Generator Moku:Go Oscilloscope & Voltmeter Moku:Go PID Controller Moku:Go Spectrum Analyzer Moku:Go Waveform Generator Moku:Go Power Supplies Moku:Go Digital Filter Box Moku:Go FIR Filter Builder Moku:Go Lock-in Amplifier
  • Moku:Lab
    Windows Moku:Lab general Moku:Lab Instruments iPad app Software integrations
  • Moku:Pro
    Moku:Pro Instruments
+ More

Example MATLAB script to implement the Laser Lock Box (basic)

%% Basic Laser Lock Box Example
%
% This example demonstrates how you can configure the laser lock box
% instrument.
%
% (c) 2018 Liquid Instruments Pty. Ltd.
%
%% Connect to your Moku
ip = input('Please enter your Moku:Lab IP address: ', 's');

% Connect to your Moku and deploy the desired instrument
m = MokuLaserLockBox(ip);

% set frontend
m.set_frontend(1, 'fiftyr', 'true', 'atten', 'false', 'ac', 'true');
m.set_frontend(2, 'fiftyr', 'true', 'atten', 'false', 'ac', 'true');

% set input gain
m.set_input_gain

% set local oscillator, auxiliary, and scan generators
m.set_local_oscillator('source', 'internal', 'frequency', 0, 'phase', 90, 'pll_auto_acq', false);
m.set_aux_sine('amplitude', 1.0, 'frequency', 100e3, 'phase', 0, 'sync_to_lo', false, 'output', 'none');
m.set_scan('frequency', 1e6, 'phase', 0, 'output', 'none', 'amplitude', 1.0, 'waveform', 'triangle');

% configure PIDs:
m.set_pid_by_gain(1, 'g', 1, 'kp', 1.0, 'ki', 0, 'kd', 0);
m.set_pid_by_gain(2, 'g', 1, 'kp', 1.0, 'ki', 0, 'kd', 0);

% set enables:
m.set_output_enables(1, 'en', true);
m.set_output_enables(2, 'en', true);
m.set_channel_pid_enables(1, 'en', true);
m.set_channel_pid_enables(2, 'en', true);
m.set_pid_enables(1, 'en', true);
m.set_pid_enables(2, 'en', true);

% set allowable output range
m.set_output_range(1, 1.0, -1.0);
m.set_output_range(2, 1.0, -1.0);

% set offsets
m.set_offsets('pid_input', 0.1)
m.set_offsets('out1', -0.1)
m.set_offsets('out2', 0.2)

% configure second harmonic rejection low pass filter

% The following filter coefficients were generated using filter builder and implement a second order 
% butterworth lowpass filter with a 10 kHz corner frequency. 
coef_array = {{[1.0, 9.964476774385674e-05, 0.00019928953548771348, 9.964476774385674e-05, 1.9715674246898824, -0.97196600376085784], ...
[1.0, 1.0, 0.0, 0.0, 0.0, 0.0]}} 
m.set_custom_filter(coef_array)

Was this article helpful?

Yes
No

Related Articles

  • MATLAB: Arbitrary Waveform Generator
  • MATLAB: Frequency Response Analyzer (plotting)
  • MATLAB: Data Logger (streaming)
  • MATLAB: IIR Filter Box (plotting)

Sitemap

  • Moku:Lab
  • Instruments
  • Software
  • Company
  • Support
  • Store
  • Terms & Conditions
  • Privacy Policy

Offices

United States
+1 (619) 332-6230
740 Lomas Santa Fe Dr
Suite 102
Solana Beach, CA 92075

Australia
+61 2 6171 9730
243 Northbourne Avenue
Suite 2
Lyneham, ACT 2602

Follow us

Youtube LinkedIn

官方微信

Contact us
© 2021 Liquid Instruments. All rights reserved.

Definition by Author

0
0
Expand