Pages: [1] 2   Go Down
Author Topic: peizo knock Example  (Read 2015 times)
0 Members and 1 Guest are viewing this topic.
Brisbane
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4684
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Brisbane
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 (20 KB, 300x217 - viewed 26 times.)

* UNO-Blink.jpg (98.38 KB, 555x624 - viewed 31 times.)
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4684
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2544
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4684
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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  smiley-wink )
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Brisbane
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Experience, it's what you get when you were expecting something else.

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4684
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

texas
Offline Offline
God Member
*****
Karma: 27
Posts: 862
old, but not dead
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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

Experience, it's what you get when you were expecting something else.

Brisbane
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

Logged

Dubuque, Iowa, USA
Offline Offline
Faraday Member
**
Karma: 49
Posts: 2544
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Johannesburg. UTC+2
Offline Offline
Faraday Member
**
Karma: 105
Posts: 4684
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
« Last Edit: March 09, 2013, 05:11:04 am by JimboZA » Logged

The Elders of the Internet know who I am
I'm on LinkedIn: http://www.linkedin.com/in/jimbrownza

Offline Offline
Edison Member
*
Karma: 58
Posts: 2078
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: March 09, 2013, 05:05:31 am by Erdin » Logged

Pages: [1] 2   Go Up
Jump to: