DIY Quantum Computing: How I Got Started Building Quantum Circuits

Updated on December 31, 2019
Noah G Wood profile image

Noah Wood is the Founder of Spooky Manufacturing, a quantum computing startup in Phoenix, Arizona

Quantum computing is a wonderful, complex new world, but we don't need to wait for silicon valley to catch up to start experimenting on our own, in fact there is a little known but affordable method to build quantum computers that anyone can use!

In 2000 scientists Knill, Laflamme, and Milburn developed a method of performing quantum computations that later became known as the KLM Protocol. Essentially, what they found was that you could perform any theoretical quantum computation using nothing more than cleverly arranged optics! (mirrors)

Using the quantum properties of light and the KLM protocol, we are able to create qubits quickly and affordably using off-the-shelf optics and electronics components, beam splitters (partial mirrors) can be purchased for as little as $30 making the KLM protocol the cheapest method of achieving quantum computing to date. It's this affordability that has allowed me to experiment with simple quantum circuits in my living room!

A simple quantum circuit!

Using the KLM protocol, we are able to create affordable quantum computers!

Quantum Randomness

Quantum systems appear to be naturally random to us, the actions of sub-atomic particles are determined by the probability of that action occurring upon observation, so quantum technology is well-suited for randomness and entropy generation.

Because of that, the first quantum circuit I built was a simple random number generator based loosely on the KLM Protocol. Using what's known as a polarizing beam splitter we are able to create distinct optical paths or modes based on the polarization of a photon. The beam splitter will reflect horizontally polarized light and allow vertically polarized light to flow through unimpeded.

This alone is not all that interesting, but light has another quirk known as superposition where a photon can act as both a particle, traveling through one or the other mode, or as a wave, traveling through both modes simultaneously! This effect was first known to be observed in an experiment by the Physician Thomas Young in his famed double-slit experiment.

Here's where it gets really weird though, when the photon passes through the beam splitter, if it isn't perfectly horizontally or vertically polarized, it will actually be both reflected and passed through the beam splitter. It's not until the photon is actually detected that it "collapses" out of this wave-like state and back into a particle randomly onto one of the two possible modes.

Confused? Check out this video from Physicist Eugene Khutoryansky which explains it much better than I could hope to

Explanation Of Quantum Mechanics

Measuring Light

With the knowledge above, making the device isn't an overly difficult task, we simply shine a light through a beam splitter and measure the light. But how do we measure the light?

The answer is really simple, while there does exist some very high-tech (and expensive) ways to measure photons, the easiest way to measure light is using a component called a photoresistor.

Photoresistors are variable resistors that allow us to change the resistance of a circuit based on how many photons come into contact with the the photoresistor. When the photons hit the photoresistor it will lower the resistance of the circuit which will increase the voltage of our circuit.

Photoresistors are as inexpensive as transistors and LEDs making this a very affordable option for the DIY quantum computer hobbyist.

A Word On Photon Modes

Our quantum computer will be using linearly polarized photons as the qubit. This gives us two possible states for our qubit: Horizontally polarized and Vertically polarized along with a superposition polarization which can be any angle between 0 and 90 degrees. A quick demonstration of the states is shown below in text form:

Vertically polarized light: |

Horizontally polarized light: __

Light in a superposition of polarization: /

Designing The Quantum Circuit

When working with quantum computers, it all starts with the algorithm. You need to know what you want your quantum circuit to do before you can manipulate the particles to do what you want.

For this first quantum circuit, the algorithm is really simple!

  1. Pulse a laser diode to create photons.
  2. Pass the photons through a beam splitter.
  3. Measure the V and H modes of the beam splitter output with photo-resistors.
  4. If there is a higher voltage (lower resistance, more photons) in the H mode than the V mode, we return a 0.
  5. If there is a higher voltage in the V mode than the H mode, we return a 1.
  6. If there is an equal voltage in both modes we repeat the algorithm.

And thus we are able to create our quantum random number generator!

Arduino Firmware

/*      Annotated QRNGv1 Firmware V1.1
 * Author: Noah G. Wood
 * Copyright (c) 2019 Spooky Manufacturing, LLC
 * License: GPLv3.0
int triggerPin = 2; // This pin will pulse our quantum circuit
int hPin = A0; // This pin measures the horizontal polarized photons
int vPin = A1; // This pin measures the vertically polarized photons
float H = 0;
float V = 0;
void setup() {
  // Just setting up triggerPin and serial connection
  pinMode(13, OUTPUT);
  pinMode(triggerPin, OUTPUT);
int Random() {
  // Pulse the laser
  digitalWrite(triggerPin, HIGH);
  digitalWrite(triggerPin, LOW);
  // Read the photoresistors
  H = analogRead(hPin);
  V = analogRead(vPin);
  // Determine random bit
  if(H>V) { // More photons in the H mode, return 0
    return 0;
  } if(H < V) { // More photons in the V mode, return 1
    return 1;
  } else { 
    /* The same number of photons are in both modes!
        This is actually not an uncommon occurrence, for our
        purposes we will simply run the function recursively until
        a random bit can be generated.
void loop() {
  // The main program
  // Run our program and print the random bit to serial

The Optical Circuit

The optical circuit: a laser diode directed into a beam splitter, each path of the splitter is directed into a separate photo-resistor which is measured using an Arduino Uno
The optical circuit: a laser diode directed into a beam splitter, each path of the splitter is directed into a separate photo-resistor which is measured using an Arduino Uno

Parts To Build It Yourself

If you want to build this for yourself, here are the parts that you need (These are the same materials I used)

  • Arduino Uno
  • Photoresistors
  • 50/50 Beam splitter
  • 650nm Red Laser Diode
  • Plastilina Clay
  • Arduino Breadboard Shield
  • Case/project box (I purchased mine at michaels, but my first prototypes just used the cardboard boxes the components were delivered in)

A note on beam splitter shipping:
The beam splitters can take a little while to have shipped, I believe they come from China. I would recommend Edmunds optical if you wanted to take a serious go at quantum computing, but they can be quite pricey and we don't really need that sort of lab-level quality for simple home experimentation -yet!

Use a small ball of plastilina clay to stick the beam splitter to the bread board and to hold the laser diode in place.
Use cotton gloves to prevent dirtying the optics.
Cover the device when in use.

The Photon Problem

For this design, we are able to use a laser pulse that contains trillions of photons, by simply measuring both "modes" and comparing the voltage shift we can easily determine whether the collapsed qubit should produce a 1 or a 0, but for more advanced designs that involve quantum entanglement (where the real power in quantum computing is), we have to use what are known as single-photon sources.

Unfortunately, reliably creating a single photon isn't actually that easy; the same quantum randomness that promises us capabilities far surpassing that of digital computers also rules the creation of photons, and for that reason there is no ideal single photon source yet on the market for us to enjoy although there has been some promising research done with nano-diamonds that may yet clear the way for affordable commercial quantum computers.

With that said, using laser attenuation it is conceivable for a hobbyist to create a fairly reliable (if not ideal) single-photon source to use for their own purposes, but this is not perfect and comes with its' own set of challenges.

Creating Entangled States

Entanglement is an even bigger issue DIYer's are going to face when building their own optical quantum circuits, after all, photons don't interact with each other! How can they become entangled? But the same geniuses (seriously, geniuses) that created the KLM protocol also discovered a way to use simple optical components to entangle photons using non-linear sign-shift gates and, I know this sounds like science fiction: teleportation, neither of which will I pretend to completely grok. I would instead point you back towards the wikipedia page on the KLM protocol if you would like to learn more about this. It is something I myself am working on in my own home shop but have not been able to achieve as of yet

Open Sourced Quantum Computing

My fascination with quantum computing that drove me to build my very own quantum computer has also driven me to start Spooky Manufacturing, an open-source quantum computing startup.

We currently host a github with complete build instruction, schematics, and software for quantum computing hobbyists to freely enjoy (all licensed under the GPLv3 open source license).

I'd like to invite all of you to check out our other projects as well, we've got a few free tools in the works such as:

  • QEDA - optical circuit design automation software
  • QController - testing software for quantum circuits

We hope these tools are going to make designing, building, and programming DIY quantum computers and circuits as easy and fun as the arduino or raspberry pi

This article is accurate and true to the best of the author’s knowledge. Content is for informational or entertainment purposes only and does not substitute for personal counsel or professional advice in business, financial, legal, or technical matters.

© 2019 Noah G Wood


    0 of 8192 characters used
    Post Comment
    • profile image


      4 days ago

      this circuit is not true


    This website uses cookies

    As a user in the EEA, your approval is needed on a few things. To provide a better website experience, uses cookies (and other similar technologies) and may collect, process, and share personal data. Please choose which areas of our service you consent to our doing so.

    For more information on managing or withdrawing consents and how we handle data, visit our Privacy Policy at:

    Show Details
    HubPages Device IDThis is used to identify particular browsers or devices when the access the service, and is used for security reasons.
    LoginThis is necessary to sign in to the HubPages Service.
    Google RecaptchaThis is used to prevent bots and spam. (Privacy Policy)
    AkismetThis is used to detect comment spam. (Privacy Policy)
    HubPages Google AnalyticsThis is used to provide data on traffic to our website, all personally identifyable data is anonymized. (Privacy Policy)
    HubPages Traffic PixelThis is used to collect data on traffic to articles and other pages on our site. Unless you are signed in to a HubPages account, all personally identifiable information is anonymized.
    Amazon Web ServicesThis is a cloud services platform that we used to host our service. (Privacy Policy)
    CloudflareThis is a cloud CDN service that we use to efficiently deliver files required for our service to operate such as javascript, cascading style sheets, images, and videos. (Privacy Policy)
    Google Hosted LibrariesJavascript software libraries such as jQuery are loaded at endpoints on the or domains, for performance and efficiency reasons. (Privacy Policy)
    Google Custom SearchThis is feature allows you to search the site. (Privacy Policy)
    Google MapsSome articles have Google Maps embedded in them. (Privacy Policy)
    Google ChartsThis is used to display charts and graphs on articles and the author center. (Privacy Policy)
    Google AdSense Host APIThis service allows you to sign up for or associate a Google AdSense account with HubPages, so that you can earn money from ads on your articles. No data is shared unless you engage with this feature. (Privacy Policy)
    Google YouTubeSome articles have YouTube videos embedded in them. (Privacy Policy)
    VimeoSome articles have Vimeo videos embedded in them. (Privacy Policy)
    PaypalThis is used for a registered author who enrolls in the HubPages Earnings program and requests to be paid via PayPal. No data is shared with Paypal unless you engage with this feature. (Privacy Policy)
    Facebook LoginYou can use this to streamline signing up for, or signing in to your Hubpages account. No data is shared with Facebook unless you engage with this feature. (Privacy Policy)
    MavenThis supports the Maven widget and search functionality. (Privacy Policy)
    Google AdSenseThis is an ad network. (Privacy Policy)
    Google DoubleClickGoogle provides ad serving technology and runs an ad network. (Privacy Policy)
    Index ExchangeThis is an ad network. (Privacy Policy)
    SovrnThis is an ad network. (Privacy Policy)
    Facebook AdsThis is an ad network. (Privacy Policy)
    Amazon Unified Ad MarketplaceThis is an ad network. (Privacy Policy)
    AppNexusThis is an ad network. (Privacy Policy)
    OpenxThis is an ad network. (Privacy Policy)
    Rubicon ProjectThis is an ad network. (Privacy Policy)
    TripleLiftThis is an ad network. (Privacy Policy)
    Say MediaWe partner with Say Media to deliver ad campaigns on our sites. (Privacy Policy)
    Remarketing PixelsWe may use remarketing pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to advertise the HubPages Service to people that have visited our sites.
    Conversion Tracking PixelsWe may use conversion tracking pixels from advertising networks such as Google AdWords, Bing Ads, and Facebook in order to identify when an advertisement has successfully resulted in the desired action, such as signing up for the HubPages Service or publishing an article on the HubPages Service.
    Author Google AnalyticsThis is used to provide traffic data and reports to the authors of articles on the HubPages Service. (Privacy Policy)
    ComscoreComScore is a media measurement and analytics company providing marketing data and analytics to enterprises, media and advertising agencies, and publishers. Non-consent will result in ComScore only processing obfuscated personal data. (Privacy Policy)
    Amazon Tracking PixelSome articles display amazon products as part of the Amazon Affiliate program, this pixel provides traffic statistics for those products (Privacy Policy)
    ClickscoThis is a data management platform studying reader behavior (Privacy Policy)