Tag Archives: Pi

Using a capacitative touch sensor with the Raspberry Pi or the Arduino

A capacitative touch sensor is simply a sensor that detects touch. Well, not actually touch. It somehow detects you and generates a response which the Pi can use anyway you want like a switch.

I’ve recently got a bunch of these.



Designed by  Adafruit.  They cost about £5 – £6.  The one used in this project is the one on the right.


I’ve found that it’s best to connect it up and add the power supply last. It’s incredibly sensitive.

We used Conductive Paint to paint a picture.


A wire was connected to the picture. You can use conductive sheet or anything that conducts – even playdough can work.

Connect the wire to the input. On the opposite side, connect a wire to one of the Pi input pins (5,7,8, 10,19 ,21,22,23
24,26,) or one of the Arduino analog inputs.

Repeat for the other inputs. Connect the ground to the GROUND and the VCC to the Power. I’ve used 3.3 V.

To test, put your hand over the conductive device. You should see an LED come on on the device. Remove your hand and it goes out.

If you read the sensor value for the Pin, the default is 1 and if contact is made, the sensor reads 0.

Use this sensor value as you want in Scratch GPIO or Scratch for Arduino

Using the Raspberry Pi and Scratch to make LEDs light up

Simon Walters at Cymplecy has modified Scratch so it can be used to control the GPIO pins.

In this tutorial, I will show you how to control the LEDs through Scratch and the Pi.

Install Scratch GPIO

Follow the instructions at Cymplecy to install Scratch GPIO on your computer. Once installed, start it up and you’ll see it looks similar to Scratch.



Resistors (typically about 50  ohm)


Wires – female to male



Note that the long leg on the LED is positive and needs to be on the side where the wire comes from the output pins.

The Pi has a number of GPIO pins for OUTPUTS. You can use 11,12,13,15,16 or 18. The odd numbers are on the left and the evens are on the right.

The code

Scratch has a BROADCAST function. You can create a BROADCAST message for the pins.



So when you connect a function such as



The LED will light up. If it does not work, check your wiring. If you connect the wire from Pin11 to Pin1, this supplies 3.3V and the LED will light up.

To turn the LED off,



You can also control Power by creating a VARIABLE

Create a VARIABLE called Power11.

You can then set the VARIABLE to a number between 0 and 100.


You can connect multiple LEDs by using a common GROUND.


Once you have control over the LEDs, you can link it to the Scratch program and make things happen.

Instead of LEDs, you can use simple buzzers as OUTPUTS. Don’t use motors as they need more power than the Pi can supply.

Video tutorial for the  Arduino

The Raspberry Pi

The Raspberry Pi and the Arduino


The Raspberry Pi is a small computer which is more powerful than it first appears. Pupils learn how to use Scratch on the Pi and then learn how to connect it to an Arduini board.

An Arduino board is a microcontroller with a number of inputs and outputs. Pupils use Scratch for Arduino to send a program to the microcontroller. The Arduino receives the inputs and responds as the pupil wants in the program.