Arduino Prototyping Inputs #49: Knock Sensor

  Рет қаралды 24,202

Marc de Vinck

Marc de Vinck

5 жыл бұрын

Piezo sensors have a lot of different uses, but one of the more unique uses is called a knock sensor. By leveraging the fact that piezo generate electricity when they move, you can hook them up and identify when a vibration is felt. Unlike a vibration sensor, you can adjust its sensitivity through code.👉 Leave a tip via cryptocurrency if I've helped you out:
Bitcoin: bc1q2whh7h7nddf6lzzsns6phxdf2pyr6z0pvgy98t
Doge: DDgFpxEsBTdjgJDg3vxwuagia9UU5UmSVL
Etherium: 0x952e75561491951C50561b76eCFFFE1AC493d495
XRP: rPVaL4TNr3aMPhwgYsWZdgirM99S9QnfCA
Polkadot: 15pNwwPAsMwi59cMJC441P6KwYzCsq9WqQu156FF8KffRaee
Piezo (knock) Sensor -- amzn.to/39xrlTG
NEW! Learn to Solder Course (Free to LinkedIn Pro users) - bit.ly/2ILSzx3
Prototyping Supplies:
• Inexpensive Arduino Compatible Kit -- amzn.to/2Dfqs5U
• A More Deluxe Starter Kit -- amzn.to/3g9nFtR
• Jumper Wire Kit - amzn.to/3f9rtK4
• Breadboard Kit - amzn.to/3hIEPib
• WaveShield Kit -- amzn.to/3g9vMq6
• Motor Shield Kit -- amzn.to/3hISQfL
• Adafruit Circuit Playground Kit -- amzn.to/39yBfo9
My Camera Equipment:
• Primary Camera -- amzn.to/3fewxgA
• Camera Kit -- amzn.to/3jQvaI8
• Primary Lens -- amzn.to/3jQvaI8
• Macro Probe Lens -- amzn.to/3jQvaI8
• Main Light -- amzn.to/2X1SwB6
• Secondary (RGB) Lights -- amzn.to/3jQvaI8
• Mini Lights -- amzn.to/3jQvaI8
A few other FREE sensor tutorials you might like: (I have 100's!)
• Cellular Data shield - • Arduino Prototyping Te... z
• Capacitive Sensing - • Arduino Prototyping In...
• Luminosity Sensors - • Arduino Prototyping In...
• Thermocouples - • Arduino Prototyping In...
• Sensing Vibration - • Arduino Prototyping In...
A few other sensor tutorials you might like: (I have 100's!)
• Cellular Data shield - • Arduino Prototyping Te... z
• Capacitive Sensing - • Arduino Prototyping In...
• Luminosity Sensors - • Arduino Prototyping In...
• Thermocouples - • Arduino Prototyping In...
• Sensing Vibration - • Arduino Prototyping In...
And some playlists on prototyping with Arduino:
• The Basics - • Arduino Prototyping: T...
• Inputs - • Arduino Prototyping: I...
• Outputs - Arduino Prototyping, Techniques - • Arduino Prototyping Ba...
• Complete Prototyping Series! - • Arduino Prototyping: T...
Instagram - / marcdevinck
Twitter - / devinck
Don't forget to like and subscribe if you'd like me to make more videos!
My company, Panoptic Labs - www.panopticlabs.com

Пікірлер: 64
@rongarza9488
@rongarza9488 9 ай бұрын
My electronic drum kit's pads have the same type of piezo in an airtight cylinder. When the pad is hit, the pressure inside the cylinder increases and triggers the piezo, the "brains" then plays the sound associated with that sensor.
@samidudigital2753
@samidudigital2753 5 ай бұрын
So helpful , thank you very much
@surendrajain6713
@surendrajain6713 4 жыл бұрын
thanks very nice video
@MarcdeVinck
@MarcdeVinck 4 жыл бұрын
Thank you!
@davidbean5807
@davidbean5807 2 жыл бұрын
To increase sensitivity you can add a small neodymium to each side of the piezoelectric element. I have found it greatly improved the sensitivity.
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
I did not know that. Thanks for the tip!
@davidbean5807
@davidbean5807 2 жыл бұрын
@@MarcdeVinck I may have missed you a bit. At the time I was trying this I was using the piezoelectric with the vibration sensor sketch and wiring. I am sorry. I didn't realize the two sketches and wiring were using different signal pins ex. Vibration sensor using pin 9 and Knock sensor using pin A0. Originally was working with vibration sensor module SW420 and wanted to try using a piezo instead to see if sensitivity would increase it didn't until I added the magnets on either side. I then decided to use the knock sketch and realized the difference in wiring and sketch's and realized it is not as effective using it as a knock sensor. Even playing with program sensitivity values didn't make much difference. Anyway I just wanted to clarify that I did make an error in my comment. Sorry.
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
@@davidbean5807 No worries. I appreciate the explanation!
@aarontaylor7150
@aarontaylor7150 3 жыл бұрын
Hi great video btw I have a question is there a way to program the Piezo with the Arduino to make direct contact with the Piezo not just vibration?
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
The piezo is not programmed, it is just a "dumb"sensor, no specific electronics. You can make a capacitive touch sensor with Arduino. That would sense whenever a wire (or anything conductive) is touched. I have a video on that here - kzbin.info/www/bejne/kKLIcmR5hth0h68
@jeffbowyer4576
@jeffbowyer4576 3 жыл бұрын
In Arduino's IDE, "Examples 02. Digital toneKeyboard" requires 3x force sensing resistors. Can I use one of those force sensing resistors for this Knock Sensor project? If not, why not? Thanks for your guidance.
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
That example uses a force sensing resistor (FSR). You could use it, but you would have to hit the actual sensor to get a signal, which is analog. A piezo can sense vibration from further away. They are are also less expensive. So, yes you can, but it's not ideal.
@punkin314159
@punkin314159 3 жыл бұрын
Hi Marc, I followed your wiring and code, but I'm having trouble with the sensitivity. As I change the sensitivity it seems to go from not being able to sense, to being oversensitive and repeating "knock!" without interruption (no new input on the sensor). What could be going on?
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
Sounds like you have a floating pin. Double check your resistor is wired properly and the correct value.
@punkin314159
@punkin314159 3 жыл бұрын
That was IT! Thank you. I should probably figure out how to solder so those tiny wires.
@4uidrum
@4uidrum 8 ай бұрын
Thank you for the video! Quick question: Sorry I'm new to electronics... what is the wattage and tolerance of the 1M resistor?
@MarcdeVinck
@MarcdeVinck 8 ай бұрын
1/4W 1%, but any generic resistor should be fine.
@4uidrum
@4uidrum 8 ай бұрын
@@MarcdeVinck Thank you very much!
@ryanchan1835
@ryanchan1835 Жыл бұрын
Does the piezos analogue output vary by how hard you knock it? Like would a harder knock cause a stronger electric pulse?
@MarcdeVinck
@MarcdeVinck Жыл бұрын
Yes! As a fun test you can hold a through hole LED to the (+) & (-) parts of the piezo and "flick" it with your finger. You will see a difference in the LEDs brightness based on how hard you "flick" it. And you will also most likely kill the LED, so use a spare one that you don't mind burning out.
@pavansachi8193
@pavansachi8193 3 жыл бұрын
Great informative video. Hope you can help me. I have a sensitivity of 15 and tried upto 20. But output from piezo is very inconsistent. It registers a value above 20 after 3 to 4 clicks. So I can't get the toggle behavior. What's wrong?
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
Not sure how you are calculating sensitivity. Might want to try something more binary. Piezo generate an analog electrical signal, you could sense any voltage over 0...or close to zero.
@okekejeff1614
@okekejeff1614 Жыл бұрын
Would there be any change when you add the piezoelectric vibration module to the sensor?
@MarcdeVinck
@MarcdeVinck Жыл бұрын
The sensor is a piezo? Not sure what you are asking?
@mindstormsnxtbuilder
@mindstormsnxtbuilder 4 ай бұрын
Can i measure the amplitude using this element? Lets say im placing multiple piezo elements on a surface and hitting a certian point. Is there a way to tell which element gave the input with the highest amplitude?
@MarcdeVinck
@MarcdeVinck 4 ай бұрын
Yes, that is possible. Just make sure your micro is fast and you can compare response times and amplitude.
@pedrohenriqueborges5089
@pedrohenriqueborges5089 3 жыл бұрын
can i put it behind a door and receive its vibration? and why connect the resistor in parallel with the piezo?
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
You could, bu it it would have to be hit to register a signal. If you want higher resolution you might want to consider an inexpensive accelerometer or IMU. For the resistor? The reason is to be able to filter out false positives by always having a path for the electricity to go instead of the analog pin floating when not in use.
@downeastlife6441
@downeastlife6441 2 ай бұрын
Can anyone help me create something that detects hits but have it be about .5 inches and wireless and connect it to a phone app with flutter
@richachauhan3319
@richachauhan3319 2 жыл бұрын
can you please tell that If I want to connect more then 1 piezoelectric sensor to Arduino ..then How can I do it??
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
You can connect as many sensors as you have available pins. But be aware that vibrations from one sensor could be read by other sensors. All you have to do is change the code to another pin and wire it up. Google it, there is code available online.
@omarkhalaf9723
@omarkhalaf9723 4 жыл бұрын
Can this knock sensor detect vibrations in the air or does it only detect sound waves through solid material?
@MarcdeVinck
@MarcdeVinck 4 жыл бұрын
No, it won't detect vibrations in the air. For that I would recommend something similar to a speaker. When the speaker diaphragm moves it would generate and electrical current. You could also bounce a UV led off a very flexible surface and measure the movement (or reflectance), and that could give you an idea about air movment.
@omarkhalaf9723
@omarkhalaf9723 4 жыл бұрын
@@MarcdeVinck thank you, that is actually a smart idea. I also found some sort of an intensity meter which I can use, along with some calculations, to detect the loudness of a sound in dB.
@MarcdeVinck
@MarcdeVinck 4 жыл бұрын
@@omarkhalaf9723 Look up Arduino Decibel Meter, there are tons of resources. Also know that a microphone measures air movement. (basically what I was explaining by using a speaker)
@selinacervantes7407
@selinacervantes7407 3 жыл бұрын
Would someone be able to explain to me how the sensitivity works? I think I understand but I am not 100% sure? I understand that the lower the number on the code, the higher the sensitivity. From what I can understand from the code: when I hit the piezo it generates a voltage. The arduino detects that voltage. The sensitivity changes ONLY the response of the arduino? For example, if it is closer to 0, then the arduino will displace “knock” at a lower piezo voltage (assuming 0.1) compared to being set to 300 which requires the arduino to respond to a much higher voltage (assuming 5)? So the sensitivity does nothing to the piezo itself, just the reaction of the arduino to the amount of voltage released by the piezo?
@selinacervantes7407
@selinacervantes7407 3 жыл бұрын
I would also like to add a little note: when only using the LED pin and ground (red wire connected directly to LED) when the sensitivity was set to 0, the piezo would click at constant intervals and when it was set to 300 the clicking would stop. This is why I asked the question, is the arduino sending a base voltage through the piezo, and does that voltage change/have anything to do with the sensitivity?
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
Yes, you have the basic concept correct. The piezo generates electricity (the piezo effect) when a mechanical force is applied. No power to the piezo is necessary. The sensitivity is the Arduino reacting via code to the amount of energy created by the force that is applied to the piezo.
@selinacervantes7407
@selinacervantes7407 3 жыл бұрын
@@MarcdeVinck ok, thank you so much for your reply!
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
@@selinacervantes7407 No problem, glad I could help!
@CanalRenaultClio
@CanalRenaultClio Жыл бұрын
how about automotive knock sensor?
@MarcdeVinck
@MarcdeVinck Жыл бұрын
Sadly I think I need that for my car! But in all seriousness, you could grab audio waveforms of your engine running and potentially find a "knock" in the audio spectrum.
@fazrulislam5053
@fazrulislam5053 2 жыл бұрын
Can this sensor measure the vibration of machine? Like textile weaving,knitting machine..
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
Possibly, but it depends on the amplitude and frequency. You can also use an accelerometer for higher frequency and lower amplitude situations, but again, it depends on a lot of factors, including the sensors durability in a high stress situation.
@fazrulislam5053
@fazrulislam5053 2 жыл бұрын
@@MarcdeVinck thanks for your kind reply! Bt i have question regarding this,' if we use piezoelectric vibration sensor then as controller which one we should use arduino or plc..which one more impactful and why?
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
@@fazrulislam5053 It depends. Which Arduino? Which PIC? They run at different speeds depending on the board. Didn't use to be that way, but a lot has changed in the last 15+ years. I would choose the board that runs fast enough and you are familiar with programming.
@fazrulislam5053
@fazrulislam5053 2 жыл бұрын
@@MarcdeVinck arduino like arduino mega 2560 and PLC like ladder diagram(LD)/ladder logic!
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
@@fazrulislam5053 Again, depends on what you are specifically measuring. You can use board, but I would try to connect with someone locally that can get you a better answer and see your specific needs.
@Masiyamusic
@Masiyamusic 2 жыл бұрын
can the arduino be set to switch the led off after a set time
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
Yes! You can easily add a delay and then turn an LED on/off.
@Masiyamusic
@Masiyamusic 2 жыл бұрын
@@MarcdeVinck ok thanks i actually want to switch a siren or buzzer on for a set period , is there a way of doing that please?
@MarcdeVinck
@MarcdeVinck 2 жыл бұрын
@@Masiyamusic You can easily do that by using a buzzer or speaker. Turn on (or play a tone) through the speaker when a knock is sensed, add a delay for as long as you want, then turn it off. It's an easy project! Good luck and have fun!
@RicoNNect82nd
@RicoNNect82nd 3 жыл бұрын
Never get 0 out of it. Its always abput 70. after one knock, it holds about 200 for a certain time and slowly reduce itself back to 70
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
Same piezo? And nothing else wired up? Sounds like a capacitor and/or a floating pin issue? What pin are you using? Same as the video example?
@RicoNNect82nd
@RicoNNect82nd 3 жыл бұрын
@@MarcdeVinck Already switched all components, same behavior. You think it's not soldered alright? Maybe some loose Parts? Yes, I use nearly the same build.
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
@@RicoNNect82nd I can't say if it's a solder issue without seeing it. Not sure where you even have solder if you built it the same way?
@RicoNNect82nd
@RicoNNect82nd 3 жыл бұрын
@@MarcdeVinck I solderd it in the first place, without jumpwire before. The soldered places look clean so far. Want to try another input. Already swapped Arduino and Piezo and Inbetriebnahme resistors, same issue :/
@Sick1982
@Sick1982 3 жыл бұрын
Nobody explains the 1M resistor and it's function in the circuit .. like what does it do .. why 1M .. what if we take another value ...
@MarcdeVinck
@MarcdeVinck 3 жыл бұрын
The 1 mega ohm resistor limits the travel of almost all the electricity on the pin. It makes the pin very stable, with no fluctuating voltages, and therefore very sensitive to variations you can leverage via code.
@jojolubid8217
@jojolubid8217 Жыл бұрын
what are your codes
@MarcdeVinck
@MarcdeVinck Жыл бұрын
Watch the video! :) I go over it in detail, including where to find it.
@sumbo8452
@sumbo8452 4 жыл бұрын
Where is the code
@MarcdeVinck
@MarcdeVinck 4 жыл бұрын
I go over where to find the code in the video -- kzbin.info/www/bejne/jmS7iYWQgqeDhZI
Arduino Prototyping Inputs #51: Hall Effect Sensors
4:16
Marc de Vinck
Рет қаралды 8 М.
Arduino Prototyping Techniques #104: Perfboard
7:42
Marc de Vinck
Рет қаралды 63 М.
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 6 МЛН
Sigma girl and soap bubbles by Secret Vlog
00:37
Secret Vlog
Рет қаралды 11 МЛН
Inside Out 2: Who is the strongest? Joy vs Envy vs Anger #shorts #animation
00:22
Sensors - which one to use
17:06
Electronoobs
Рет қаралды 1,3 МЛН
TAP/KNOCK SENSOR EXPLAINED | KY-031 ARDUINO TUTORIAL
9:46
Mikael Abehsera
Рет қаралды 8 М.
Mechanical  Switches are Obsolete?! Switch to a Latch Circuit! EB#53
10:36
Hacking a weird TV censoring device
20:59
Ben Eater
Рет қаралды 3 МЛН
DIY FYI: Piezo Sensors
3:51
Blitz City DIY
Рет қаралды 96 М.
Force Sensing Materials
10:03
0033mer
Рет қаралды 38 М.
How the portal illusion works
9:42
Steve Mould
Рет қаралды 6 МЛН
Актуальность кирпичной печи
0:24
Zavorotniy Maksim
Рет қаралды 2,9 МЛН
Nhảy bất chấp/kỳ kỳ tv & Family #shorts
0:16
Kỳ kỳ tv & Family
Рет қаралды 15 МЛН
Самодельное ухо?!? @zackdfilms - автор анимации.
0:31
Время знаний
Рет қаралды 6 МЛН
SMART idea and very USEFUL 📱 #camping #survival #bushcraft #outdoors
0:14
Ăn Vặt Tuổi Thơ
Рет қаралды 32 МЛН
Funny Escalator #katebrush #shorts
0:11
Kate Brush
Рет қаралды 7 МЛН