⚛️ A quantum computing simulator running on microcontroller hardware
MicroQubit brings quantum computing to embedded systems, implementing a full statevector simulator with 10 qubits on an Arduino UNO R4 WiFi. Apply quantum gates, create entanglement, and visualize quantum states in real-time through an intuitive web interface.
project.mp4
- 10-qubit statevector simulation with complex amplitudes
- Universal quantum gates: X, Y, Z, H (Hadamard), T (π/4 phase), CNOT
- Measurement operations with quantum state collapse
- Full phase simulation enabling quantum interference effects
- Entanglement support via two-qubit CNOT gates
- 16x2 LCD Display: Rotates through quantum states showing |ψ⟩ notation and probabilities
- 12x8 LED Matrix: Real-time bar chart visualization of individual qubit probabilities
- Web Interface: Modern, responsive UI for gate operations accessible from any device
- Clean, gradient-based dark theme optimized for quantum visualization
- Separate controls for single-qubit and two-qubit gates
- Real-time state updates with animated transitions
- Mobile-responsive design
- Arduino UNO R4 WiFi (or compatible microcontroller with WiFi)
- 16x2 LCD Display (HD44780 compatible)
- RS → Pin 12
- Enable → Pin 11
- D4 → Pin 5
- D5 → Pin 4
- D6 → Pin 3
- D7 → Pin 2
- Built-in 12x8 LED Matrix (UNO R4 WiFi)
- Arduino IDE 2.0 or later
- Libraries:
WiFiS3.h(for Arduino UNO R4 WiFi)LiquidCrystal.hArduino_LED_Matrix.h
git clone https://github.com/justinwoodring/MicroQubit.git
cd MicroQubitOpen MicroQubit.ino and update your WiFi credentials:
const char* ssid = "YOUR_WIFI_SSID";
const char* password = "YOUR_WIFI_PASSWORD";- Open the project in Arduino IDE
- Select Board: Arduino UNO R4 WiFi
- Select the correct Port
- Click Upload
- Open the Serial Monitor (115200 baud)
- Note the IP address displayed on the LCD or Serial Monitor
- Navigate to the IP address in your web browser
- Start experimenting with quantum gates!
- Select qubits: Choose control and target qubits from the dropdowns
- Apply gates: Click any gate button to apply it to the selected qubit(s)
- View states: Watch the LCD cycle through quantum states with probabilities
- Observe probabilities: LED matrix displays P(|1⟩) for each qubit as vertical bars
- Reset: Click "Reset to |0⟩" to return to the initial state
| Gate | Symbol | Description |
|---|---|---|
| X | Pauli-X | Quantum NOT - flips |0⟩ ↔ |1⟩ |
| Y | Pauli-Y | Bit flip + phase flip |
| Z | Pauli-Z | Phase flip on |1⟩ |
| H | Hadamard | Creates superposition |
| T | T-gate | π/4 phase rotation |
| M | Measure | Collapses quantum state |
| CNOT | Controlled-NOT | Entangles two qubits |
Create quantum entanglement (Bell state: |00⟩ + |11⟩):
- Apply H gate to qubit 0 (creates superposition)
- Apply CNOT with control=0, target=1 (creates entanglement)
- Result: 50% probability of |0000000000⟩ and 50% probability of |0000000011⟩
MicroQubit uses a full statevector representation with complex amplitudes:
- State space: 2^10 = 1024 basis states
- Storage: Separate
floatarrays for real and imaginary parts - Gates: Implemented as unitary transformations on the statevector
- Measurement: Calculates probabilities as |ψ|² = real² + imag²
Unlike classical probability, quantum amplitudes can interfere constructively and destructively. The complex amplitude simulation enables effects like:
- Constructive interference: H-Z-H on |0⟩ → |1⟩
- Phase kickback: CNOT can create phase relationships between qubits
- Entanglement: Non-separable quantum states
LCD: Shows quantum states in Dirac notation (|ψ⟩) with rotating display for states with >1% probability
LED Matrix: Vertical bar charts where:
- Each column (0-9) represents a qubit
- Bar height shows P(qubit = |1⟩)
- Bottom row shows maximum state probability
The Arduino UNO R4 WiFi has limited RAM (~32KB), so the 10-qubit simulation (1024 complex amplitudes × 8 bytes = 8KB) uses approximately 25% of available memory. This leaves room for the web server, LCD, and LED matrix operations.
For larger qubit counts, consider:
- Using a microcontroller with more RAM (ESP32, Teensy 4.1)
- Implementing sparse statevector representations
- Using density matrix formalism for mixed states
Modify the NUM_QUBITS constant:
#define NUM_QUBITS 8 // Reduce to 8 qubitsImplement new gate functions following the pattern:
void applyCustomGate(int qubit) {
// Your gate transformation here
// Modify stateReal[] and stateImag[] arrays
}MicroQubit/
├── HelloWorld.ino # Main Arduino sketch
├── README.md # This file
└── LICENSE # MIT License
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
This project is licensed under the MIT License - see the LICENSE file for details.
Justin Woodring
- GitHub: @justinwoodring
- Project: MicroQubit
- Based on quantum computing principles and statevector simulation techniques
- Inspired by quantum computing frameworks like Qiskit and Cirq
- Built for the Arduino UNO R4 WiFi platform
⚛️ Quantum computing, now running on your desk!