Skip to content

The trigger box connects the ASIL clock infrastructure with external devices (like EEG)

Notifications You must be signed in to change notification settings

ArtScienceLab/ARDUINO_TriggerBox

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The MIDI trigger Box

The MIDI trigger box is a device which helps to synchronize external devices with a TTL clock.

When the trigger box is enabled two things happen: First the recording state is changed from zero to one. The recording state is available via a BNC connector on the device. The second thing that happens is that the clock input is copied to the output. The following gives an overview:

INPUT
Clock IN
_|---|___|---|___|---|___|---|___|---|___|---|___|---|___|---|___

OUTPUT

Recording State  
_________________________|--------------------------------|________

Clock Out        
_________________________|---|___|---|___|---|___|---|___________

How to use

There are two ways to change the recording state.

  1. Button the button is changed from OFF to TEST. When OFF the recording state is OFF. When Test, the recording state is ON. If the button is used a NOTE ON MIDI message is send over the USB connection and a NOTE OFF message is send when it off. This enables users to track the button change in a DAW software system. Ignore this note on message
  2. MIDI When connecting the trigger box via a USB cable to a computer it is recognized as a standard MIDI device. When sending a MIDINOTE ON message on MIDI channel 13, the recording state is changed to ON. A MIDINOTE OFF message switches the recording state to OFF. So while a “key” is pressed the recording is enabled. Note that only NOTE ON and OFF messages are only

Scenario – Condition with varying length and EEG

In this scenario there is a task a participant needs to execute of unknown length while EEG is being recorded. The EEG system needs to be synchronized with Ableton, where for example, audio is recorded. In this case it is best to use the trigger box button to send a sync signal to both Ableton and the EEG System.

When the button is used to start the recording, a MIDI NOTE ON is send to Ableton and simultaneously the trigger connected to the EEG system is set to HIGH. When the recording is stopped a NOTE OFF is send to ableton and at the same time the trigger is set to low in the EEG system.

In post-processing the start and stop times need to be compared and the difference used to synchronize the signals.

Visualization of analog measurements
The trigger box button sends stop sync markers to an EEG system and to Ableton or an other DAW which is recording MIDI

Scenario – Condition with constant length and EEG

In this scenario the condition has a predetermined length, e.g. 30 seconds. Then Ableton can be used to drive the trigger box. When Ableton sends a NOTE ON on MIDI Channel 13, the recording is started. After 30 seconds a NOTE OFF stops the recording. The trigger box sets the recording pulse to HIGH when the NOTE ON is received and to LOW when the NOTE OFF is received. The advantage is that each recording has the expected length exactly.

An example of this setup can be found in the examples directory.

Visualization of analog measurements
Ableton sends start and stop sync markers to an EEG system using MIDI note of predetermined length

Scenario – Condition with constant length and a sensor

This scenario is similar to the previous scenario only we here use a sensor which responds to clock input in stead of an EEG system. When the recording is started (with the NOTE ON) the clock input is passed through the trigger box. The sensor starts capturing and measures on each clock pulse. It reports sensors measurements back to Ableton.

In this case the sensor only measures when the recording.

Visualization of analog measurements
Ableton sends start and stop messages system using a MIDI note of predetermined length. This pulse acts as a gate to let a clock input through or not. The sensor is only active during the time the ‘gate’ is open: in effect while the recording is ongoing

Hardware

To meet the requirements of being a standard MIDI device and a device that is capable of sending out 5V signals two microcontrollers are used.

A Teensy 3.2 drives the system and reacts to the buttons and MIDI messages. It sends out the recording state and the clock output but at 3.3V.

An Arduino is used to send out the 5V TTL. It is simply copies the recording state and clock output it gets from the Teensy and immediately sends it through via the connected BNC connections.

Possible improvements

Currently the 5V output depends on the output of the connected USB port. The output clock might not be a clean, stable 5V block wave but perhaps more 4.8V.

There are two microcontrollers in the system. One for USB MIDI compatibility and one for 5V output. Replacing the two microcontroller with one that is capable of both 5V out and MIDI compatibility would be an improvement.

Structure

In the arduino folder two arduino patches can be found. One called passthrough which is for the Arduino that passes messages through. The other is a platformio project for the Teensy with the main code in src/main.

Credits

Joren Six at IPEM, University Ghent

About

The trigger box connects the ASIL clock infrastructure with external devices (like EEG)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages