/
Arduino Knock Lab CTY SAR FCPS Shawn  Lupoli , Elliot Tan What are we working with? Arduino Knock Lab CTY SAR FCPS Shawn  Lupoli , Elliot Tan What are we working with?

Arduino Knock Lab CTY SAR FCPS Shawn Lupoli , Elliot Tan What are we working with? - PowerPoint Presentation

yoshiko-marsland
yoshiko-marsland . @yoshiko-marsland
Follow
342 views
Uploaded On 2019-10-31

Arduino Knock Lab CTY SAR FCPS Shawn Lupoli , Elliot Tan What are we working with? - PPT Presentation

Arduino Knock Lab CTY SAR FCPS Shawn Lupoli Elliot Tan What are we working with How to detect a physical Knock A Piezo element can be used to detect vibration which is produced by our knock Piezo ID: 761637

piezo knock serial wires knock piezo wires serial pin led arduino sensor element threshold port analog variable connected part

Share:

Link:

Embed:

Download Presentation from below link

Download Presentation The PPT/PDF document "Arduino Knock Lab CTY SAR FCPS Shawn Lu..." is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Arduino Knock Lab CTY SAR FCPS Shawn Lupoli , Elliot Tan

What are we working with?

How to detect a physical Knock? A Piezo element can be used to detect vibration, which is produced by our knock. Piezo is an electronic device which generates a voltage when it is physically deformed by a vibration, sound wave or mechanical strainCan also put a voltage across a piezo  piezo will vibrate and create a toneIf the sensors output is stronger than a certain threshold, the Arduino will be knocked

Arduino Knock Schematic

Goal When we “Knock” the piezo element The LED will flash “Knock!” will be printed to the Serial Monitor

Programming “Knock”

Knock: Part 1 Initializing global variables The LED will be connected to pin 13 The piezo is connected to analog pin 0 (A0)Threshold value = 1A variable to store the sensor readingA variable to store the last LED statusSetup()pinMode(pin, mode) configures the pin to behave either as an input or an outputSerial.begin(9600) starts using the Serial Port

Knock: Part 2 Loop() Read the sensor using analogRead ()If the sensor reading is greater than the threshold turn on the lightupdate the LED pin using digitalWrite()Send string back to the computer’s Serial MonitorAdd in a delay to avoid overloading the serial port buffer

CODE

Building the Knock circuit

Supplies 1 Arduino Leonardo board 1 breadboard 3 short wires (two black, one red) 1 medium wire (red)2 long wires (two black)1 LED1 resistor (1 MΩ)1 piezo element * Notes: Wires are 22 or 24 AWG, solid Short wires = 5 cm Medium wires = 12 cm Long wires = 16 cm

Diagram of Knock Circuit

Running and reading output Run the program as normal, but open the Serial monitoring window for the Analog port .

Questions?