Experiment #1: Graphite Sensor

Since this project was inspired by the Paper Piano project on the Arduino Project Hub, it seemed the best place to start was with the same materials, using similar wiring and code.


For the sensor itself a rectangle was drawn on a piece of corrugated cardboard and filled in with graphite (pencil “lead”). The card was approximately 6×5cm and the graphite rectangle was approximately 4.5×2.5cm.

Photo of graphite sensor showing a filled in pencilled rectangle on a piece of corrugated cardboard.


A simple circuit was created on a breadboard that was connected to the sensor and to an Elegoo Arduino Uno clone. The sensor was connected to the breadboard circuit by means of a jumper cable attached to the pencilled area using a paper clip.

Photograph of circuit showing the Uno, breadboard and sensor with all wiring

The circuit was as follows:

Circuit schematic

In practise, the Uno was supplied with 5V from the PC via it's USB port. The breadboard and other components were connected in a logically similar way to the following diagram:

Circuit layout diagram, created using TinkerCAD

Pin 2 of the Uno is configured as an output pin and is connected to input pin 3 and the sensor via a 1MΩ resistor.


The code used is SingleSensorRawDataLogger. This code takes repeated sensor readings using the CapacitiveSensor library and reports the results over the Uno's serial port.


The code was run multiple times, with different sample rates of 1, 10, 20, 50, 100, 150, 200 and 255. The following tests were attempted:

The output was displayed on the Arduino IDE's serial plotter and screenshots were taken of the results.


At low sample rates moving a finger slowly towards the sensor didn't show any significant results. Consequently this measurement is not included in results using less than 150 samples.

The results of testing different fingers are included only in the screenshot where the sample rate was 255.

The various screen shots are displayed in the carousel below. Quick taps are highlighted in yellow, proximity tests are highlighted in peach and the results from tapping with different fingers are highlighted in blue. Taps made at a slower rate are not highlighted but are easy to see.

On occasion the paper clip was tapped by mistake and a much larger reading was obtained in these cases. This suggested it could be advantageous to replace the graphite sensor with metal.

Back to main project page