logo

Project 6: Verfication testing, of Piezoelectric Sensor.

2017-12-03


Objective:

To demonstrate basic functionality of piezoelectric sensor.

The project uses code from: Link to Piezo Drum Kit Quickstart Guide.

The web article was article written by C. Taylor. Refer to his article for technical information. Intent here is to get the sensor tested so I can begin next step to create some custom drums. This project uses code compiled from the Arduino IDE. Use at your own risk.

Materials:

1. Linux Mint workstation with Keyboard and mouse.

2. Arduino Uno connected by USB cable to computer.

3. Piezoelectric sensor

4. 10 MΩ pull down resistor.

5. Solder Iron.

6. Solder, flux, and other cleaning materials

7. Misc. 22AWG Jumper Wires

Software:

1. Linux OS - used Raspbian

2. Arduino IDE 1.8.5 - GUI provided by Arduino to upload instructions to microcontroller. Check to ensure serial plotter is available.

Code:

Code from sparkfun. Use at your own risk.

#define DRUM1 2 // Our analog pin

byte val = 0; // Initializing the variable for the voltage value

void setup()

{

Serial.begin(9600); // Initializing the serial port at 9600 baud

}

void loop()

{

val = analogRead(DRUM1); // Read the voltage

Serial.println(val, DEC); // Print the voltage to the terminal

}

Hardware Set-Up, Compiling, and Testing:

1. Simply plug in circuit as per diagram.

Piezoelectric to Arduino schematic
Sensor to Arduino
Close up of set-up
Compiling and Testing

1. Simply plug in power cord and usb into socket and computer, respectively.

2. Copy and paste code into Arduino IDE.

3. Compile code to Arduino. Check the serial port is set-up correctly.

4. Open the serial plotter.

5. If everything working correctly serial should output zeros.

6. Bang the piezoelectric and watch the screen dance.

Screen capture of arduino gui
Screen capture of Serial Plotter

Conclusion

Enjoy. Now move onto the next step of programming a threshold and a speaker sound.

Design credit knxops.com in cooperation with Ltimas and co.
Copyright © 2019 by Gregory Altimas aka Greg Altimas