Arduino and Processing,Piezo Element

This is an updated version of the Piezo Element post from here.

To build the electronic circuit you need the following parts:

  • a piezo element,
  • a 1MΩ resistor,
  • and a couple of wires.

The schematic for the circuit looks like this:

Working circuit on breadboard

If everything is set up right, you can connect the board to the USB port of your computer.  The power LED should light up and the next step is to export the programm which reads the state of the switch to the board. Open the ap_ReadPiezoKnock.pde file in Arduino, set the right serial port and baudrate, compile the programm, and then press the reset button on your board and click on the export icon to send the program to the board.

To check if everything works fine so far, see if the control LED lights up when the switch is on ON-position. Now, you can download and unzip and open the file pa_PiezoKnock.pde in Processing. Then you will have to set the right serial port as described before.

Now, you can run your Processing programm. A new window will open and you should see something like this:

Output of the program


Comments are closed.