peizo knock Example

Arduino UNO Board:
I have actually progressed from the blink example. I have read everything I can find, and look at so many items in the forum , but cant find anything on the knock example.
I think I have followed what directions I have found, but I am unable to get it to work.
If kind person that has progressed through this area might be able to enlighten me, I would be appreciative.

but I am unable to get it to work.

You'll need to explain what that means... what's happening that should not happen, what's not happening that should?

Is your sketch compiling but not working properly, or not compiling in the first place... if it's not compiling what are the compile messages?

Post your code and a schematic... not the code and schematic as suggested in the tutorial, but the code you typed in and the schematic as built.

Please modify the Subject in your first post. Peizo -> Piezo

About your question, http://lmgtfy.com/?q=arduino+piezo+knock

Reply to Jimbo
Thanks:

  1. what's happening that should not happen, [ Nothing, seems fine ]
  2. what's not happening that should? [ It is suppose to activate the LED and place a notice on the monitor The peizo does not work the program ]
  3. Sketch is loading, compiling OK & from what I know it appears to be working OK There are no error messages in the box.
    The TX TR led's flash on loading as well as the led.
  4. The code I have used & loaded is the code in; File/ examples/ Sensors/ Knock

Arduino has assigned COM3
I have connected the board as per Image

Knock.jpg

Hey Rod... nope, not working for me either. I even changed the threshold value to 10 and then to 5, still nothing.

Maybe piezos of different make and model, would require a different resistor.... I wouldn't know.

For the record, mine is a HCM1206UX-G, and I just tested it as a buzzer with 9V in and it works that way round.

BUT....I set the threshold to 0, which would make the line if (sensorReading >= threshold) activate every time, since >= includes 0, and it actually works.

So I'm guessing it's a piezo sensitivity thing.

Some piezo buzzers have circuits in them to make them "buzz" when voltage is applied (they're "self oscillating"). That's what yours is, JimboZA, and those (apparently) don't work as knock sensors.

those (apparently) don't work as knock sensors.

Aha!

So, next question then, is how does one specify to the shop that one wants one as a sensor not as a buzzer? (Hmmmm, probably answered my own question there :wink: )

JIM, Thanks for putting in the time & effort to do that,

I have it working of sorts. Nothing like the sensitivity I want, but working.
Look at this for sensitivity: YouTube

I have changed

  1. const int threshold =1; // threshold value to decide when the detected sound is a knock or not
  2. int sensorReading = 1.2; // variable to store the value read from the sensor pin
  3. delay(2); // delay to avoid overloading the serial port buffer

I also read somewhere that if you increase the size of resister, it will increase sensitivity, any body know anything about that?

I'm afraid this circuit screams for an op-amp. Allot of those piezo buzzers are very narrow banded, but they all pretty much should be able to "hear" something; it just might be extremely weak signal especially the further it is from the centre frequency of the piezo element. I've used one of the cheap rad shack ones that look like the picture for listening to a ticking watch, but it took an op-amp and a comparator to clean it up enough for a micro to really process. That video with the ants is certainly using large amounts of amplification to get that kind of sensitivity.

Rod your 2) and 3) won't make any difference... in 2) that just sets the initial value, which gets overridden first time thru the loop, and 3) is just how fast it goes thru the program.

Regarding the resistor, well I'm going to try that now with a bunch of 1M resistors in series and see what happens

Aarwhy:
I also read somewhere that if you increase the size of resister, it will increase sensitivity, any body know anything about that?

I'm pretty sure that the resistor is there to bleed off any DC that might try to build up between the sensor and the high impedance input pin. A bigger resistor will still do that function, but lengthen the time constant allowing for higher signal peaks I think. The extra amplification benefits will probably taper off fast as the value is increased.

I thank all who have commented, it all helps me. It helps in joining the Dots
You can probably see by my comments, I am mentally challenged when it comes to Electronics, and forums also for that matter.

I just tried another 1K resistor and it DID improve the sensitivity.
My objective with my Arduino Knock is to make an peizo digitizing sensor for my DIY cnc machine.
I have been experimenting with mechanical digitizing probes, but with the vast amount of make & break contacts, the points give out at about 30 - 40,000.

So I saw this fellows idea, but I cant contact him. I wish I could, I can probe and produce Gcode no problem, we could help each other.
So it's trial and error, and with the the help from others I hope to finally have some success.

For cleaning up the signal, try
http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/
and

I did a bit of experimenting with thresholds and resistances, didn't seem to make any difference and I stopped when my eyes glazed over.

Maybe my piezo is indeed configured to buzz only, not sense.

Oh, and on the subject of buzzing, here's a big BZZZZZZZZZZZZZZZZZZZZZZZZZZTTTTTTTT to Erdin (representing the Spelling Police) for this unnecessary pedantry:

Please modify the Subject in your first post. Peizo -> Piezo

JimboZA:
BZZZZZZZZZZZZZZZZZZZZZZZZZZTTTTTTTT to Erdin

I was thinking that if someone searches the forum for "piezo", this thread would not be found. But also the text of the posts is searched. So it isn't a problem.

I was thinking that if someone searches the forum for "piezo", this thread would not be found

Fair comment Erdin, I apologise.

Since it sort of applies, TI makes available a really nice piece of freeware called Filter Pro. It can be used to design all kinds of active (op-amp) audio filters. All kinds, anything you might need, believe me. Awesome stuff. Really. :wink:

Firstly By comments I must be in the wrong section or something?
If so I am sorry, I started this because i could not find anything about getting knock examples to work.

Jim, I cant tell you how much I have appreciated your efforts, and I am really sorry I asked you for your help, I had no idea that it would be so difficult.
Chagrin, Thanks for giving me these links to look at, but I am lost just trying to get the arduino board with thier most basic example working.
It is an impossibility for me to start learning this stuff now, at over 70 it's too late. Mechanical, HTML, Gcode, Mcode, basic electronics, and that is my lot.
unless there is an off the shelf item, I could not achieve it.

I thought my project would be fairly easy, even for me, how wrong I was, & I am really embarrassed that Jim has gone so far for me.
So I will have to persevere with no protection. I figure since i need the absolute minimum touch, that hopefully it wont do to much damage.

My peizo would not activate no matter how hard i Pressed or squeezed, only if I tapped it, so off to Google.
Peizo that are designed to compressed are different, while they all may piezoelectric units, speakers & buzzers are only covered with this active compound.
Units made to compress are a bit thicker to accomplish that, one universal accepted is Peizoelectric film.
I found One that seems to be promising, and Arduino apparently are/were putting in their starter kit. https://www.sparkfun.com/products/9199

Help, the next part of the project is to get it not to put KNOCK, but to activate an IC relay
If any have any suggestions, That would be really good.

Jim, I cant tell you how much I have appreciated your efforts, and I am really sorry I asked you for your help, I had no idea that it would be so difficult.

You're welcome. Sorry I couldn't actually help- seems my piezo is one of those buzz only ones?