Introduction: Biometric Vascular Gateway - Why Veins?

Fingerprints have been demonstrated to be insecure but are widely used for biometrics. Iris images are also used but provide a poor, invasive user experience.

Hand vein patterns may provide a similarly unique image to fingerprints and iris scans. While veins have been used before for authentication using raw image correlation, we sought to build a system that deterministically extracts cryptographic keys which can be used for encryption, directly from vein images. This stateless system offers the ability to decouple biometric data (vein scans) from generated keys so that in the event of theft, the system would not contain any personal information nor keys. Vein images are acquired by shining infrared LEDs through a diffuser sheet onto the surface of a user’s hand. Because they are more absorbent of this wavelength of light than flesh, veins will appear darker in the image captured by the camera. This enables the system to reliably extract veins from the image to process for feature extraction and ultimately key generation.

Step 1: Set Up Raspberry Pi

You'll need to install Raspbian on your Pi to create your BVG. We recommend using NOOBS to do this. The Raspberry Pi foundation has published a good guide here. To be safe, make sure to format your SD card using NOOBS before running the installer.

Step 2: Set Up an SSH Connection to Your PI

In order to complete setup you'll need to be able to SSH into your Pi. There are a number of ways to do this, but the easiest is to connect an ethernet cord between your pi and your computer and set up internet sharing. On a mac you can do this by going to System Preferences -> Sharing and then turning on Internet Sharing for your ethernet port (See screenshot above).

Next you'll need to get your Pi's IP address. If you've set up internet sharing then it's probably, but you can plug a monitor and keyboard into the pi and run the linux ifconfig command to find out for sure.

Once you have the IP address you can SSH into the Pi by running the following on your machine:

ssh pi@[ip-address]

When prompted for a password enter: raspberry

Step 3: Set Up Infrared Imaging


In this step, you'll get your Raspberry Pi seeing in infrared.


  • Raspberry Pi 2
  • Pi NoIR camera
  • 40 high power infrared LEDs (in the 850 - 880 nm range)
  • 40 47-ohm Resistors
  • 2 breadboards
  • 5V / 5A power source
    • If you don't have access to a DC power supply to take apart, any off-the-shelf power supply unit will do fine, provided it can provide at least 2A @ 5V.


  1. Wire 20 LEDs in parallel on each breadboard, with one resistor in series with each resistor. This circuit diagram shows how 10 of those LEDs should be wired up (the other 10 are identical, on the other side of the breadboard).
  2. Strip the plastic and the connector off the end of your power source (or simply attach leads to your power supply unit) and connect the +5V and ground lines to the breadboard as appropriate.
  3. Connect your Pi NoIR to the Raspberry Pi using the provided flex connector cable
  4. Run the following command and manually inspect in the video output that you can see bright light being emitted from the powered-up LED rig.
raspivid -ex fixedfps -co 100 -ev 0 -ss 4000 -t 10000 

Step 4: Build the Enclosure

In this step, you'll build an enclosure to house the imaging components. Because the Pi NoIR camera is fixed focus, the height is the most important dimension to hold constant to ensure you get a crisp vein image. The design of the rest of the box can be altered without effect. Because we're using a visible light filter, it's not important for the box to be fully closed, even if the system is meant to be used in environments with ample visible light.


  • Visible light filter, purchased from PeauProductions
  • 18" x 24" sheet of 1/8" thick duron
  • 11" x 17" sheet of 0.10" thick acrylic
  • 3/4" wooden dowels
  • diffuser paper (any tracing paper will suffice)
  • Button
  • Velcro


  1. Download the .AI files for the laser-cuttable pieces here and laser-cut the pieces from Duron (except for the file which says to use acrylic)
    1. Note that you may have to edit them to work for your laser cutter. We used a 60 W Universal VLS 4.60, but these materials should be laser-cuttable by anything.
  2. Assemble the box, as in the image.
    1. Cut the dowels to the correct length, and then cut them further to separate the top half of the box (above the diffuser paper) from the bottom half (below the diffuser paper), as in this image.

    2. Build the box by friction-fitting the dowels into the top piece of Duron, then add glue as needed to hold them in place.

    3. Affix the diffuser paper using tape to an appropriately-cut piece of acrylic.

    4. Use Velcro to affix the breadboards with the IR LEDs to the underside of the top piece.

  3. Assemble the camera holder, as in the image.
  4. Assemble the button part, as in this image, using right-angled triangles to hold it in place.
  5. Plug one lead of the button into Pin 7 (GPIO4) on the Raspberry Pi, and the other into Pin 2 (VDD).
  6. Set the Raspberry Pi on top of the top piece.
  7. Place a single sheet of white paper to cover the bottom of the box, as in the image. This is important to enable background subtraction in the software.

Step 5: Set Up the Key Extraction Dependencies

Install Octave

sudo apt-get install octave
sudo apt-get install liboctave-dev

Install OpenCV on your Raspberry PI
Follow the instructions here to install OpenCV on your Pi. Make sure to install the Python 2.7 bindings.

Install Octave Packages

Download the octave packages from here, and then install them with the following commands:

tar -zvf octave-packages.tar 
pkg install control-2.6.6.tar.gz
pkg install signal-1.3.0.tar.gz 
pkg install general-1.3.4.tar.gz
pkg install image-2.2.2.tar.gz 
pkg install io-2.2.11.tar.gz
pkg install statistics-1.2.4.tar.gz

Install Python Packages

Run the following commands to install the python packages:

sudo pip install numpy
sudo pip install Shapely
sudo pip install RPi.GPIO

Step 6: Install Key Extraction Software

First, download the source code here.

Unzip this folder on the pi to ~/bvg.

Parts of the source code are written in c++. You'll need to compile these. To do this run the following commands:

mkoctfile ~/bvg/matlab/cpp_smooth.cpp
mkoctfile ~/bvg/matlab/cpp_vote.cpp

Step 7: Run the Vein Extractor

Now that you've got everything installed you're ready to run it!

Assuming you're already in your cv3 virtualenv, you can just run the code with the following command

sudo python /home/pi/bvg/src/

This script will listen for you to press the button on your box, take a picture, normalize it, crop it, extract the veins, and then generate and print a feature vector from your veins.


SeverinF made it! (author)2016-03-19

The source code isn't available anymore :-( Would you mind to upload it somewhere else? Thanks in advance!

theredbryophyte made it! (author)2015-12-22

Awesome project. Could you post an example image?

Perhaps you could use a PIR motion sensor to automatically do the detecting, replacing the button.

DIY Hacks and How Tos made it! (author)2015-12-07

Wow. This is really impressive. I hope you will develop this even further. It would help a lot of people.

About This Instructable




More by JasonT56:Biometric Vascular Gateway - Why Veins?
Add instructable to: