Arduino Prototyping Inputs #49: Knock Sensor

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 66

  • @rongarza9488
    @rongarza9488 Рік тому +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.

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

  • @samidudigital2753
    @samidudigital2753 11 місяців тому +1

    So helpful , thank you very much

  • @4uidrum
    @4uidrum Рік тому

    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  Рік тому +1

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

    • @4uidrum
      @4uidrum Рік тому

      @@MarcdeVinck Thank you very much!

  • @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 - ua-cam.com/video/ZqeA1CQsAQM/v-deo.html

  • @mohgujai
    @mohgujai 4 місяці тому

    Why do you need resistor across Ground and A0? I thought the Piezo just generates a voltage (no more than 5v) and then the aruidno should just read it?

    • @MarcdeVinck
      @MarcdeVinck  3 місяці тому +1

      To stop the pin from floating and giving random numbers.

  • @punkin314159
    @punkin314159 4 роки тому +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  4 роки тому +1

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

    • @punkin314159
      @punkin314159 4 роки тому +3

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

  • @surendrajain6713
    @surendrajain6713 5 років тому +1

    thanks very nice video

  • @mindstormsnxtbuilder
    @mindstormsnxtbuilder 11 місяців тому

    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  11 місяців тому

      Yes, that is possible. Just make sure your micro is fast and you can compare response times and amplitude.

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

  • @CanalRenaultClio
    @CanalRenaultClio 2 роки тому

    how about automotive knock sensor?

    • @MarcdeVinck
      @MarcdeVinck  2 роки тому +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.

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

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

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

  • @fazrulislam5053
    @fazrulislam5053 3 роки тому

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

    • @MarcdeVinck
      @MarcdeVinck  3 роки тому +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 3 роки тому

      @@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  3 роки тому

      @@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 3 роки тому

      @@MarcdeVinck arduino like arduino mega 2560 and PLC like ladder diagram(LD)/ladder logic!

    • @MarcdeVinck
      @MarcdeVinck  3 роки тому

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

  • @selinacervantes7407
    @selinacervantes7407 4 роки тому

    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 4 роки тому

      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  4 роки тому +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 4 роки тому +1

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

    • @MarcdeVinck
      @MarcdeVinck  4 роки тому

      @@selinacervantes7407 No problem, glad I could help!

  • @downeastlife6441
    @downeastlife6441 8 місяців тому

    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

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

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

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

  • @RicoNNect82nd
    @RicoNNect82nd 4 роки тому

    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  4 роки тому

      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 4 роки тому

      @@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  4 роки тому

      @@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 4 роки тому +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.

  • @sumbo8452
    @sumbo8452 4 роки тому

    Where is the code

    • @MarcdeVinck
      @MarcdeVinck  4 роки тому

      I go over where to find the code in the video -- ua-cam.com/video/X3XXRZMBPO0/v-deo.html

  • @richachauhan3319
    @richachauhan3319 3 роки тому

    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  3 роки тому

      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.