Couple of years ago, I bought a Capsense add-on from Texas Instruments for MSP-430 Launchpad. It worked right out of the box as expected but a closer observation showed me that the board was nothing but a colored copper plate PCB with catchy SMD LEDS beneath. Curiosity drove me to internet and books which taught me the concept of Capacitive touch sensing. Armed with the following tools, I set myself to make my own capacitive sensor circuit.
Components Used:
- Stellaris LM4F120XL ARM Cortex M4F board
- Resistors – 2 x 2.2 M ohm
- Wires + Conductive surface ( I used a Coin)
PROJECT:
The aim to design a simple capacitive touch sensing circuit and code an ARM cortex microcontroller to sense the capacitance change when a human touches the sensor.
STELLARIS LM4F120XL:
The Stellaris launchpad from Texas Instruments is the main processing core of the project.
The following are its features
- ARM – Cortex M4F core ( Floating point)
- 256 KB Flash and 32 KB Flash, 2KB EEPROM
- 2 x 12-bit Analog to Digital Converter
- USB, UART, SPI and lot more
SCHEMATIC:
WORKING:
The stellaris microcontroller powers this RC circuit through one of its GPIO Port and scans for voltage across the capacitor( conductive surface). Human finger has finger capacitance which is in the order of pico farads. So, when I touch the surface, it affects the surface capacitance of the conductor ( a coin here ) which in turn affects the charging time of the capacitor.
Many designs employ ADC to achieve CapSense; but I have used a simple General Purpose Input port to sense it using the fact that any voltage above 1.8V will be seen as HIGH by the microcontroller. So we calculate the approximate number of CPU cycles required to ‘see’ the input pin as HIGH.
The voltage across the capacitor should charge above 1.8V to be sensed as HIGH.
Consider the following equation:
Voltage across the capacitor after time ‘t’ in an RC circuit is given as
Vc= V ( 1- e^(-t/RC) )
Here I have used 2 x 2.2 Megaohm resistors in place of R. Since the capacitance value is extremely small (in pFs) we need a larger resistance to limit the current going to the capacitor to charge it. So a larger value of R implies slower charging time.
Even at this value, the charging time is in microseconds.
But, the microcontroller is running at 80MHz which means 0.0125us is one cycle !! This is precise enough to calculate the number of cycles it takes to charge to 1.8V after the supply port to RC circuit is turned HIGH.
Results:
Cycles it took to charge prior to the touch : 30 -40
Cycles it took to charge after the touch : 100 – 700 ( Range depends on finger position)
DEMO:
Author Profile
Latest entries
- ElectronicsMarch 3, 2019Sipeed Maix Bit, a 64-bit dual core RISC-V AI development board
- ElectronicsFebruary 18, 2017Building a 49cc Street Legal Motorized Bicycle
- ElectronicsDecember 28, 2016Programming STM32 ARM microcontrollers in Arch Linux
- ElectronicsMay 17, 2016ESP8266 – WiFi + Speech Controlled Hexapod Robot