Code Monkey home page Code Monkey logo

camera-gui's Introduction

A miniaturized pupillometry setup?

Alternative titles: ...

Introduction

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.

Background

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
  • ...

Bill of Materials (BOM)

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.

Main Hardware

Tools

  • Screwdriver
  • Soldering iron
  • Play dough
  • SD Card adapter
  • Computer to flash SD card

Preparation

Safety

Assembly

SD Card Setup

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.

  1. Open Etcher and select the downloaded image under "Select image"
  2. 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.
  3. 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.

Assemble Touchscreen + Raspberry Pi

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.

Assemble Light and Camera

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.

parts

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.

assembled

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.

Connect Raspberry, light and camera

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.

Test it

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.

LCD

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.

Camera

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.

Install all necessary software

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

Optional Add-Ons

Some intro why it might be helpful to add more. Highlight scalability of the system.

Push Button Trigger

Connect Multiple Systems

Network Storage

camera-gui's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.