Newsletter

Programmable Logic DesignLine  >  Design Center

A code-free approach to touch and proximity sensing for embedded systems

This "How To" tutorial shows how to incorporate capacitive sensing features into a simple embedded system without having to write a single line of code.

Page 1 of 2

Programmable Logic DesignLine

The capacitive sensing user interface has established itself in recent years as a practical and innovative upgrade for push buttons in many types of consumer goods. A light tap on a smooth surface or the proximity of a hand replaces physical actuation of a mechanical switch.

Capacitive sensing modules make it easy to add a touch and proximity interface to a system since there is no code to write or debug. Just take the module off the shelf and drop it into the system. Sensor modules however are inflexible in the functions they perform, and may limit the features that can be added to a product. A more flexible solution is desirable since it is often the little extras that get added at the last minute that make a product stand out from its competition.

This article shows how to incorporate capacitive sensing features into a simple embedded system without writing a single line of code. This Code-Free approach has the convenience of off-the-shelf modules, with the flexibility of a code-intensive embedded controller. The complete design process is demonstrated for a real-world product idea, from concept to working prototype.

The Code-Free approach to system design is made possible with PSoC Express software and the FirstTouch evaluation kit, both from Cypress Semiconductor. Creative people that brainstorm new products no longer need to throw the design "over-the-wall" to engineering in order to get a working prototype. If you can draw a block diagram of your system, you can create a real product using the graphical interface of PSoC Express. The whole process can easily be completed in a couple of hours for someone new to PSoC Express. Development time and project costs are both reduced in the process.

Building a better mousetrap
The classic inventor's quest is to build a better mousetrap. The design example in the following discussion comes close to that very result. Let's create an embedded system as a design example that combines two trends in electronics: capacitive sensing and digital photography. Our example project will be a smart proximity sensor that triggers a digital camera. Such a system is called a "camera trap". These cameras have been in science news headlines in recent years. Wildlife researchers have used camera traps to prove that animals once thought extinct are still on the prowl, like jaguars in Arizona [1]. In remote places like the dense forests of Borneo, scientists have also discovered totally new species with these cameras [2].

The existing technology for camera traps seems to be working just fine. Why reinvent the wheel? Here is a short comparison of old and new technology that makes the case for building a better trap.

Old Technology: Based on PIR motion sensor. At high ambient temperatures, animals in the target zone get lost in the background scene. Reflected sunlight gives false detects. The bulky hardware needs to be hidden from the animals and protected from elements, yet any blockage to the optical path will disable the trigger. The trigger zone is hard to customize with simple lenses.

New Technology: Based on a Capacitive Proximity Sensor using a wire as the proximity sensor. Stealthy wire can be attached to a branch, across a rock, or by a watering hole. The trigger zone can be very localized and fine-tuned with a wire clipper. Works equally well in bright sunlight and on a starry night. Background heat has no effect on performance. The proximity sensor wakes up periodically, and wakes the camera only when an animal is in the target zone, thereby saving on battery power.

Comparing the two approaches to building a camera trap, it is seen that the capacitive sensing approach has advantages over the existing approach in certain situations. For example, the new approach should find a niche in the field of wildlife research.

Design process overview
There are six steps in the Code-Free design process as follows:

  1. Describe the system in words.
  2. Draw the system block diagram.
  3. Define state machines, transfer functions, and truth tables.
  4. Simulate the system.
  5. Test the real system.
  6. Fine-tune CapSense.

Step 1. Describe the system in words
We will take a top down approach to design. This means that we will start by defining in words at a high level how the system should operate, and then fill in the technical details as needed. Here is a short non-technical description of the system:

The system will constantly monitor for any animal. When an animal is detected, the camera is turned on and a picture snapped. The camera is off when no animal is detected. To prevent pictures from being taken of the researcher setting the camera trap, the detection system is disarmed for a period when the system is reset.

These few sentences are a good start, but more detail is needed before diving into PSoC Express. Here is a more technical description of how the system should work.

  1. Set up the camera.
  2. Hide a wire in the target zone. For example, attach the wire to a branch. Wire insulation should blend in with the environment.
  3. Connect sensor wire and camera control cable to the controller board.
  4. Turn on the power to the controller board.
  5. A red LED flashes for 30 seconds allowing the researcher to move away from the system without triggering a picture. The camera trigger is disarmed during this time and the camera is off.
  6. The red LED stops flashing and stays off.
  7. The trigger to the camera is now armed, waiting for an animal to move near the proximity sensor.
  8. When an animal triggers the proximity sensor, a green LED turns on. The camera is turned on and pictures are taken.
  9. When the animal moves out of range, the green LED turns off. The camera turns itself off after a period of no input.
  10. Go back to point 7 and repeat the loop.

Step 2. Draw the system block diagram
A block diagram of this system is drawn using PSoC Express, as shown in Fig 1. The diagram is defined through a graphical drag-and-drop process.

PSoC Express has a library of parts called a driver catalog that includes such functional blocks as temperature sensors, light sensors, and accelerometers. Blocks are dragged from the catalog as needed onto the block diagram using a mouse.


1. System block diagram.
(Click this image to view a larger, more detailed version)

To keep things simple, the only outputs to the system in this design example are the red and green LED. It is a simple matter to add the "camera on/off" and "snap picture" outputs to the camera by grabbing two more digital outputs from the driver catalog.

The system for this design example is composed of the following blocks:

  • Proximity – A proximity sensor based on the CSD method of CapSense. 
     
  • Green LED – Turns on when the proximity sensor has been triggered. 
     
  • Red LED – Flashes during the 30 second Disarm period after reset. 
     
  • Tick1Second – The timebase that outputs a pulse train at a rate of 1 pulse per second. 
     
  • RedCounter – A counter that increments once per second. 
     
  • RedDelay – A state machine that changes state after 30 seconds. 
     
  • Initialize – A state machine that resets the counter when the system is reset.


Page 2: next page  

Page 1 | 2



Rate this article
WORSE | BETTER
1 2 3 4 5




Cypress Semiconductor
Related Content

WEBINAR
1. Innovations in Capacitive Interfaces

WEBINAR
2. PSoC® CapSensePLUS: A Designer's Guide to Functional Integration

WEBINAR
3. Touch Screens: The Magic Behind Multi-Touch

WEBINAR
4. Use 400% of Your Embedded Silicon with Dynamic Reconfiguration

 

 Featured Jobs
T-Mobile seeking Senior Facilities Engineer in Bellevue, WA

Protingent Staffing seeking Quality Engineer in Irvine, CA

Broadcom seeking Principal Packaging Engineer in Irvine, CA

ITT Corporation seeking Systems Engineer in Thousand Oaks, CA

Comverge, Inc. seeking Senior Firmware Engineer in Norcross, GA

More jobs on EETimesCareers
 Sponsor
 CAREER CENTER
Ready to take that job and shove it?
SEARCH JOBS:

 SPONSOR

 RECENT JOB POSTINGS
For more great jobs, career related news, features and services, please visit EETimes' Career Center.