Using PyPhotometry with National Instruments USB-DAQ card

127 views
Skip to first unread message

YS L

unread,
Sep 6, 2022, 5:26:33 AM9/6/22
to pyControl
Hi everyone,

I want to ask if anyone has tried to use the PyPhotometry GUI software to run a fiber photometry system connected to the National Instruments USB-DAQ card?  Will this be possible or am I required to purchase the acquisition boards to use pyPhotometry GUI? 

I already have a fibre photometry hardware set-up ( using the NI-DAQ), I am looking to try if I could use pyPhotometry GUI to run my experiments. 

What I need to do is to use behavioural tracking software ANYmaze to send a trigger TTL output to the pyPhotometry GUI that informs the fiber photometry system to start recording. 

Please let me know if you have done it before or if you know it can be done.

Thank you,
YS 

Thomas Akam

unread,
Sep 6, 2022, 9:34:04 AM9/6/22
to pyControl
Hi Ys,

The standard pyPhotometry GUI would not work with a national instruments DAQ card.  It might be possible to write code to interface the GUI with an NI DAQ card (assuming National Instruments provides a Python API for their hardware), but it would certainly be quite a bit of work.  If you have an exisiting photometry system that you want to interface with the GUI, you could probably use a Micropython Pyboard (the microcontroller that is mounted on the pyPhotometry board) as the interface, by connecting the pins on the microcontroller to the inputs and outputs of the photometry system. You can see which pin is used for what in the schematic of the pyPhotometry board (here).  Pins X11 and X12 are used to record the analog signals from the photodetectors,  pins X5 and X6 are analog outputs used to control the LED current, pins Y7 and Y8 are digital inputs. 

Currently it is not possible to trigger the system to record using an external input, but you can record the state of 2 external digital inputs to the data file so you could record the TTL signal output by Anymaze and then do the alignment later.

best,

Thomas

YS L

unread,
Sep 6, 2022, 1:11:38 PM9/6/22
to Thomas Akam, pyControl
Hi Thomas,

Thank you for your quick response. Yes I believe that NI have a Python API  (https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019Pf1SAE&l=en-SG)

on the other hand,  following your advice, must I use Micropython Pyboard V1.1 ( which is the same as the one mounted on the acquisition board)? Could the Pyboard Lite V1.0 work as well?  https://store.micropython.org/product/PYBLITEv1.0


image.png

thanks,
YS
 
--
You received this message because you are subscribed to the Google Groups "pyControl" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pycontrol+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/pycontrol/9eec6b28-a64a-44f9-9218-7afd1665a183n%40googlegroups.com.

Thomas Akam

unread,
Sep 7, 2022, 9:09:20 AM9/7/22
to pyControl
Hi YS,

The pyboard lite does not have pins that support analog output (see feature comparison table here).  These are used in the standard pyPhotometry setup to control the LEDs, as this allows for control of the led current from the software.  As you would be using external LED drivers anyway, you could probably use digital output pins to trigger the LED drivers instead.  This would require making some small modifications to the code that runs on the pyboard, but this would be simple and I'm happy to help with that if you do decide to give it a try.  Otherwise, I think it should work OK, though I have never tried it so can't be 100% sure it will work.

best,

Thomas

YS L

unread,
Oct 18, 2022, 6:21:06 AM10/18/22
to pyControl, Thomas Akam

Hi Thomas,

I have gotten the PYB v1.1 as suggested and am ready to connect my current setup to the PYB v1.1. I am new to this, I would appreciate it if you could kindly guide me along. For starters, please see an image of my current setup connected to the NI-DAQ IO interface, I used a wire to connect to the NI DAQ. Does it mean I need to disconnect these wires and connect it to the PYBv1.1? And how should I connect them physically?

IMG_20221018_163859.jpg
IMG_20221018_170806.jpg


Thanks for your help
YS

thoma...@gmail.com

unread,
Oct 18, 2022, 12:40:58 PM10/18/22
to pyControl
Hi YS,

The pyboard pins used by pyphotometry are:

X5 : LED driver 1 output
X6 : LED driver 2 output
X11 : Photodetector 1 analog input.
X12 : Photodetector 2 analog input. 
Y7   :  Digital input 1
Y8   :  Digital input 2

The LED driver outputs are analog signals which are 0V when the LED is of and between 0-3.3V (depending on the LED current set in the GUI) when the LED is on.

The photodetector inputs are analog inputs from the photodetectors.  These pins can read signals between 0 and 3.3V and should not be given input >3.3V as this can damage them.

The digital input pins can recieve input up to 5V.

The pins on the pyboard marked GND are grounds and you will need to connect each external device (photodetector, LED driver etc) both to the corresponding control pin and a ground pin (as with your current setup where the black wires are presumably going to ground on the NI board.

To physically connect to the pyboard pins you could either solder wires to them directly, or solder on a screw terminal block or similar connector.

Let me know how you get on,

Thomas
Reply all
Reply to author
Forward
0 new messages