Starting Electronics Needs Your Help!
It is that time of the year when we need to pay for web hosting and buy new components and equipment for new tutorials. You can help by making a donation. Contribute to this website by clicking the Donate button. The total will be updated once daily. (You may need to clear your browser cache to see the updates.)

Target Amount: $2000
Amount Raised: $1960

Donations Received

Top Donor: C.C. $100


Project 9: Detect a Knock on a Sensor (Knock)

Created on: 2 August 2012

Tutorial 10 – Pages

A piezo sensor is connected to analog pin A0 of the Arduino. When the sensor is knocked or tapped, the on board "L" LED will light up and the message "Knock!" is sent out of the serial port for display in the Arduino IDE serial monitor window.

Parts Needed

  • 1 × Piezo disc
  • 1 × 1M ohm resistor (1 meg ohm)

Arduino Website Page


In the Arduino IDE

File → Examples → 6.Sensors → Knock

Building the Circuit

The circuit diagram and breadboard connections can be found on the Knock Arduino website page.

Programming and Operating the Circuit

Find the sketch for this project under File → Examples → 6.Sensors → Knock in the Arduino IDE and upload it to the Arduino board.

Open the serial monitor window in the Arduino IDE. Tap or knock on the piezo sensor to see the on-board LED light up and the "Knock!" message sent to the serial monitor window.

Project 9 Video

Can't see the video? View on YouTube →

← Go back to P8: CalibrationGo to P10: barGraph →