Psycopy on a Raspberry Pi

04 March 2018

Preparing the stimuli material and hardware setup for a recent experiment I decided to try to have it running on a Raspberry Pi 3 Model B. Why would a raspberry make any sense as the core of a neuroscience/psychology experiment you might ask?

  • It makes your setup inexpensive and standardised, aka easy to reproduce either for you (more than one experiment running in parallel) and for other researchers trying to reproduce your results.
  • It is fast to clone, save and switch your setup as it's all stored on a cheap micro-sd card.
  • It is quiet, which was the decisive factor as my MacBook fans have the tendency to scream whenever I try to use an external monitor .

Setup The experiment setup with a disassembled Apple Cinema Display

Getting Psycopy running on Raspbian is straightforward but the apt-get distributed version is outdated (1.83.04) but getting a newer version is possible following the manual installation and possibly having to go after a few extra python dependencies.

In order to get the best performance possible out of it, I would also suggest a mild overclocking and passive cooling.

The bad The included benchmark doesn't have any pity for the poor Raspberry.

And now the bad: the Raspberry Pi 3 is still quite slow, and it is quite evident, from the included performance test, that low-level vision research on complex stimuli material is out of the question. The benchmark returns in my case, even on the overclocked raspberry a awful refresh stability of 189ms (it should be <0.5ms).

Not all is lost, simple experiments with simple/static material are still possible with a much lower variability, this has to be assessed nevertheless as you design your experiment.

Another concern when using a raspberry is back up, sd-cards are prone to failure and I would not store any important data in it for a long period of time. If you can have internet access from the experiment location neat solution is to push to the cloud your results as soon as you finish writing to the files. Rclone works very well under Raspbian and supports all the major cloud storage services. Here's an example, it is advisable to push only the latest results instead of overwriting every time all the results in the destination folder.

    system("rclone copy /home/pi/Documents/yourExperiment/"+singleFileName+"  dropbox:destinationFolder/" )
    system("rclone copy /home/pi/Documents/yourExperiment/"+resutFileName+"  dropbox:destinationFolder/" )
    print("error uploading!")

go back home