Skip to content
Switch branches/tags

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


alt tag

Fish tank random number generator. This project uses a Raspberry Pi 3 with a camera to create a live stream of my fish tank. This live stream is then used to generate a random number.

Table of Contents

Image Processing

Raspberry Pi Setup

Install OpenCV

For this project we used a Raspberry pi 3 and installed OpenCV 3. Any Raspberry Pi and OpenCV version should work (installation took me about 6 hours). I used this tutorial from Adrian Roseblock to help me install OpenCV on the Pi.

Install Bitstream

For this project we used the python package Bitstream 2.0.3. Information about Bitstream can be located here. Please follow the instructions from that website.

Raspberry Pi Build

At this point we should have all dependencies installed on the Raspberry Pi, so go ahead and clone this repo

git clone

For the Raspberry Pi we only care about the rpi directory. Before we can fire up the OpenCV script we're going to need to tweak the color ranges in rpi/ Grab some still images from the pi with the raspistill command and then use the provided range detector script to find the HSV color space range of the image. This is how the fish will be tracked.

cd rpi/testing
python range-detector -f HSV -i path/to/image.jpg

Take note of these values and adjust the color range parameters to match in the rpi/ file. Also while your in that file find line 97 and uncomment it out, this is turned off for production.

We are finally ready to test out the OpenCV code, make sure you are in the rpi directory and run



Server Setup

Server Build

NIST Testing

To test against our random numbers that we generate and make sure it's cryptographically secure we used the official NIST Testing Suite. (Credits to National Institute of Standards and Technology) This runs specific tests against a stream of binary bits that we have generated from our algorithm for randomness. To run these tests against your bits of data, first go the the NIST directory and run this command:

---NOTE: It would help to put your data set in the data directory---

python __NumberOfBitsToTest__ PATH_TO_FILE

Example command that you can try with one of our example data sets that come with this repo:

python 32768 data/fishBits3.txt

You can learn more about the statistical NIST Testing, the organization itself, and the NIST Test Suite at the provided link below

National Institute of Standards and Technology NIST Statistical Test Suite

Mobile Application

See our application Fish Fate. Which uses this project to generate random values.


Open Source Community

Other Sources

Contact Information

To contact any specific member of the FishyByte team please refer to their personal github profiles.

Reporting Issues

Please report all issues on the github issue tracker


The MIT License


Fish tank random number generator




No releases published


No packages published