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
  • Moku:Lab Instruments
  • Moku:Lab Laser Lock Box

Can I set a lower corner frequency for the lowpass filter in the laser lock box?

Written by Paul Cracknell

Updated at July 12th, 2021

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

Moku:Lab laser lock box uses a 2-stage second-order IIR filter. In the iPad app, the filter defaults to 1-stage or 2-stage second-order filter only. As we have a limited number of bits during the calculation, this limited us to a ~1 kHz corner. In order to get a filter with a lower corner frequency, it is possible to manually load a 2-stage first-order filter, which should work at or below 1 Hz.
To manually load a custom filter, select the custom filter type in the filter configurator, and then load the filter coefficients from a .txt file in the SD card, clipboard, or My Files, as shown in the screenshot below.

The .txt file should have two rows, six columns with the following format:

s1 b0.1 b1.1 b2.1 a1.1 a2.1
s2 b0.2 b1.2 b2.2 a1.2 a2.2

s1 and s2 refer to the overall gain for stage 1 and stage 2. bx.1 to ax.1 represent the filter coefficients for stage 1, and bx.2 to ax.2 represent the filter coefficients for stage 2. These filter coefficients can be generated by Python scipy or MATLAB with Signal Processing Toolbox. Here, we provide a Python script to generate the .txt file.


import numpy as np
import matplotlib.pyplot as plt
from scipy import signal
import math


def main():
corner_frequency = 1 #in Hz
filter_type = 1 #1 for first order 2-stage, 2 for second order 1-stage
generate_filter_array(corner_frequency,filter_type, plot = False)

def generate_filter_array(corner_frequency,filter_order,plot):
sample_rate = 31.25e6
normalised_corner = corner_frequency / (sample_rate / 2)
if filter_order == 1:
b, a = signal.butter(1, normalised_corner, 'low', analog = False)
a = np.append(a,0)
b = np.append(b,0)
gen_coe_array(b, a, filter_order,str(corner_frequency)+'Hz'+str(filter_order)+'order_filter')
if plot == True:
plot_fra(b,a,filter_order)
elif filter_order == 2:
b, a = signal.butter(2, normalised_corner, 'low', analog = False)
gen_coe_array(b,a,filter_order,str(corner_frequency)+'Hz'+str(filter_order)+'order_filter')
if plot == True:
plot_fra(b,a,filter_order)


def plot_fra(b,a,order):
w, h = signal.freqz(b, a, worN = 2048*2048)
if order == 1:
h = np.multiply(h,h)
plt.semilogx(w*sample_rate/math.pi/2, 20 * np.log10(np.absolute(h)))
plt.title('Butterworth filter frequency response')
plt.xlabel('Frequency [Hz]')
plt.ylabel('Amplitude [dB]')
plt.grid(which='both', axis='both')
plt.show()

def gen_coe_array(b,a,order,name):
if order == 1:
coefficient_array = [[1.0, b[0], b[1], 0, a[1], 0],
[1.0, b[0], b[1], 0, a[1], 0]]
elif order == 2:
coefficient_array = [[1.0, b[0], b[1], b[2], a[1], a[2]],
[1.0, 1.0, 0.0, 0.0, 0.0, 0.0]]
np.savetxt(name +'.txt',coefficient_array, delimiter = ',')


if __name__ == '__main__':
main()

Was this article helpful?

Yes
No

Related Articles

  • Can I adjust the corner frequency of the low-pass filter?
  • What if my actuator can't take negative voltages?
  • If Moku:Lab only has two output channels, how is it possible to generate feedback control signals as well as the modulation tone and scanning waveform?
  • What is the input to output latency for Laser Lock Box

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