Skip to main content

Arduinos: Piezo Hardware

Physical Computing, the Internet of Things, Sensors and Servos

Hardware schematics

In this set up, imagine that we have two circuits. Both start and end at the Arduino. What's incredible about piezo elements is that they can operate as input sensors or output elements to create tones.

So first, we want to gain input from the first piezo. Connect a jumper cable from analog input 0 (A0) to the breadboard. Then connect a resistor from that same row to a different row. Then in the same row as the A0 jumper cable and the gold end of the resistor, connect the red wire of your piezo element. Then in the other row of your resistor, connect the black wire of your piezo. Finally, take a second jumper cable and connect it back to ground (GND) of your Arduino. This is everything you need to sense the knock.

Next, connect a jumper cable from digital pin 8 (8) to a third and separate row. Connect the red wire of your second piezo to this same third row. Connect the black wire of your second piezo to your second (GND) row. (This is just for ease since you are already grounding te resistor and the first piezo, but feel free to set up a fourth row.) 

You can have more elements connected than your code requires and nothing will happen as long as all of your circuits are closed.

Breadboards and Jumper Wires

Using a solderless breadboard is one way to build impermanent prototypes. While soldering may be of use later, jumper wires are used to make connections between the pins on the Arduino and the components of your build. Both the Arduino pins and the holes in the breadboard are conductive, allowing for the use of male-to-male jumper wires with a colored plastic coating and insulated terminals. (To learn about other types of jumper wires, see

The breadboard allows for connections of multiple components without physically attaching the individual pieces. Based on the diagram provided above, our breadboard's connections run vertically, but do not bridge the divide in the middle. (For more info on breadboards, see

When you have advanced in learning about Arduinos, learn more about soldering and safety with or or .

Arduino Uno

The Arduino Uno is a single-board microcontroller, and is the standard in the Arduino suite of microcontrollers. (For more information on other types of boards like the Mega, Mini, Lilypad, etc. and their functionalities, please visit

The Arduino Uno has a USB port to connect to your laptop. You will need a USB cable type A/B. It also has a slot for external power supply.

You will notice that the Arduino has 32 holes, which are called pins. The bases of each pin are conductive.

The Arduino Uno has 14 digital pins (0-13). Digital pins can operate as inputs or outputs, but default to INPUT. Pins set to OUTPUT provide enough current to brightly light an LED. Because so much current is produced through OUTPUT, it is recommended to use a resistor. 

  • 6 of the digital pins can produce pulse width modulation, and are labeled with a tilde (~). Pulse width modulation allows the microcontroller to create analog values through digital means, and requires the function analogWrite(). 
  • Digital pin 13 is special because it has a surface mount LED already connected on the Arduino, and is regularly used as a test that the Arduino is working or as an indicator for the beginning part of any code.
  • Serial communication occurs using digital pins 0RX (receive) and 1TX (transmit). (For more info, see )

The Arduino Uno has 6 analog pins(A0-A5). Analog pins default to INPUT, usually for reading analog sensors, but can perform the same tasks as digital pins. To distinguish them from the digital pins in the code, they are labeled with an A (e.g., A3). The Arduino has a 6 channel analog-to-digital converter and any input read from the analog pins will be converted to a number on a scale of 0 to 1023.

The Arduino Uno has a reset button which erases the code previously loaded. It also has a reset pin if you need to reset in the middle of your sketch.

The Arduino Uno has 3 dedicated ground (GND) pins (though any pin can be coded to ground), which grounds the circuit without requiring code. To provide power, there is a 3.3 volt (V) pin and a 5V pin. 

The AREF pin is used for analogReference() (For more information, see here AREF )

Resistor Color Code Chart

Electronic Components


For input, we will use the analog sensor, the first piezo element. It detects vibration using ceramic and metal and converts that into electric voltage. Nearly any sensor you can think of will work with the Arduino, and Sparkfun carries many types including: accelerometer, biometrics, capacitive, current, flex/force, gyros, ID, IMU, infrared, light/image, magneto, proximity, radiation, sound, temperature, vernier, and weather. (See sensors)


For output, we will also be using the second analog piezo element. When you send electricity through a piezo, it vibrates at certain frequencies which produces tones.


To reduce the amount of current, we will be using one resistor. Resistors reduce current flow and lower voltage. The amount of resistance provided is color coded. Look at the resistor we have provided you, and use the color chart below to determine resistance. To read more about resistors, check out .

Fritzing Schematic

Fritzing is a wonderful application that allows for digitally prototyping and creating schematics. The first image above shows the hardware view in the Project View. This was built using the extensive Parts Library, and dragging and dropping the parts in a user-friendly interface. While you first want to have built the circuit in real life, you then want to rebuild the circuit in Fritzing. When the circuit is ready in Breadboard view, you can switch modes to schematic and get the diagram here. This shows the electronic circuit. You can also switch to PCB (printed circuit board) mode and use the Autoroute function to generate a PCB design with copper traces that you can then etch yourself or get printed. You can import your Arduino code in Fritzing and you can also test your circuit. To learn more, check out

University of Florida Home Page

This page uses Google Analytics - (Google Privacy Policy)

Creative Commons License
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.