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.
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.
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.
At this point we should have all dependencies installed on the Raspberry Pi, so go ahead and clone this repo
git clone https://github.com/FishyByte/SushiRNG.git
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/app.py
. 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/app.py
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
python app.py
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 bitStreamTesting.py __NumberOfBitsToTest__ PATH_TO_FILE
Example command that you can try with one of our example data sets that come with this repo:
python bitStreamTesting.py 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
See our application Fish Fate. Which uses this project to generate random values.
To contact any specific member of the FishyByte team please refer to their personal github profiles.
Please report all issues on the github issue tracker