Build a proximity sensor using aluminium foil and a high value resistor.

In this project I will show you how you can create a proximity sensor using aluminium foil and a high value resistor (resistance from 10 MΩ to 40 MΩ). It works based on the Arduino capacitive sensing Library. Whenever you bring your hand (any conductive object) near to the sensor, the LED's brightness changes depending on the distance. At minimum distance, it shows maximum brightness.

The capacitive sensor library turns two or more Arduino pins into capacitive sensor, which can sense the electrical capacitance of the human body. All the sensor setup requires is a medium to high value resistor and a small (to large) piece of aluminium foil on the end. At its most sensitive, the sensor will start to sense a hand or body inches away from the sensor.

How do capacitive sensors work?

Capacitive sensing is a proximity sensing technology. Capacitive sensors work by generating an electric field, and detecting near by objects by sensing whether this field has been disrupted. Capacitive sensors can detect anything that is conductive or that has a significantly different permittivity than air, like a human body or hand.Permittivity is the measure of how difficult it is to create an electric field around a material. It’s the ability of a substance to store electrical energy in an electric field.


To begin you will need:

  • · Arduino Uno
  • · USB cable
  • · 10 MΩ resistor
  • · LED
  • · Aluminium foil (size 4 cmX4cm)

Sensor Design

Small sensors (about the size of a finger print) work best as touch sensitive buttons, while larger sensors work better in proximity mode.

The size of the aluminium foil can impact the sensitivity of the sensor, so try a few different sizes if you want and see how this changes the way that the sensor reacts.

Circuit Diagram

Hardware Setup

Insert a 10 M ohm resistor in between 2nd and 4th pin of Arduino. As per the program pin 4 is receive pin.Connect aluminium foil to the receive pin. Connect Led’s +ve terminal to 9th pin –ve terminal to GND of Arduino.


Setting up the Arduino

Great! Now all of the physical work is done and we’re off to the code. Make sure that you’ve installed capacitive sensing library.

Now we are ready to test your sensor! Make sure that your computer is plugged into the wall, or the Arduino is connected to ground as this improves the stability of the sensor. To check the output of the sensor, open the Serial monitor in the Arduino programming environment (make sure the monitor is set to 9600 baud as that is what is specified in the code).

If it is working correctly, moving your hand closer and farther from the foil should change the brightness of led.

The sensor plate and your body forms a capacitor. We know that a capacitor stores charge. The more its capacitance, the more charge it can store.

The capacitance of this capacitive touch sensor depends on how close your hand is to the plate.

What does the Arduino do?

Basically the Arduino measures how much time the capacitor (i.e. the touch sensor) takes to charge, giving it an estimate of the capacitance. The capacitance may be very small, nevertheless the Arduino measures it with accuracy.

Amal Mathew