TELEO
 
 
 
 
 
 
COOKBOOK
 

Piezo Sensor

How to Use a Piezo Sensor:

 

Concept Overview

Circuit Diagram

Wiring the Piezo Sensor

A Max Patch using a Piezo Sensor

Flash Code using a Piezo Sensor

Project Ideas

 

 
   

Initial Setup Requirements:

Components:

Piezo Sensor
Multi I/O module
Wire

Tools:

Soldering Iron
Solder
Voltmeter

 

Concept Overview

Piezo sensors like the ones sold in the MakingThings store, are flexible sensors which produce electricity when deformed.

Piezo sensors are different from resistive sensors such as the bend sensor and the photocell sensor because they generate electricity in response to applied stresses. When the piezo film is bent from the mechanical neutral axis, a very high strain within the piezopolymer is created and generates a high voltage. This voltage is created only as the sensor is deformed. To illustrate this, if you connect an LED to the sensor's terminals and "flick" the sensor, the LED will illuminate as the sensor moves, but not when it is static.

The sensor produces positive voltages when they're deformed in one direction, and negative voltages when deformed in the other.

Piezo sensors create a pulse that can be detected through an analog input. The piezo sensor creates a fast pulse which can be quite tricky to capture. This cookbook entry will show you how to generate a single 'switch' response so that you can read one value per "flick." (see piezo max patch below)

fig. 1: Concept Diagram

For more information on Piezo's, here are two online resources:

A good FAQ on Piezo's:
http://www.piezo.com/en-us/pg_71.html

Piezo Theory:
http://www.americanpiezo.com/piezo_theory/index.html

 

Circuit Diagram

The circuit is very simple: connect one end of the sensor to a ground terminal on the Introductory Module, Multi IO Module or Analog In Module and the other to an Analog In terminal.

For an explanation of symbols, refer to circuit basics



fig. 2: Circuit Diagram

 

 

Wiring the Piezo Sensor

To hook up a piezo sensor, connect one wire to the Analog In and the other wire to ground. You can use either the Introductory Module, Multi IO Module or the Analog In Module with this sensor.

* Please note that in this setup, the Multi IO cannot read negative voltages, so it will be sensitive to motion in one direction only.



fig. 3: Piezo Sensor wiring

 

Max Patch Using a Piezo Sensor


fig. 4: Piezo Sensor Max Patch

 

This patch assumes that the piezo sensor is connected as illustrated above, to a MultiIO on the Analog In 0 (A0) input.

The t.mio.ain object is set up so that it checks the sensor every 10ms. This is necessary since the pulses generated by the sensor are very short and the default of 100ms will be too long.

The rest voltage from the sensor is 0v which corresponds to an output of -100 from the t.mio.ain. The sel (select) object is passed the signal and it sends a bang on its second outlet whenever the input value deviates from -100. This immediately provides a signal whenever the piezo sensor is deformed.

Since the sensor may vibrate for some period after the initial activation, for this example a del (delay) object is added to the sel outlet. This delays the signal so that only one signal is counted per 1/4s (250ms) interval. This filter is obviously only appropriate if the signal is not needed immediately since it will introduce a 250ms delay.

Finally, in this example, the processed (and delayed) deformations are counted by a counter object.

Flash Code Using A Piezo Sensor

Objective
Control Flash with analog input from the piezo sensor through an Intro Module.

How To
1. Be sure your Teleo module and the piezo sensor are properly connected.

2. Run the Teleo XML server. Check the user guide for more information.

3. Create a Flash movie.

4. Insert the code found below into the Action Window in the first frame of a new layer called "Actions". The lines following "//" symbols are comments, which are ignored when the code is run but can help the coder keep track of what certain lines of code mean.

5. Run the movie, then deform the sensor, moving it from one side to the other. Remember that the Piezo sensor only sends voltages when in motion, not when static. In the Output Window, notice how the "New Analog In Value" changes in response.

Code   
//import the MakingThings Class Libraries 
import com.makingthings.*;
   
//create a new Intro Analog In object
var ain:TIntroAin = new TIntroAin( 0 );
   
//read the analog input value each time it is changed
ain.onValue = function( value:Number)
{
      //display the current analog in value in a separate output window
      trace("New Analog In Value: " + value);
      //now do something useful with the value
 }

Project Ideas Using a Piezo Sensor

- Using a shielded piezo element bonded using adhesive tape onto a wide, elasticated band, strong signals can be obtained from chest expansion/contraction during breathing.

- Since the piezo sensors are cheap, several can be used to monitor physical contact over a region. Say on an item of clothing, or other object.

- These sensors are pretty tough, so they can be used in places where other kinds of sensors might not be appropriate, like in floor mats, etc.

copyright © 2002-2004 MakingThings LLC