Project Report Capacitive Proximity Sensor Using Arduino

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 10

CHAPTER 1

About Arduino:
About Capacitive Sensing and CapSense Library:

For most capacitive sensing related projects, I used the CapSense library. The
CapSense Library is a capacitive sensor library in the Arduino IDE. The arduino
playground has a good explanation of the Capsense library.
Capacitive Sensing:
Capacitive touch sensing is a way of human touch sensing, that requires little or no
force to activate. It may be used to sense human touch through more than a quarter of
an inch of plastic, wood, ceramic or other insulating material (not any kind of metal
though), enabling the sensor to be completely visually concealed.
Why Capacitive touch?

Each touch sensor requires only one wire connected to it.

Can be concealed under any non-metallic material.

Can be easily used in place of a button.

Can detect a hand from a few inches away, if required.

Very inexpensive.

How does it work?


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.
One way of using capacitive touch in a project is to use the CapSense library. For the
CapSense library, the arduino uses one send pin and any number of receive pins
required. A receive pin is connected to the send pin via a medium to high value
resistor.
Here are some guidelines for resistors but be sure to experiment for a desired
response.

Use a 1 megohm resistor (or less maybe) for absolute touch to activate.

With a 10 megohm resistor the sensor will start to respond 4-6 inches away.

With a 40 megohm resistor the sensor will start to respond 12-24 inches away
(dependent on the foil size).

CHAPTER 2
CapSense Library Demo Code..

Here is an explanation of the demo code for the CapSense library.


CapacitiveSensor cs_4_2 = CapacitiveSensor(4,2);

'cs_4_2' can be replaced with any other name. '4' is the send pin, '2' is the
receive pin.
void setup() {

Setup runs only once.


cs_4_2.set_CS_AutocaL_Millis(0xFFFFFFFF);

// turn off autocalibrate on channel 1 - just as an example


Serial.begin(9600);}

Begins Serial Communication at 9600baud...


long total1 = cs_4_2.capacitiveSensor(30);

The above statement is declared in 'void loop ()'. When using a 1M resistor, total1 will
less than or about ten. When touched, it becomes more than 60...
Serial.println(total1);

Sends the value of total1 to the Serial window of the computer...


The important parts of the code are explained.

CHAPTER 3
The Arduino IDE:

Arduino is an open-source computer hardware and software company, project and


user community that designs and manufacturesmicrocontroller-based kits for building
digital devices and interactive objects that can sense and control objects in the
physical world.[1]
The project is based on microcontroller board designs, manufactured by several
vendors, using various microcontrollers. These systems provide sets of digital and
analog I/O pins that can be interfaced to various expansion boards ("shields") and
other circuits. The boards feature serial communications interfaces, including USB on
some models, for loading programs from personal computers. For programming the
microcontrollers, the Arduino project provides an integrated development

environment (IDE) based on the Processing project, which includes support for
the C, C++ programming languages.
The first Arduino was introduced in 2005, aiming to provide an inexpensive and easy
way for novices and professionals to create devices that interact with their
environment using sensors and actuators. Common examples of such devices intended
for beginner hobbyists include simple robots, thermostats, and motion detectors.
Arduino programs may be written in any programming language with a compiler that
produces binary machine code. Atmel provides a development environment for their
microcontrollers, AVR Studio and the newer Atmel Studio.[18][19]
The Arduino project provides the Arduino integrated development environment (IDE),
which is a cross-platform application written inJava. It originated from the IDE for
the Processing programming language project and the Wiring project. It is designed to
introduce programming to artists and other newcomers unfamiliar with software
development. It includes a code editor with features such assyntax highlighting, brace
matching, and automatic indentation, and provides simple one-click mechanism for
compiling and loading programs to an Arduino board. A program written with the IDE
for Arduino is called a "sketch".[20]
The Arduino IDE supports the C and C++ programming languages using special rules
of code organization. The Arduino IDE supplies a software library called "Wiring"
from the Wiring project, which provides many common input and output procedures.
A typical Arduino C/C++ sketch consist of two functions that are compiled and linked
with a program stub main() into an executablecyclic executive program:

setup(): a function that runs once at the start of a program and that can initialize
settings.
loop(): a function called repeatedly until the board powers off.

After compilation and linking with the GNU toolchain, also including with the IDE
distribution, the Arduino IDE employs the programavrdude to convert the executable
code into a text file in hexadecimal coding that is loaded into the Arduino board by a
loader program in the board's firmware.

Sample Code:

A typical program for a beginning Arduino programmer blinks a light-emitting


diode (LED) on and off. This program is usually loaded in the Arduino board by the
manufacturer. In the Arduino environment, a user might write such a program as
shown:

CHAPTER 4
How the Device Operates:

Capacitive sensor is a technology sensing proximity position based on


capacitive coupling.

Many methods can the capacitive sensors be produced. A simple one way to
form an on-off output is by using two layers and a spacer in between. Through a
voltage to conductive objects causes positive and negative charges to collect on
each object.
This sensor can sense the human body and the metal, when they touch the
sensor. In addition to this, the sensor directly touches the metal plane, separated
by plastic, glass and other materials. In combination of arduino boards, the
sensors can create very interesting and an interactive work. Touch switch pin
definitions are (1) output (2) power supply (3) ground.
What the Device is typically used for:
Its been used extensively in computer technology like mouse, monitor and
screen, and also other electronic devices such as mobile phones, MP3 players,
laptop and other applications. With capacitive alternatives, it can replace the
mechanical buttons with gesture-based touch screens and multi-touch. One of
the examples f capacitive touch sensor is the Apple iPod click wheel. They can
also be used as localized proximity sensors, or turning non-conductive materials
like glass into physical interfaces for all kinds of electronics projects.
It can be manufactured with various types of decent materials such as plastic,
wood, ceramic or other insulating material even paper, which enable the sensor
to be perfectly concealed. Those insulator acts as fairly good pressure sensor
with a logarithmic response. Due to the wide range of materials can be used,
capacitive sensor has been useful in many applications.

How it can be interfaced with Arduino Microcontroller:


1. The physical setup includes a medium to high value (100K - 50M) resistor
between the send pin and the receive pin. The receive pin is the sensor terminal.
Firstly connect a 10M resistor between pins 8 and 9 on the Arduino Board.

2. Connect a small piece of aluminium or copper foil to a short wire and also
connect it to pin 9. A wire connected to this pin with a piece of foil at the end
makes a good sensor. For most applications, the sensor is covered by a piece of
insulating material, so that users do not actually touch the metal foil.
At its most sensitive, the sensor will start to sense a hand or body inches
away from the sensor.

You might also like