Alternative titles: ...
The following steps will guide you through the process of building, programming and using a cheap and reliable pupillometry setup, as presented in Names et al., (2019), etc. bla bla.
Why is this useful. What lead us to pursue this? What's already out there?
- Cost-effectiveness & range of alternatives
- Scalability
- Open source & open hardware -> Availability
- Simplicity
- ...
The following components are needed before starting the assembly process. Please be aware that we built and tested the setup with below linked components. However, many of these can probably be replaced with similar hardware. Also, the touch screen is not strictly required, as the Pi can also be controlled through another computer via an SSL connection. However, it makes the setup more user friendly and accessible.
- Raspberry Pi 3 B+
- Raspberry Pi Touchscreen (optional, but recommended)
- Pi + Touchscreen housing (optional, but recommended)
- Raspberry Pi NoIR Camera V2
- Pi Supply Bright Pi (or similar IR light source)
- CSI Flex Cable ca. 1m
- 2x Power Supply
- SD Card (>= 16GB)
- USB Stick (optional)
- USB Keyboard (optional)
- Screwdriver
- Soldering iron
- Play dough
- SD Card adapter
- Computer to flash SD card
First, download Etcher and install it on the Computer that will be used to write the SD card image. Download the latest Raspbian image and follow below steps to write the image.
- Open Etcher and select the downloaded image under "Select image"
- Insert your SD card into the card reader and select it under "Select drive". Make sure you selected the SD Card and no other USB or internal drive.
- Hit "Flash!" to write to the card
In case you experience any trouble writing the image, please re-format your SD card and try again.
First, place the Raspberry on the brass spacers of the touch screen board. Make sure the micro-USB connectors on both boards are aligned (see picture below) and fasten the Raspberry with the four Phillips screws provided.
Install the SD card now with the pins facing the Raspberry's PCB. Also, install the short display cable that came with the touch screen. Make sure the metal contacts on the ribbon cable are facing towards the contacts in the socket, and away from the black bracket. Ignore the 4 colored cables that shipped with the touch screen. These are only needed if you use a really old Raspberry Pi and/or if you plan to power the Raspberry from the screen directly. This option is not recommended, as screen, camera and light need more power than a single average power supply can provide. This can lead to unexpected behavior.
Please, be aware that this part of the assembly will likely not be accessible anymore once it's inside the housing.
Now install the housing and secure it with the provided screws. Ensure correct orientation of assembly.
We recommend using an original Raspberry NoIR V2 camera, because they come without an infrared light filter. This is crucial for measuring pupil diameter, as the iris reflects infrared light and therefore a maximal contrast between pupil and iris can be achieved. You can also use a third party "night vision" camera for the raspberry.
Assemble the Bright Pi light source following the official quick start guide. Please make sure all connections are properly soldered. Refer to a guide like this one in case you need advice on soldering.
Swap the original short CSI (Camera Serial Interface) cable and the four cables connecting the BrightPi with longer ones. We recommend using ~50cm. The effective length needed depends on the setup and the cables can easily be changed later during the process. The white plastic ring visible on the picture is used to adjust focus of the camera. Adjust the camera focus before mounting it to the BrightPi or you won't be able to access the lens anymore with the focus ring. It can also be adjusted using fine plastic tweezers, but make sure not to scratch the lens.
The Bright Pi light source can either be connected to the camera directly or used separately from the camera. Keeping the components separate can be beneficial when illumination needs to be adjusted. Also, the camera is less bulky without the light source.
The four pins on the BrightPi board are - starting from the one with a black square - GND, 5V, SCL, SDA. Connect those to the Raspberry Pi respectively. Again, check the quick start guide for instructions.
Then connect the CSI cable to the camera port on the Raspberry Pi. Lift the black bracket and push the cable in. Again, make sure the metal contacts on the ribbon cable are facing towards the contacts in the socket, and away from the black bracket.
To start, first plug in the micro-USB cable powering the display, then the one powering the Pi. You should see a colorful square and then the Pi boots.
Dependent on your display stand or case, you might find the screen is upside-down. This setting can be changed in boot/config.txt
either by accessing the SD card from your computer or directly on the Raspberry by running the following lines in the terminal.
sudo nano /boot/config.txt
and adding to the bottom
lcd_rotate=2
Hit CTRL+X
and y
to save. Finally, reboot the system.
sudo reboot
The above is almost word-by-word copied from the official documentation where you can also find a lot more troubleshooting information.
Verify that the camera is connected and working.
vcgencmd get_camera
Check the output and verify that the camera is detected and supported.
supported=1 detected=1
If the output differs from the above line, turn off the Pi and reseat all connections. Pay particular attention to the orientation of the ribbon cables.
Make sure you have a working internet connection, then install all necessary software to /home/pi/Code.
# Run this line and all necessary software will be installed
curl -sSL https://git.io/fheWn | bash
Start the camera GUI with default parameters.
# Run this line to start the GUI
python /home/pi/Code/camera-gui/CamGUI.py
The GUI also takes user-specified parameters as optional input arguments.
# Display all options
python /home/pi/Code/camera-gui/CamGUI.py -h
# Start the GUI with custom frame rate
python /home/pi/Code/camera-gui/CamGUI.py --framerate 30
More information on all optional parameters can be found in the user's guide
Some intro why it might be helpful to add more. Highlight scalability of the system.