TTL inputs for syncing

64 views
Skip to first unread message

Hannah Wirtshafter

unread,
Apr 14, 2022, 4:00:26 PMApr 14
to Miniscope
Hi, I've read over some conversations on the board about TTL syncing that seems to indicate TTL can only be used to start a miniscope recording, but not throughout. I have a stimulus that will go off throughout recording that uses a TTL pulse. If I sync the miniscope at the start of the recording that should be enough to have it synced throughout (though of course I would love if it would be possible/easy to mark every stimulus occurrence). Would the easiest way to do this be to send a stimulus signal (sans animal) to start recording, then unplug the TTL input from the miniscope (to maintain recording) then plug the animal in and start the session? This seems like it should keep everything synced and ready but I may be overlooking a simpler way to do this or some other issue.

Many thanks!
Hannah

Hannah Wirtshafter

unread,
Apr 18, 2022, 3:50:18 PMApr 18
to Miniscope
To be clear, it would be ideal to have syncing pulses throughout

Nat Kinsky

unread,
Jun 2, 2022, 1:14:13 PMJun 2
to Miniscope
I have the same issue.  In my case I am also recording LFPs, so my solution was to dump the timestamps of each frame grab from the miniscope (TTLs from port 2 on the miniscope DAQ) and the other TTL (a tone presentation in my case) into our Intan acquisition system and use the timestamps recorded for each TTL in Intan to align everything.

You could probably achieve the same thing by sending the TTLs from the miniscope and other system to an arduino or National Instruments card and log the system time for each TTL, though there will definitely be some latency between the actual TTL time and recorded time that you'll need to account for.

Nat


Daniel Aharoni

unread,
Jun 16, 2022, 11:49:45 PMJun 16
to Miniscope
Hi Hannah,
Possibly if you unplug the trigger input after trigger the start of recording the DAQ will pull the pin low and treat this unplugging event as a signal to stop recording. But in theory yes, if you have a common "start" time-point then you can sync up everything else offline based on recorded Miniscope timestamps.

The hardware of the DAQ is capable of recording and timestamping each TTL input but we have never gotten around to implementing this in firmware/software. It is on our TODO list but likely won't get around to it in the near future.

Hannah Wirtshafter

unread,
Jun 20, 2022, 12:51:11 PMJun 20
to Miniscope
I actually already modified the source code so a pulse turns on recording but the falling edge won't turn it off! Seems to work well on a few tests to align a start point
I was working on implementing timestamping each TTL input but I am unsure what .cpp I should stick it in. datasaver.cpp seemed a good bet but that doesn't have access to ttl on/off as far as i can tell (I am not very proficient in c++ )! Any suggestions would be appreciated! :)

Daniel Aharoni

unread,
Jun 22, 2022, 6:31:47 PM (13 days ago) Jun 22
to Miniscope
Yea, timestamping each TTL input likely will be quite involved. As you mentioned, datasaver.cpp doesn't actually have access to any individual Miniscope data stream since each Miniscope/camera connection is handled in a separate parallel thread. To do this, you would want to update the DAQ firmware such that it can timestamp and potentially buffer TTL inputs. Then you would want the DAQ software to poll the DAQ firmware for new TTL input events at the end of each frame acquisition from within the thread handling DAQ/camera communication. Finally, you would want to add a new thread safe buffer in software to store these TTL input events/timestamps and give datasaver.cpp access to this buffer in order to write them to disk.

Hannah Wirtshafter

unread,
Jun 23, 2022, 11:53:07 AM (13 days ago) Jun 23
to Miniscope
ok yeah I'll stick with just syncing the start times for now :) thank you!
Reply all
Reply to author
Forward
0 new messages