Skip to content

A set of tools for hobbyists aimed to explore DIY quantum random number generators, what kind of data they produce etc.

License

Notifications You must be signed in to change notification settings

hermes-jr/alpharad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CodeQL Build Status License: GPL v3

Overview

Alpharad is a C based open source software aimed at helping hobbyists to conduct experiments on quantum events like alpha particles emission by radioactive Am-241 with DIY hardware (e.g. 1, 2).

This software is powered by V4L2 library and OpenSSL .

A bunch of helper utilities are provided along with alpharad and can be found in qa directory.

Some additional details are available in my blog post.

Getting started

Clone this repository

git clone https://github.com/hermes-jr/alpharad.git

Install dependencies

sudo apt install cmake libv4l-dev
# The following are optional
sudo apt install openssl libssl-dev libcunit1-dev

Build main application

cd alpharad/
mkdir cmake-build
cd cmake-build/
cmake -DCMAKE_BUILD_TYPE=Debug ..
make

Ignore the testing phase build errors if there are any - they're not important. alpharad executable should appear in bin/ now.

At this point you might need to tune your camera for better results, check the troubleshooting section below.

Gather some data

# Return to the project directory
cd ..
cmake-build/bin/alpharad -v 4 --hits-file=points.log

You should expect the following to happen

Verbosity: 4
Hits file: points.log
Initializing FPS buffer
Opening video device
Initializing video device
Start capturing

Analyzing neighbors of 582:188: { 582:188, }
Analyzing neighbors of 26:108: { 26:108, }
Analyzing neighbors of 180:398: { 180:398, 181:398, 180:399, 181:399, }
Analyzing neighbors of 613:291: { 613:291, }
...

The program can be interrupted with Ctrl+C or pkill -SIGINT alpharad at any time.

OK, if all went fine, you have alpharad up and running and there should be some data collected in points.log and a stream of random bytes saved to out.dat.

To analyze collected data we need to set up the QA portion of the project.

cd qa/

Most of our additional utils are written in Python and you might take either option to make them work:

  1. Using a virtual environment. It is a cleaner approach but might require installing additional system packages and learning about venv usage.

    Under Ubuntu the following might be required

    sudo apt-get install python3-venv

    Next, create and activate a clean virtual environment and install all required packages within it

    python3 -m venv env
    source env/bin/activate
    pip install -r requirements.txt
  2. Simply install Python dependencies system-wide or locally for your user. Drawback here is the possibility of package conflicts, so this way won't necessary make your life easier.

    pip install -r requirements.txt

If all went fine again, running

python3 plot_data.py

should generate a plot for you.

example-plot

If it works, you're all set. Happy experimenting!

Usage

Check FPS, bytes per minute and some other stats:

pkill -SIGUSR1 alpharad

Troubleshooting

Camera tuning

With default camera settings you might get many false positives or very low FPS due to unnecessarily long exposure times.

These packages might be required:

sudo apt install v4l-utils ffmpeg

Webcam tuning

v4l2-ctl --set-ctrl=exposure_auto=1
v4l2-ctl --set-ctrl=exposure_absolute=295
v4l2-ctl --set-ctrl=exposure_auto_priority=0
v4l2-ctl --set-ctrl=sharpness=255
v4l2-ctl --set-ctrl=contrast=200

Check if everything works

ffplay -f v4l2 -framerate 30 -video_size 640x480 -v verbose -i /dev/video0

expected-capture

Some modes are missing

If you are missing SHA256 modes in alpharad -M, it means that the program was built without crypto support. CMake is configured so that if it fails to detect OpenSSL library, the program would be successfully built without extra features. So make sure the required libraries are available and that Compiling with OpenSSL crypto support message appears on building stage.

Other bugs

Please feel free to report any bugs by opening an issue.

License

Alpharad is GPL-3.0 licensed

About

A set of tools for hobbyists aimed to explore DIY quantum random number generators, what kind of data they produce etc.

Topics

Resources

License

Stars

Watchers

Forks