GithubHelp home page GithubHelp logo

hermes-jr / alpharad Goto Github PK

View Code? Open in Web Editor NEW
6.0 3.0 0.0 16.96 MB

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

License: GNU General Public License v3.0

CMake 1.36% Shell 2.85% Python 23.79% C 71.99%
rng true-random hobby experimentation random-number-generators

alpharad's Introduction

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

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.