Go Down

Topic: peizo knock Example (Read 2410 times) previous topic - next topic

Aarwhy

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. 

JimboZA

Quote
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.
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Erdin

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

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

Aarwhy

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

JimboZA

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.

"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Chagrin

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.

JimboZA

Quote
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  ;) )
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Aarwhy

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:   https://www.youtube.com/embed/8ZVFKvgJQtA?feature=player_detailpage

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?

afremont

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.
Experience, it's what you get when you were expecting something else.

JimboZA

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
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

afremont



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.
Experience, it's what you get when you were expecting something else.

Aarwhy

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.
http://www.youtube.com/watch?v=DIiWoGUPP78

Chagrin

For cleaning up the signal, try
http://leucos.lstilde.org/wp/2009/06/piezo-transducer-signal-conditioning/
and
http://people.ece.cornell.edu/land/courses/ece4760/FinalProjects/f2012/asj42_gs368_ln226_awh49/asj42_gs368_ln226_awh49/index.html

JimboZA

#13
Mar 09, 2013, 10:34 am Last Edit: Mar 09, 2013, 11:11 am by JimboZA Reason: 1
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:

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

"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Erdin

#14
Mar 09, 2013, 11:03 am Last Edit: Mar 09, 2013, 11:05 am by Erdin Reason: 1

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.

Go Up