Multi-instrument data logger trigger Python API

Hello,

I’m trying to build a sound calibration setup and I’m using Moku:Go to acquire the sound played (with the help of a microphone and a conditioner). To play the sound, I’m using another piece of hardware which is able to play the sound from an external digital trigger. So, my idea is to send a 5V DC signal to that piece of hardware with the Waveform Generator and at the same time use the Data Logger to acquire the sound being played. I managed to use the multi-instrument feature in the Moku app to synchronize the start of the sound with the start of the acquisition, but setting the output of the Waveform Generator as a trigger to the Data Logger. However, I’m not able to do the same with the Python API, because I don’t know how to define “Input B” as the trigger.

Next, a figure containing the multi-instrument I’m using in the app and the (not working) code I have so far to achieve my goal are shown.

from moku.instruments import MultiInstrument, WaveformGenerator, Datalogger

mim = MultiInstrument("address", force_connect=True, platform_id=2)

wg = mim.set_instrument(1, WaveformGenerator)
dl = mim.set_instrument(2, Datalogger)

mim.set_connections(
    [
        {"source": "Slot1OutA", "destination": "Slot2InB"},
        {"source": "Slot1OutA", "destination": "Output1"},
        {"source": "Input1", "destination": "Slot2InA"},
    ]
)

print(mim.get_connections())

mim.set_frontend(1, impedance="1MOhm", coupling="DC", attenuation="-14dB")
mim.set_output(1, "0dB")
mim.sync()

dl.set_samplerate(250000)
logFile = dl.start_logging(duration=3, trigger_source="Input2", trigger_level=2.5)
wg.generate_waveform(channel=1, type="DC", dc_level=5)
wg.generate_waveform(channel=1, type="Off")

Additionally, I would like to ask if the start_logging will stop the execution of the program until it is triggered, because if it does, this solution is not going to work (despite being possible to do it in the app).

Thank you in advance for your help!

Hi @Jose.Grilo

Sorry about that, triggered data logging is not available in Multi-Instrument mode yet. The team is working on it at the moment!

As for start_logging, this will not interrupt the execution of your following code. You’ll be able to set the waveform generator to trigger your set-up after starting the logging session and before the logging is triggered.

Hi,

Thank you for the answer!