RasQberry

The RasQberry project: Exploring Quantum Computing and Qiskit with a Raspberry Pi and a 3D Printer

For a detailed step by step and up to date installation and testing guide, please refer to the link here. The report linked provides additional information that is not necessarily covered in the Setup Guide below.

RasQberry Installation and Setup

If you already have a Raspberry Pi with the latest version of Raspberry Pi OS you can start at step 2.

Step 1: Get your Raspberry Pi ready

With the Raspberry Pi Imager write the Raspberry Pi OS Raspbian on an (empty) SD-Card. You can either choose the Image right from the Raspberry Pi Imager or you can first download Raspberry Pi OS.

drawing drawing

(Optional) Do the default Setup of your Raspberry Pi by using

sudo raspi-config

For this you will need a Display or for a headless setup you’ll need to enable SSH.

__ Very important__: You have to use the standard username pi. Otherwise, many functionalities will not work.


Step 2: Enable SSH (optional)

You can enable SSH in different ways:

drawing


You can enable SSH and enter your password or public-key to make the authenticating process while connecting easier.

Next, you’ll need to get the IP address from the Raspberry Pi. You can find the address in your Router’s DHCP lease allocation table or if you use a display, you can get your IP address by typing ifconfig in your terminal.

Open a terminal on your remote device and enter

ssh pi@/{your IP address}

You need to agree that you want to connect your devices and enter your Raspberry Pi password (default: raspberry). Now you should be able to use SSH.


Step 3: Installing RasQberry

Open the terminal/ssh window on your Raspberry Pi.</br> Move to the home directory of the user pi (/home/pi). Not doing this will result in an error while installing and using the RasQberry. You go there by typing cd in the terminal. You can check your current working directory by typing in pwd. </br>

Download and run the script using the following commands.

wget https://github.com/JanLahmann/RasQberry/raw/master/RasQ-init.sh
. ./RasQ-init.sh

drawing drawing

This will download and start the RasQberry Configuration Tool (rasqberry-config) in your terminal. It is similar to the well-known raspi-config and can also be used for some basic configurations. To start the tool again you can use

. ./RasQ-init.sh 

in your terminal/ssh window.


Step 4: RasQberry Setup

You can assemble your Hardware either with a (touch) display or with an senseHAT. It is not possible to use the senseHAT and the touch display on the same Raspberry Pi, because the senseHAT isn’t working with the installation process from the touch display.

With touch display

Open the RasQberry Configuration Tool and follow the steps below.

  1. Select S – RasQberry Setup

drawing

  1. Select SU – System Update

drawing

  1. Select IC - Initial Config
    Your Raspberry will process the basic configurations on your device.

drawing drawing drawing

  1. Select A – Advanced Config then Q – Install Qiskit
    With this step you will install Qiskit. You can choose between a few versions of Qiskit to install. The latest version is recommended.

drawing drawing drawing drawing

  1. Select D – Quantum Demos then run BS – Bloch Sphere and enable BlockSphere Autostart
    With this step you Raspberry will start the Bloch Sphere Demo automatically whenever you start your device.

drawing drawing drawing drawing

After your first the executing D then BS your Raspberry will reboot automatically. After the reboot you should execute D then BS again. This time there is no automatic reboot, but one is recommended.

drawing drawing drawing

  1. Select S - Rasberry Setup then CD – Config & Demos (optional)
    With this step you will configurate Qiskit automatically and install the Quantum Demos. Also, this step will configurate jupyter notebook.

drawing drawing drawing

With Sense HAT

Before the Raspberry Pi can boot with the SenseHAT attached you need to do some changes in the config.txt-file.

/boot/config.txt

Open the config.txt-file and uncomment the line

#hdmi_force_hotplug

Next, open the RasQberry Configuration Tool and follow the steps below.

  1. Select S – RasQberry Setup
  2. Select G0 – System Update
  3. Select G1 – Initial Config
    Your Raspberry will process the basic configurations on your device.
  4. Select G2 – Install Qiskit
    With this step you will install Qiskit. You can choose between a few versions of Qiskit to install. The latest version is recommended.
  5. Select S0 – Config SenseHAT
    With this step you will configurate the SenseHAT and the qrasp demo will autostart.


The above installation procedure used pre-compiled wheel files for most of the python packages. These are downloaded automatically from Piwheels. For the packages retworkx and qiskit-aer, currently there are no whl files available. Total installation with local compile takes 10 minutes on RPi 4.


Update your IBM Quantum Experience API Token

If you want to access IBM Quantum Experience (to use e.g. the senseHAT demos) you need an API Token. If you want to update or store your API Token, you need to select D – Quantum Demos first and after that D7 – Update Q Token.
In the terminal you can now enter your new API Token.


Cloning the Git-Repository with the Qiskit-tutorials

By executing the following instructions you clone a repository with a collection of jupyter notebooks aimed at teaching people who want to use Qiskit for writing quantum computing programs, and executing them on one of several backends (online quantum processors, online simulators, and local simulators).

If you want to clone the Git Repository to access the with the Qiskit-Tutorials, you need to open the RasQberry Configuration Tool. First select H - HD Demos and second Q1 - Qiskit Tutorials (Jupyter Notebook starts automatically).
This will take a moment to clone and as the case may be to open the jupyter notebook.


Disable the Bloch Autostart

You can disable the autostart of the BlochSphere Demo in the RasQberry Configuration Tool. First you need to select D – Quantum Demos and then D8 – Disable Bloch Autostart.
The autostart is now disabled.


Changing WIFI Settings

If you got handed an SD-Card where the above described installation already is made and you want to connect the Raspberry with your network, you can do this in different ways.

drawing


In this panel you can enter your SSID and your wifi-password and select your Wi-Fi country.
When your boot your Raspberry Pi it should automatically connect to your Wi-Fi of choice.



Configuring Autohotspot

There is the option to configure a Hotspot which automatically activates when the configured WI-FI network (see wpa_supplicant.conf) is not available. This is done with the Autohotspot package. You can find more information about this package here: Raspberry Pi - Auto Wi-Fi Hotspot Switch Internet.

To activate and run the package, choose the options:

  1. Select S – RasQberry Setup
  2. Select AH - Install AutoHotspot
  3. Choose number according to your use case (in most cases option 1 is recommended)
  4. Exit with 8


Remote Desktop to Raspberry Pi

Prerequisites:

  1. Download the RasQ-init.sh script file from GitHub repository if it's not done before
  2. RealVNC Viewer software should be installed on your personal laptop. Remote Desktop option (VNC) has been tested using the [realVNC Viewer](https://www.realvnc.com/de/connect/download/viewer/)

Enable VNC Server:

  1. Open terminal and goto this path /home/pi
  2. Run this script file . ./RasQ-init.sh
  3. Choose S – RasQberry Setup option and hit <Select> button

    drawing

  4. Choose DV Configure Desktop and VNC option and hit <Select> button

    drawing

  5. You will see Desktop and VNC are enabled message once it’s successfully enabled the vnc server

    drawing

Connect to your VNC Server (Raspberry Pi) from your personal laptop:

  1. Open the VNC Viewer app

    drawing

  2. Enter VNC Server (Raspberry Pi) IPAddress in the address bar section and hit ENTER button

    drawing

  3. Enter VNC Server (Raspberry Pi) username (Default: pi) and password (Default: raspberry) and click OK button

    drawing

  4. VNC Viewer will connect to your Raspberry Pi

    drawing


Connect a LED Ring-Light to your Raspberry Pi

To connect your LED light, you need three cables (GND, VCC & IN). Put your cables on the Raspberry Pins as follows:

You can check which Pin on your Raspberry is the right one, with

pinout 

in your terminal/ssh window.

drawing drawing

Open your terminal/ssh window and type

sudo python3 .local/bin/rq_LED-test.py -c

Your LED Light should now be turned on. To turn it off press ctl + c.

If this method doesn’t work, you can also open the RasQberry Configuration Tool. Select S – RasQberry Setup, then S7 – Enable LED Light and finally S8 – Toggle LED Light.
Your LED Light should now be turned on. To turn it off again select S8 – Toggle LED Light again.

Go back to: Content
Go back to: Start Page