Arduino Prototyping Inputs #49: Knock Sensor

Поделиться
HTML-код
  • Опубликовано: 20 авг 2019
  • 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

  • @samidudigital2753
    @samidudigital2753 4 месяца назад +1

    So helpful , thank you very much

  • @rongarza9488
    @rongarza9488 9 месяцев назад +3

    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.

  • @surendrajain6713
    @surendrajain6713 4 года назад +1

    thanks very nice video

  • @davidbean5807
    @davidbean5807 2 года назад +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 года назад +1

      @@davidbean5807 No worries. I appreciate the explanation!

  • @aarontaylor7150
    @aarontaylor7150 3 года назад +1

    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 года назад +1

      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 - ruclips.net/video/ZqeA1CQsAQM/видео.html

  • @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 года назад +1

    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 года назад +1

      Sounds like you have a floating pin. Double check your resistor is wired properly and the correct value.

    • @punkin314159
      @punkin314159 3 года назад +3

      That was IT! Thank you. I should probably figure out how to solder so those tiny wires.

  • @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.

  • @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.

  • @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

      1/4W 1%, but any generic resistor should be fine.

    • @4uidrum
      @4uidrum 8 месяцев назад

      @@MarcdeVinck Thank you very much!

  • @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?

  • @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 года назад +1

      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.

  • @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.

  • @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 года назад +1

      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 года назад +1

      @@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)

  • @downeastlife6441
    @downeastlife6441 Месяц назад

    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.

  • @CanalRenaultClio
    @CanalRenaultClio Год назад

    how about automotive knock sensor?

    • @MarcdeVinck
      @MarcdeVinck  Год назад +1

      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.

  • @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 года назад +1

      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 года назад +1

      @@MarcdeVinck ok, thank you so much for your reply!

    • @MarcdeVinck
      @MarcdeVinck  3 года назад

      @@selinacervantes7407 No problem, glad I could help!

  • @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 года назад +1

      @@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!

  • @fazrulislam5053
    @fazrulislam5053 2 года назад

    Can this sensor measure the vibration of machine? Like textile weaving,knitting machine..

    • @MarcdeVinck
      @MarcdeVinck  2 года назад +1

      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.

  • @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 года назад +1

      @@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 :/

  • @jojolubid8217
    @jojolubid8217 Год назад

    what are your codes

    • @MarcdeVinck
      @MarcdeVinck  Год назад

      Watch the video! :) I go over it in detail, including where to find it.

  • @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.

  • @sumbo8452
    @sumbo8452 3 года назад

    Where is the code

    • @MarcdeVinck
      @MarcdeVinck  3 года назад

      I go over where to find the code in the video -- ruclips.net/video/X3XXRZMBPO0/видео.html