How to set up the Pi Cap with your Raspberry Pi

How to set up the Pi Cap with your Raspberry Pi

We have retired the Pi Cap and don't provide support for it after 2023.

Integrate touch and proximity sensors into your Raspberry Pi project

The Raspberry Pi is a popular platform for projects for a reason. It's powerful, easy to use, and low-cost. We took the basic sensing functions of our Touch Board and created the Pi Cap as a Raspberry Pi Hat to connect Electric Paint and capacitive sensing to the Raspberry Pi universe. 

This guide works for any Raspberry Pi model, you can buy a Raspberry Pi from some of our resellers. It also works for the Pi Zero, although for this Pi model, remember that you will need to connect to the WiFi.

You will need:

  • 1 x Pi Cap
  • 1 x Raspberry Pi
  • 1 x USB Micro B to USB A or USB C (depending on your computer's USB port type)
  • 1 x Computer running Mac OS, Windows or Linux

Step 1 Install Raspberry Pi OS

Before you begin, make sure you have a microSD card that is loaded with the latest NOOBs or the latest Raspberry Pi OS*. NOOBs is aimed at beginners but doesn't have as many features as the Raspberry Pi OS. We usually install Raspberry Pi OS. You can find the instructions for setting up NOOBs or loading Raspbian onto your card on the Raspberry Pi website.

* Update 2022: The latest Rasperry Pi OS, Bullseye, doesn't work with the Pi Cap. Please download the previous version, Buster, from here.

Step 2 Add wireless features

If you are using a screen, keyboard, and mouse with your Raspberry Pi, you can skip this step.

If you want to work on your Raspberry Pi headlessly, you need to enable SSH. Once you have loaded Raspbian to your SD card, you need to add a file named "SSH" onto the /boot/ partition. Simply download this file, extract it and copy-paste the extracted ssh file onto the /boot/ partition. It should show up among the other files.

If you want to add Wi-Fi, download this file. Unzip the file and then open it with a text editor. Change the country code according to the ISO list and change the name of the Wi-Fi and the password according to your Wi-Fi. Copy-paste the file also onto the /boot/ partition.

You can then eject the microSD card and insert into your Raspberry Pi.


Step 3 Connect everything together

If you are using a screen, USB keyboard and USB mouse with the Raspberry Pi, connect them now via the USB ports and HDMI port. Depending on whether you are using the latest Raspberry Pi, you need a micro HDMI cable, if you are using an older Pi model, you can use a standard HDMI cable.

Then attach an ethernet cable that will connect the Raspberry Pi to the internet.

With an ethernet cable connected, attach the Pi Cap to the Raspberry Pi via the GPIO pins. Make sure that each GPIO pin is properly aligned.

Finally, connect power to your Raspberry Pi's power supply.


Step 4 Open up the Raspberry Pi with a terminal window

If you are using a screen connected to your Raspberry Pi, then open a terminal window.

If you are setting up the Pi Cap headlessly, then it is now time to connect to the Raspberry Pi from your computer via SSH. If you are on a macOS or Linux machine, open a Terminal window and type in

ssh pi@raspberrypi.local

There may be a security question regarding an unknown key at this point – you can safely continue, as all this is saying is that it has not connected to the Raspberry Pi before – the message should not appear the next time you connect. You should then be prompted for a password, which is

raspberry

You can change it later if you want.

If you are using a Windows machine, you have to run a program called PuTTY. When you run it, you will see a configuration screen. Under "Host Name" enter

pi@raspberrypi.local

and click Open. You may get a security prompt – you can safely continue and you should not see this prompt again. When asked for the password, enter

raspberry

and you will be logged in.

In all cases, you should see a terminal window with the line "pi@raspberrypi:~ $".


Step 5 Update your Raspberry Pi

Now that you have a terminal prompt, you can start entering commands to run on the Pi. To begin with, you are going to update the list of available packages that the Raspberry Pi can install – type

sudo apt update --allow-releaseinfo-change

into the terminal, followed by "Enter". This will take a little while. Once it is done, you should then run

sudo apt-get dist-upgrade

which will ensure that Raspbian itself and all installed packages are up to date too. This will take considerably longer – around 10 minutes, and you might need to answer yes to a couple of questions about disk space. Once this is complete, you will need to reboot the Pi by entering

sync && sudo reboot

in the terminal.


Step 6 Install the picap package

With our Pi now as up-to-date as it can be, it is time to install the actual software package that supports the Pi Cap – conveniently called "picap". If you were connected via SSH before, you will need to reconnect to the Pi as the reboot will have closed that connection.

At the terminal, type

sudo apt-get install picap

followed by" Enter". You may be asked to confirm that you are happy to install the picap package and the other packages that it requires – simply answer "Y" to these questions.


Step 7 Configure the picap package

To configure the picap package, you need to run

picap-setup

at the terminal.

Firstly we ask whether you want to enable high quality audio on the Pi. We strongly recommend that you do this – it will enable the new, higher-quality audio driver that the Raspberry Pi team have worked hard on, which is a huge improvement on the previous version.

Next, we ask whether or not to install examples into your home folder. We recommend that you do this, but you can, of course, choose not to. You can install them into any directory you like later.

Once this is complete, we ask whether you would like to reboot the Pi in order to complete the installation.


Step 8 Run the intro

After SSHing back into the Pi, enter these commands

cd /tmp

wget https://project-downloads.drogon.net/wiringpi-latest.deb

sudo dpkg -i wiringpi-latest.deb

cd ~

Run picap-intro to see a get a tour of the Raspberry Pi. Simply navigate with the arrows.

Step 9 Next steps

Once you have installed the Pi Cap, you can explore all of the example code and create your own projects! All of out examples are open source and we've written them in Python, C++ and Node js.

If you haven't used the terminal window before, we've written a short intro here.

If you are new to the Raspberry Pi, you can find more information on the Raspberry Pi foundation's website as well as Raspberry Pi projects to get you inspired.