Coder Social home page Coder Social logo

spooky-manufacturing / qrng Goto Github PK

View Code? Open in Web Editor NEW
72.0 8.0 13.0 1.64 MB

Quantum Random Number Generator

License: GNU General Public License v3.0

C++ 0.03% C 99.58% Makefile 0.16% Assembly 0.23%
quantum qrng qubit arduino superposition photons

qrng's Introduction

QRNG

Quantum Random Number Generator

exploded v1

Motivation

The QRNGv1 (Now QRNG_BASIC) was originally a proof of concept for quantum technology applications, specifically in this case for the generation of entropy which has a broad range of uses from generating graphics to encryption keys.

How It Works

The device uses a polarizing beam splitter to split a laser pulse into two beams with a 50/50 probability of a photon in the beam traveling either path. The photons actually travel as a wave, meaning they both pass through and are reflected by the beam splitter. This creates what's known as the superposition of light where the light remains in both paths able to interfere with itself until it is measured and collapses out of superposition.

qrng schematic

The equivalent quantum logic gate would be the Hadamard gate, in QASM code:

creg c0[1];
h q[1];
measure q[1] -> c0;

Hardware Requirements

  • Arduino Uno (or similar)
  • Breadboard
  • 2x Photoresistors
  • 1x 50/50 Polarizing beam splitter
  • 1x Laser Diode

Software Requirements

  • Arduino IDE (for programming the Arduino)

Firmare

Firmware can be found in the respective design folders labelled according to version. The schematics as well are labelled with the version of firmware which supports them.

How To Use

Currently the QRNG arduino operates via the Arduino Serial Monitor, you can issue single letter commands to it. We plan to add support for the device with our Qubit Controller in the near future.

Available Commands

  • v : Version, returns the current firmware verison
  • t : Test command, should return 'Success!' on the monitor
  • e : Enables extraneous information
  • r : Returns a random bit generated by the RNG
  • h : Produces a hadamard operation on the qubit, returning the measured angle of the qubit

qrng's People

Contributors

noahgwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qrng's Issues

Loss of randomness

I recreated your example from an article and it was working as expected, generating seemingly random 1's and 0's. I wanted to scale it up in size as well as add an OLED to print the results. After which, it continued to "work", but now it seems to have lost its randomness and only prints 1's -- Any thoughts on what might cause this? I have triple checked wiring and have even reverted my build back to the original scope, still it only produces a 1.

Question about detection

Hi, I'm a high schooler who is interested in quantum physics and quantum computing. I have a very limited understanding of quantum computing at the moment, and I'm having trouble understanding how your QRNG design produces random numbers. This is how I understand your device:

As you stated in your article, there are trillions of photons in each light pulse. Each individual photon has a 50% chance to collapse into a vertical or horizontal state. As an example, assuming exactly 1 trillion photons pass through, approximately 500 billion photons would be vertically polarized, and approximately 500 billion would be horizontally polarized. Photoresistors of the type used in this device are not able to detect light to the photon level, so, in theory, both resistors should provide a resistance with an unmeasurable difference. Any measurable difference in voltage would be caused by background light, imperfectly angled sensors, dark counts, or variance within the measuring tool. As far as I understand, what actually is happening is RNG created by radiation/noise from the background or from the hardware, which, while it should be truly random, is not quantum randomness. Another implication is that using an expensive polarized beamsplitter is completely unnecessary in that case, as a cheaper non polarized 50/50 beamsplitter would work just fine.

I just re-read the original article and found you were originally using a 650nm red laser diode. If I recall correctly, lasers emit polarized light, meaning that the quantum state of the photons is already collapsed at the moment of leaving the laser, making the entire RNG pointless. I'm not sure if the same is true with LEDs though. Anyway, the point is, as far as I understand it, single photon generation and detection is required for this form of quantum number generation. However, I am still just a high school student with very little knowledge about quantum physics, so I'm very likely wrong about this whole thing. It'd be great if you could clarify what I'm missing here.

Final note: I am almost completely confident of this: one cannot perform a Hadamard transform on more than a single photon at a time and it would not be able to return the superposition measurement (I assume that is what you mean by qubit angle? though I'm not sure what you mean by angle... is it the angle of the linear combination of basis states vectors?). A measurement after a Hadamard transform would just collapse it back to a single classical state and not give a measurement of the entangled state as far as I'm aware.

Trouble Tuning

I am so excited to finally have been able to build this and have been talking about/modifying this project for over a year now. However, I am having trouble returning values other than "1." I saw in your other response you mentioned tuning the diode relative to the beam splitter, however no matter what I do I cannot get this serial monitor to return something other than one. Is there any tips you can offer or something to help? Thank you so much in advance.

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.