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

From eLinux.org
Jump to: navigation, search
m (Added Grade)
 
(11 intermediate revisions by 2 users not shown)
Line 1: Line 1:
[[Category:ECE497]][[Category:SparkFun]]
+
{{GeislekjHead}}
 +
[[Category:ECE497]]
 +
[[Category:SparkFun]]
  
 
<pre style="color:red">
 
<pre style="color:red">
Overview:  
+
Overview: 1, Nice overview, but a close up picture of the device would help.
Wiring:   
+
Wiring:  1, What op-amp are you using?  A schematic of your actual circuit would be a big help.
Code:     
+
Code:    2
git/Compiles with make:  
+
git:     2
Demo:     
+
Demo:    2
Total:     
+
Total:    8/10
Comments:  
+
Comments: Good start, but more specific details are needed.
 
</pre>
 
</pre>
  
 
__TOC__
 
__TOC__
  
=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 21: 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.
  
=Usage=
+
[[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==
  
 
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.
 
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.
Line 27: Line 30:
 
More specific information and circuit diagrams can be found in the [https://www.sparkfun.com/datasheets/Sensors/Flex/MSI-techman.pdf Technical Manual] on pages 36-40.
 
More specific information and circuit diagrams can be found in the [https://www.sparkfun.com/datasheets/Sensors/Flex/MSI-techman.pdf Technical Manual] on pages 36-40.
  
=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==
  
 
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.
 
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=
+
==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 21:55, 1 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;
}