I have a constant current circuit using an op amp circuit. I am implementing a current of 21 mA to drive a laser. Spec of laser: https://www.thorlabs.com/thorproduct.cfm?partnumber=L650P007 I would like to measure the noise in the current and do FFT and other analysis. I need to measure it at every 20 ms to analyze the noise from the AC mains. Is there any method I could use to do that? I have already tried with following:
- Fluke 8845 DMM
- NI Virtual bench
- Arduino UNO
20ms is not possible. Does anyone have any idea regarding this?
This is the current measurement over time at every 120ms. The maximum I could get was at every 120ms:
Code I used for Fluke measurement:
import time
import serial
import matplotlib.pyplot as plt
# Configure the serial port settings
port = 'COM6'
baud_rate = 9600
timeout = 1
# Open the serial port
ser = serial.Serial(port, baud_rate, timeout=timeout)
ser.write(b"SYST:REM\r\n") # Put the instrument in remote mode
duration = 1200 # Duration in seconds
interval = 0.020 # Interval between current measurements in seconds (20 ms)
timestamps = []
currents = []
# Specify the file path and name to save the data
file_path = "CXXXXXX/Current/data.txt"
# Open the file in write mode
file = open(file_path, "w")
start_time = time.time()
end_time = start_time + duration
while time.time() < end_time:
# Trigger a current measurement
command = "MEASure:CURRent:DC? 1\r\n"
ser.write(command.encode())
# Read response
response = ser.readline().decode().strip()
current = float(response)
current_time = time.time() - start_time
timestamps.append(current_time)
currents.append(current)
# Write the current and time values to the file
file.write(f"{current_time:.3f}s, {current}A\n")
file.flush() # Flush the buffer to ensure immediate writing to the file
print(f"Time: {current_time:.3f}s, Current: {current}A")
time.sleep(interval) # Wait for the desired interval before the next measurement
# Close the serial connection
ser.close()
```