Articles on: XDAQ

Simple close-loop control with XDAQ

Close-loop control has been a popular request and it has been queued up in our development list. In the mean time, here is a rudimentary, threshold-based detection already implemented in the XDAQ and can be used for close-loop experiments.

Let’s use an example to illustrate how this might work. In this example, we want to use a channel (channel A-008) that has active SU activities with spikes having amplitude of 200µV or higher. We want to use it to trigger an electrical stimulation to an electrode site (channel A-001) every time this unit fires.

To do this, run the XDAQ RHX application available from our Github.

First setup a stimulation pulse on A-001 by moving the curser to A-001 on the waveform window. And click on the "Set Stim" button on the left panel. In the "Trigger" group box, click Enable. Change Trigger Source to “DIGITAL IN 9” (or an available channel). Set the stimulation waveform to the desired parameters and click OK.

Then move the curser to channel A-008 on the waveform window and go to the “Close-loop Control” tab, and enable Circuit 1 ("C1") and click "Set." Select the appropriate Filter from the dropdown list to Pass Through (PT). Set the Trigger to Threshold "Thresh" and specify the value to say 180 µV.

Once the threshold condition is satisfied, a digital out pulse will be sent on channel DO1. Finally, use a BNC patch cord to connect the DO1 to DI9 on the XDAQ and XDAQ IO expander (since XDAQ supports only up to 8 Digital IN channels). Obviously, one could connect the patch cord to another device to be controlled (ie tone generation, drug delivery and etc). Using this method, the latency between threshold detection and digital out trigger should be well less than 500µs.

Features coming soon in next software release:
up to 32 detection circuits
Ability to assign arbitrary digital out channel
Additional filters: high pass filter and low pass filter only
Ability to disable sending the filtered signal to an analog output or to an arbitrary analog out channel

If you have suggestions on how we might improve the close-loop control or make it more suitable for your application, please contact us at or drop us a message using the chat box on our website.

Updated on: 12/03/2023

Was this article helpful?

Share your feedback


Thank you!