Difference between revisions of "Sparkfun: Large Piezo Vibration Sensor - With Mass"

From eLinux.org
Jump to: navigation, search
m (Added Grade)
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
{{GeislekjHead}}
 
[[Category:ECE497]]
 
[[Category:ECE497]]
 
[[Category:SparkFun]]
 
[[Category:SparkFun]]
  
 
<pre style="color:red">
 
<pre style="color:red">
Overview: 1, Nice overview, but show a picture of the device
+
Overview: 1, Nice overview, but a close up picture of the device would help.
Wiring:  0, Give specifics of how you wired it. Include a diagram.
+
Wiring:  1, What op-amp are you using?  A schematic of your actual circuit would be a big help.
Think of what a beginner would like.
+
 
Code:    2
 
Code:    2
git:      0, put in git
+
git:      2
 
Demo:    2
 
Demo:    2
Total:    5/10
+
Total:    8/10
 
Comments: Good start, but more specific details are needed.
 
Comments: Good start, but more specific details are needed.
 
</pre>
 
</pre>
Line 17: Line 17:
 
==Overview==
 
==Overview==
  
The Large Piezo Vibration Sensor is a basic piezo sensor which is often used for flex, touch, vibration and shock measurements.  This sensor acts like a small capacitor which discharges up to +/-90V when the film moves back and forth. Some common uses this type of sensor are for impact sensing or as a flexible switch.  A larger scale example are piezo sensors that are laid within the road for use of traffic signals.
+
The [http://dlnmh9ip6v2uc.cloudfront.net/images/products/9/1/9/7/09197-02-L.jpg Large Piezo Vibration Sensor] is a basic piezo sensor which is often used for flex, touch, vibration and shock measurements.  This sensor acts like a small capacitor which discharges up to +/-90V when the film moves back and forth. Some common uses this type of sensor are for impact sensing or as a flexible switch.  A larger scale example are piezo sensors that are laid within the road for use of traffic signals.
  
 
This sensor can be purchased at [https://www.sparkfun.com/products/9197 SparkFun].
 
This sensor can be purchased at [https://www.sparkfun.com/products/9197 SparkFun].
Line 23: Line 23:
 
The [https://www.sparkfun.com/datasheets/Sensors/Flex/MSI-techman.pdf Technical Manual] and [http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/ForceFlex/LDT_Series.pdf datasheet] can also be found on Sparkfun's website.
 
The [https://www.sparkfun.com/datasheets/Sensors/Flex/MSI-techman.pdf Technical Manual] and [http://dlnmh9ip6v2uc.cloudfront.net/datasheets/Sensors/ForceFlex/LDT_Series.pdf datasheet] can also be found on Sparkfun's website.
  
 +
[[File:PiezoCircuit.PNG|thumb |alt=Example alt text |This is and example circuit layout of the piezo vibration sensor using an op amp and the beagle board.]]
 
==Usage==
 
==Usage==
  
Line 31: Line 32:
 
==Beagle Bone Usage==
 
==Beagle Bone Usage==
  
The value being read from the piezo sensor will be a voltage up to +/-90V.  This means that an analog pin must be used to read the value from the sensor.  The voltage being supplied to the sensor affects how much sensitivity you will receive.  Look in the technical manual to find a desired voltage that will work for you.  For the example below, I simply used a 5V source.
+
The value being read from the piezo sensor will be a voltage up to +/-0.5V.  This means that an analog pin must be used to read the value from the sensor.  The voltage being supplied to the sensor affects how much sensitivity you will receive.  Look in the technical manual to find a desired voltage that will work for you.  For the example below, I simply used a 5V source.
  
[[File:Piezo-breadboard-layout.jpg|thumb |alt=Example alt text |This is and example layout of the piezo vibration sensor using an op amp and the beagle board.]]
+
[[File:Piezo-breadboard-layout.jpg|thumb |alt=Example alt text |This is a picture of the layout of the piezo vibration sensor using an op amp and the beagle board.]]
  
 
==Reading the Analog Signal==
 
==Reading the Analog Signal==
Line 40: Line 41:
  
 
==Sample Code==
 
==Sample Code==
 +
The following code can be found on [https://github.com/geislekj/ECE497/tree/master/miniProject2 git hub].
  
 
<pre>
 
<pre>

Latest revision as of 04:55, 2 November 2012

thumb‎ Embedded Linux Class Kevin Geisler RHIT

Overview: 1, Nice overview, but a close up picture of the device would help.
Wiring:   1, What op-amp are you using?  A schematic of your actual circuit would be a big help.
Code:     2
git:      2
Demo:     2
Total:    8/10
Comments: Good start, but more specific details are needed.

Overview

The Large Piezo Vibration Sensor is a basic piezo sensor which is often used for flex, touch, vibration and shock measurements. This sensor acts like a small capacitor which discharges up to +/-90V when the film moves back and forth. Some common uses this type of sensor are for impact sensing or as a flexible switch. A larger scale example are piezo sensors that are laid within the road for use of traffic signals.

This sensor can be purchased at SparkFun.

The Technical Manual and datasheet can also be found on Sparkfun's website.

Example alt text
This is and example circuit layout of the piezo vibration sensor using an op amp and the beagle board.

Usage

Since the piezo sensor acts like a small capacitor, you can connect on a bread board as such. However an additional resistor is needed in order affect the low frequency of measurement. This is called the "loading effect". Additionally, if the signal from the piezo sensor is too low an op amp may be necessary.

More specific information and circuit diagrams can be found in the Technical Manual on pages 36-40.

Beagle Bone Usage

The value being read from the piezo sensor will be a voltage up to +/-0.5V. This means that an analog pin must be used to read the value from the sensor. The voltage being supplied to the sensor affects how much sensitivity you will receive. Look in the technical manual to find a desired voltage that will work for you. For the example below, I simply used a 5V source.

Example alt text
This is a picture of the layout of the piezo vibration sensor using an op amp and the beagle board.

Reading the Analog Signal

You can simply read the value of the piezo sensor from the terminal by reading the contents of a file in the /sys/devices/platform/omap/tsc/ain# directory. The # is 1 + the number of the analog pin you selected as your analog input. However this method will not allow you to accurately see the change of voltage as the film moves. To do this you will need to write a c program to print the values to the terminal repeatably or plot the voltage over time. The sample code below shows a simple program to print the voltage of the sensor to the screen.

Sample Code

The following code can be found on git hub.

/**************************************
Example Program for the Large Piezo Vibration Sensor - With Mass

This will display the value of the AIN0 Pin directly to the terminal repeatively.

wrtten by Kevin Geisler, 23-Sept-2012
***************************************/
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>

#define SYSFS_AIN1_DIR "/sys/devices/platform/omap/tsc/ain2"

FILE *fp; 

int readanalog(){
	if ((fp = fopen(SYSFS_AIN1_DIR, "r")) == NULL)
	{
		printf("Cannot open value file.\n");
		exit(1);
	}	

	//Set pointer to begining of the file
	rewind(fp);
	//Write our value of "0" to the file 
	char inString[10];
	fgets(&inString, 10, fp);
	fflush(fp);
//			printf("...value set to 0...\n");	
	fclose(fp);
//	printf(inString);
	return atoi(&inString);
}

int main(int argc, char** argv)
{

	//Run an infinite loop - will require Ctrl-C to exit this program
	while(1)
	{
	printf("%d\n",readanalog());
	usleep(100000);

	}
	return 0;
}