Reading in ID from outside of psychopy


I have what I assume is a unique problem.
I work with nonhuman animals, and we are implementing a new system. With this system, the windows laptop will be reading in an ID number (the ID comes from the animals microchip) from a raspberrypi system. The end goal would be that if the correct ID is read, then the psychopy program becomes active. If no ID or the incorrect ID is read, the mouse will be disabled and a black screen will cover the program. This way, the program is only operable if the correct animal approaches. We haven’t perfected the ID reader yet, but while we are working on that, I wanted to see if what I am hoping to do is possible through psychopy? Would psychopy read in a number from an external program? I assume if it can read in the number I will just need to create a conditional routine, and if no/the wrong ID is read then it stays in that routine, but if the correct ID is read, move to the next routine which is the actual program.


Hi @bjackson55,

If the raspberrypi system is connected to the laptop running your PsychoPy experiment via a serial port (which I’m guessing it will be?), it is possible to read in data from that serial port and set up that conditional routine in the way that you’re describing here. There’s some information on reading in data from a serial port via an Arduino here.

Hope this helps!