Simulating a Quanutum Computer on Esp32
- Esp32
- SSD1306 Display module
- Jumper wires
- Bread board
-
Install Thonny python IDE
- For Linux
sudo apt-get install thonny
- For Windows/Mac Download setup from --> Here
- For Linux
-
Install micro python on Esp32
- Refer this Video Here
-
Install libraries for QEsp
- Click on tools -> manage packages
- Search for ssd 1306 library. Download micropython-ssd1306 library.
- A lib folder will be created containing ssd1306.py
- open the QEsp.py from the repository in Thonny and press
Ctrl+Shift+s
on keyboard - click save on Micropython Device
- Go in the lib folder
- save in the lib folder as QEsp.py
- Your lib folder should look like this
- Run an example sketch form the repo (Before running the code make the circuit given below)
- Circuit connections
- Pin 21 to SDA
- Pin 22 to SCL
- 3.3v to VCC
- GND to GND
-
How to simulate on QEsp
- create a circuit
qc = QuantumCircuit(Number_of_qubits)
- Apply Quantum Gates to the Circuit
- Pauli-X Gate :
qc.x(Index_of_Qubit)
- Hadamard Gate :
qc.h(Index_of_Qubit)
- Pauli-Z :
qc.z(Index_of_Qubit)
- Rotation Gate :
qc.r(Angle_in_radians,Index_of_Qubit)
- Controll-X Gate :
qc.cx(Controll_Index,Target_Index)
- Controll-Z Gate :
qc.cz(Controll_Index,Target_Index)
- Controll-R Gate :
qc.cr(Controll_Index,Target_Index)
- Controll-Controll-X Gate :
qc.ccx(Controll_Index1,Controll_Index2,Target_Index)
- Pauli-X Gate :
- To measure Qubits :
qc.execute()
- Prints a single unitary matrix :
qc.unitary()
- Prints the current quantum state of the circuit :
qc.state
- Prints the probability of the states :
qc.prob()
- create a circuit
*Currently You can simulate upto 5 Qubits on QEsp.