Setting up the Touch4Pi

What is the Touch4Pi?

The Touch4Pi is a Raspberry Pi HAT compatible board featuring 4 RGB LEDs, and 4 capactive touch pads hidden behind a frosted diffuser allowing really nice lighting effects by mixing various colours from each LED.

The Touch4Pi can be used as a controller for a game that is displayed on the screen, or even used to create games on the HAT itself. Such games like Simon or Mastermind can also be programmed to be played on the Touch4Pi. Perhaps even create an unlock combination for your Raspberry Pi so no one else is allowed to use it?

Getting started

First thing you need is a Raspberry Pi and an SD card installed with Raspbian. Instructions on setting this up is here.

Fitting the Touch4Pi

The Touch4Pi sits comfortably on top of the Raspberry Pi GPIO pins to cover the Raspberry Pi as shown

img_20161123_150808

Make sure all the pins are connected as offsetting the Touch4Pi slightly on the GPIO header can cause problems with the HAT and/or Pi to not work or suffer damage so double check it is seated

Connect everything up

Now connect the HDMI, network (internet is required), mouse and keyboard. If this is the first time using a Raspberry Pi, have a quick read through the getting started guide so you are more familiar with what it is doing.

Installing the software

Once the Raspberry Pi has finished starting up, proceed to login and start the desktop environment (if it doesn’t automatically boot).

800px-Pibrella_Open_Terminal

Click on the Menu button, go down to Accessories, and click on Terminal.

This will open the Terminal command box, in this the instructions to install the software will be typed.

Type in the following, hit enter at the end of each line and wait for the green and blue text to appear again. Some instructions may take a minute or two to run, so please be patient.

sudo apt-get update

sudo apt-get upgrade -y 

sudo apt-get install python-dev git python-smbus

git clone https://github.com/CyntechUK/Touch4Pi.git

That is all the libraries and software installed, we just need to make a few more changes, such as enable serial communications;

sudo raspi-config

Go to Advanced Options, using the arrows keys. Go down to I2C. Then YES to enable the driver. Press OK on the confirmation. Then back in to Advanced Options and then SPI, again YES to enable.

Finish off with TAB to FINISH, and reboot the Raspberry Pi for all the changes to take effect.

1-advanced2-i2c
3-enable4-confirm

Testing

Once the Raspberry Pi has finished booting up, open Terminal again, and start the sample Simon script to check everything works;

cd Touch4Pi
sudo python test-simon.py

If everything worked, the Touch4Pi should start cycling the 4 corners with an individual colour, and begin a game of Simon. The aim is to copy the pattern provided randomly, repeating any previous pattern to achieve a high score.