LabNet hardware control software for the Raspberry Pi
Figures
![](https://iiif.elifesciences.org/lax:77973%2Felife-77973-fig1-v1.tif/full/617,/0/default.jpg)
Examples of behavioural setups controlled by LabNet.
A Skinner box (left) contains (a) a feeder magazine that typically has a photo gate for nose-poke detection and a reward pellet dispenser. It also has (b) a row of LEDs and (c) a tone generator. (d) A monitor displays visual stimuli and may have a touch sensor for touchscreen functionality. The T-Maze (right) also has (a) a food magazine and (b) LEDs, and furthermore (e) an optical sensor to detect the return of the mouse to the start position and (f) two motorized doors that can be lowered to restrict access to the arms. Legend: Images and diagrams generated with TikZ.
![](https://iiif.elifesciences.org/lax:77973%2Felife-77973-fig2-v1.tif/full/617,/0/default.jpg)
Results from LabNet performance tests.
(a) Time to set a digital output as a Ping equivalent. (b, d) Latency to set a digital output in response to a change on a digital input. (c) Run the ‘read and set’ test for up to 14 IO-pin pairs in parallel. LabNet ran on RasPi 4. Tests were repeated 10,000 times and results are in milliseconds. Tests were performed on three different RaspberryPi boards: Rv2 is 2B, Rv3 is 3B+, and Rv4 is 4B with 1 GB RAM. optimized refers to the LabNet with some additional optimization flags (see main text). 1 kHz refers to the version without optimizations running on Rv4 with 1 kHz polling and max refers to non-stop polling. Box plots in (a–c) show median, lower and upper quartile, and whiskers the 2.5th and 97.5th percentiles. Data in (d) given as means and STD.
![](https://iiif.elifesciences.org/lax:77973%2Felife-77973-fig3-v1.tif/full/617,/0/default.jpg)
Latencies comparison and measurement.
(a) Comparison of execution latencies. All tools performed the same ‘read and set’ task to achieve comparability, except Whisker. Whisker server implements a 1 kHz polling frequency on the PC. LabNet for digital input polling depends on the internal RasPi 4 kHz polling frequency. Only for LabNet do the latencies include the message transfer over the Ethernet wire. Values give means with STD. LabNet was operated with a C# client. LabNet and Autopilot use the RasPi 4. (b) The latency measurement in Read and set GPIO test. The measurement RasPi generates the high ‘test’ signal, saves the time, and waits until the ‘response’ signal is also high. The time tk between these two high events is the latency. The test RasPi repeats this for 10,000 times and saves the results in a CSV file. RasPi acts here as 1 MHz oscilloscope. All packages (Autopilot, Bpod, pyControl, and LabNet) were tested in the same way. In the Stress test we have multiple ‘test’ and ‘response’ lines.
![](https://iiif.elifesciences.org/lax:77973%2Felife-77973-fig4-v1.tif/full/617,/0/default.jpg)
A complete behavioural setup controlled by LabNet.
On the left is the touchscreen chamber. (a) Feeder magazine with a nose-poke sensor and a pellet dispenser, (b) a row of LEDs, (c) a tone generator, (d) monitor displays for visual stimuli with IR touch frame sensor. In the middle is the sorting module. () three RFID readers. r2 and r3 are positioned so that the animals can be read anywhere inside the sorter and r1 so that the animal is read when it leaves the sorter. (d1, d2) Two doors to catch the animal inside the sorter and guide it to the experimental chamber or the home cage. The animals live inside the home cage and can participate voluntarily and unsupervised in the experiments in the touchscreen chamber via the sorter. Both the touchscreen system and the sorter are each equipped with their own RasPi and connected to PC via Ethernet. The sorter can be removed without electrical adjustments, because it is controlled by its own RasPi and is therefore completely independent from the touchscreen system. Then experiments can be conducted with manually introduced animals.
![](https://iiif.elifesciences.org/lax:77973%2Felife-77973-fig5-v1.tif/full/617,/0/default.jpg)
The core of LabNet is the actor environment with thread pool dispatcher.
Within the environment, the main actors are always present. The actors of the individual interfaces are started by the interfaces manager as needed. The interface actors can also outsource their work to other actors and threads. All main and interface actors can communicate with each other. The threads themselves and network communication via Boost ASIO, on the other hand, are hidden behind their actors.
Tables
Reagent type (species)or resource | Designation | Source or reference | Identifiers | Additional information |
---|---|---|---|---|
Software, algorithm | pyControl | https://github.com/pyControl/code.git | RRID:SCR_021612 | pyControl source code repository, v1.7.1 |
Software, algorithm | Autopilot | https://github.com/auto-pi-lot/autopilot.git | RRID:SCR_021518 | Autopilot source code repository, v0.4.4 |
Software, algorithm | Bpod | https://github.com/sanworks/Bpod_Gen2.git | RRID:SCR_015943 | MATLAB software for Bpod, Gen2 |
Other | Bpod | https://www.sanworks.io/index.php | RRID:SCR_015943 | r2 Bpod State Machine |
Software, algorithm | LabNet | https://github.com/WinterLab-Berlin/LabNet.git | SHA-1: 333bd58 | LabNet source code repository |