Piezo Sensor - 20MM
Piezo Sensor - 20MM
The Piezo Sensor - 20MM is a type of piezoelectric sensor designed to detect changes in pressure, vibration, or acceleration. This sensor is a disc-shaped device made from piezoelectric ceramic material, which generates an electric charge in response to mechanical stress or deformation.
The Piezo Sensor - 20MM is designed to convert mechanical energy into electrical energy. When a force or vibration is applied to the sensor, it produces a corresponding electrical signal. This signal can be measured and amplified to detect and quantify the magnitude of the force or vibration.
Piezoelectric ceramic material
20mm
2mm
10-20 mV/g
0.1 Hz to 10 kHz
1-10V
100-1000 ohms
-20C to +80C
-40C to +100C
Yes
Yes
Yes
1-year limited warranty
Dedicated technical support team available for assistance with integration and troubleshooting.
Piezo Sensor - 20MM DocumentationOverviewThe Piezo Sensor - 20MM is a sensitive and compact sensor designed to detect vibrations, knocks, and taps. It utilizes piezoelectric materials to convert mechanical stress into electrical signals, making it an ideal component for various IoT applications, such as gesture recognition, impact detection, and sound sensing.Technical SpecificationsDiameter: 20mm
Thickness: 2mm
Material: Piezoelectric ceramic
Sensitivity: 10mV/g
Frequency Range: 1Hz - 10kHz
Operating Temperature: -20C to 70C
Interface: Analog outputHookup and UsageTo use the Piezo Sensor - 20MM, connect the positive leg to an analog input pin on your microcontroller, and the negative leg to ground. Make sure to add a 1M resistor between the sensor output and the microcontroller input to protect the sensor and the microcontroller from high voltage spikes.Code ExamplesExample 1: Basic Knock Detection using ArduinoThis example demonstrates how to use the Piezo Sensor - 20MM to detect knocks or taps on a surface.
```c++
const int sensorPin = A0; // Analog input pin
const int threshold = 100; // Adjust this value to set the sensitivityvoid setup() {
Serial.begin(9600);
}void loop() {
int sensorValue = analogRead(sensorPin);
if (sensorValue > threshold) {
Serial.println("Knock detected!");
}
delay(50);
}
```
Example 2: Sound Detection using Raspberry Pi and PythonThis example shows how to use the Piezo Sensor - 20MM to detect sound waves and measure their intensity using a Raspberry Pi.
```python
import RPi.GPIO as GPIO
import timeGPIO.setmode(GPIO.BCM)
sensor_pin = 17 # GPIO 17 ( Broadcom numbering )while True:
sensor_value = GPIO.input(sensor_pin)
if sensor_value:
print("Sound detected! Intensity:", sensor_value)
time.sleep(0.01)
```
Example 3: Gesture Recognition using ESP32 and MicroPythonThis example demonstrates how to use the Piezo Sensor - 20MM to recognize gestures, such as taps, swipes, and holds, using an ESP32 board and MicroPython.
```python
import machine
import utimesensor_pin = machine.Pin(32, machine.Pin.IN)while True:
sensor_value = sensor_pin.value()
if sensor_value == 1:
print("Tap detected!")
elif sensor_value == 2:
print("Swipe detected!")
elif sensor_value == 3:
print("Hold detected!")
utime.sleep_ms(20)
```
These examples illustrate the versatility of the Piezo Sensor - 20MM and its potential applications in various IoT projects. By adjusting the sensitivity and threshold values, you can tailor the sensor's response to suit your specific project requirements.