The following README.md describes the procedure for developing and installing the PiNe Box including the user interface. The PiNe box is an enclosed device run with a Raspberry Pi that allows for the simultaneous triggering of events and time stamping between an EEG system as well as an external Vital Signs monitor. The system runs a Python UI that reads in TTL triggers from external triggering devices (that are simultaneously sent to an EEG amplifier) and sends a UDP message to the Vital Signs monitor via an ethernet network link. A GUI allows the user to select the appropriate IP address and listening ports.
These instructions are for six input triggers (Push Button, Lance, Tactile, Auditory, Visual and Experimental/Pin Prick stimuli) using TTL specification and the vital signs system is currently assumed to be iXTrend developed by iXcellence: https://www.ixellence.com/index.php/en/home/17-default-en/products
Developers: Kirubin Pillay, Maria Cobo Andrade, Caroline Hartley, Alan Worley 07/06/2021
Paediatric Neuroimaging Group, University of Oxford, Oxford, UK.
Great Ormond Street Hospital, London, UK.
Version 1.0 (Released 07/06/2021)
A manuscript is currently in development and will require citing once published. The citation will be provided here.
To develop the PiNe box, this repository contains the following information:
The OS software instructions assumes a recent version of Raspbian Jessie is already installed on the Pi. The Python UI code requires Python 3.7.0 or higher.
git clone https://github.com/kpillay/PiNEbox.git
cd PiNEbox.
pip install -r requirements.txt
The Pi typically comes installed with Python 2 and possibly a version of Python 3 (<3.7.0) at least on the Raspbian OS. If this is the case, Python 3.7 will first need to be installed and symlinked to the python
command when run on the terminal. To achieve this, follow the instructions found in: https://installvirtual.com/install-python-3-7-on-raspberry-pi/. If already set up, skip to step 3.
After following the instructions in Step 1, the pip installer will likely still be pointing to a previous python instance. To avoid this clash, download and install the repository with the following commands (assuming python 3.7 is now symlinked by python
in the terminal. Note this will download a read-only version of the repository and is recommended when simply wanting to deploy the current software version on your Pi for non-developer use.
git clone git://github.com/kpillay/PiNEbox.git
cd PiNEbox
python -m pip install -r requirements.txt
A few adaptations to the software must by made in order for it to best work with the PiNe box hardware and the Python UI. This includes installing a vietual keyboard for use on the touch screen.
Before proceeding, update the Raspbian OS to the latest version. To do this enter the following commands into the Pi terminal (ensure an internet connection is first established on the Pi via WiFi or ethernet):
sudo apt-get update
sudo apt-get upgrade
sudo shutdown -r now
After the Pi has updated and shut down. Reboot and proceed as below below.
The soft shutdown button utilizes the TxD pin on the Pi GPIO to provide the user with an indicator of the current CPU state. This pin needs to be enabled in the software to power the LED. To do this:
bootconfig.txt
enable_uart=1
, then save and close.The matchbox-keyboard is chosen here. To install it and create a shortcut on the toolbar:
sudo apt-get install matchbox-keyboard
.To create a more professional, bespoke look to your Pi's OS in preparation for running the Python UI, you can alter the colours. The taskbar and window background and colours can be changed to match the Python UI by navigating to the Pi start menu, selecting 'Preferences' and opening the 'Appearance' settings. The following HEX colour codes can be used:
A PiNe Box wallpaper is also included in the respository and called 'PiNe_wallpaper.png'. This can also be added in the above settings.
To run the PiNe UI on PC/Mac/Raspberry Pi, simply run cli.py
in your chosen IDE. To run directly in the terminal, cd to the repository location and use the following command:
python cli.py
The Python UI can be tested by setting the IP address to localhost (127.0.0.1) and running the script as above. Opening a parallel python session with the provided server scripts PiNe_macServerUDP.py and PiNe_macServerTCP.py based on the messaging choice will allow testing that the cli.py scripts are successfully sending messages back to your local machine.
Once the Python UI can be successfully opened as above using the terminal, it can be set up to automatically open whenever the Pi boots. The following instructions assumes the PiNEbox repository folder is on the desktop:
sudo nano /etc/xdg/lxsession/LXDE-pi/autostart
./home/pi/Desktop/PiNEbox/PiNe_startup.sh
.