Piezo Sensor Problem with Wave Shield

Adafruit Ethernet, Motor, Proto, Wave, Datalogger, GPS Shields - etc!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
RossW
 
Posts: 10
Joined: Mon Dec 26, 2011 1:44 pm

Piezo Sensor Problem with Wave Shield

Post by RossW »

Hi,

I setup a piezo sensor as a knock sensor per the Arduino Knock tutorial and am having problems when the Arduino is powered by a 9V switching regulated wall wart supply (Adafruit part). The Arduino is an UNO R3, and I have an Adafruit Wave Shield onboard used to generate a sound when the Arduino detects a "knock" on the sensor. I followed the tutorial, replacing the LED with the Wave Shield and appropriate code, and it works fine when the Arduino is powered via laptop USB. When I disconnect the USB and try to power with the 9V supply the thing sounds off in an infinite loop, regardless of the state of the sensor. I found it would work when the sensitivity is raised to around 300 (ADC scale 0-1023), so I measured the voltage across the analog pin (I used A1) and ground and found approximately constant 130 mV across the sensor wires/Arduino A1 to ground pins. When connected via USB only there is no measurable voltage present unless the sensor is flicked. What is going on here? Why is voltage present on the Arduino/sensor pins (A1 to ground) when powering by 9V supply through the 2.1mm jack? I hope this rambling post makes sense...

Thanks.

Ross

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Piezo Sensor Problem with Wave Shield

Post by adafruit_support_bill »

Switching supplies are not always the quietest supplies. But 130mv after the Arduino regulator sounds like more than usual.

Are you measuring that with a scope, or a multimeter?

RossW
 
Posts: 10
Joined: Mon Dec 26, 2011 1:44 pm

Re: Piezo Sensor Problem with Wave Shield

Post by RossW »

I am measuring with a digital multimeter on "200mV" DC setting. Not the best approach, for sure. Whatever the actual magnitude, the fact that the sensitivity (minimum ADC output threshhold for coded "if" statement) needs to be up around 300 for the sensor to work correctly and not just run over and over on its own tells me there is significant voltage present on the A1 pin. The sensor works properly on USB power at a sensitivity setting of 10.

Unless the switching supply is radiating to the piezo sensor cable, which is a simple 24 gage three-conductor fine-stranded unshielded affair (one conductor not used), approximately 10 feet long. I think it's twisted, but I can't tell because the outer jacket is molded over the trio.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Piezo Sensor Problem with Wave Shield

Post by adafruit_support_bill »

Out of curiosity, I put a scope on the three 9v adapters I had on my bench. They were all fairly noisy with 45 to 96mv spikes @ 80-100KHz and a lot of higher frequency ringing. Connected to an Arduino, most of that noise managed to find its way onto the 5v pin, with measurements ranging from about 30 to 80 mv.

Measuring the same with a few different multimeters gave me results all over the map. The Wavetek was the steadiest of the bunch and gave AC readings within 10-15% of the scope.

Disconnect the piezo and measure the voltage just across the resistor. At what threshold (if any) does your sketch false-trigger?

RossW
 
Posts: 10
Joined: Mon Dec 26, 2011 1:44 pm

Re: Piezo Sensor Problem with Wave Shield

Post by RossW »

Thanks. I will try that tonight. So, are you suggesting I connect a 1Mega Ohm resistor from pin A1 to ground (I have a 1M across the piezo output leads now - Sparkfun Large Piezo Sensor), then manipulate the threshhold value until it false triggers? I tried just connecting a 10K resistor across the two pins with no sensor attached, and it wouldn't false trigger with the threshhold set as low as 15 or so. It did trigger readily if I touched either leg of the resistor with my finger.

RossW
 
Posts: 10
Joined: Mon Dec 26, 2011 1:44 pm

Re: Piezo Sensor Problem with Wave Shield

Post by RossW »

Forgot to mention before, but with the 10K resistor between A1 and ground I measured DC voltage and saw zero volts DC. Didn't think to measure AC. Very late last night. I have one of those Jyetech kit scopes and this is probably a great opportunity to figure out how to use it.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Piezo Sensor Problem with Wave Shield

Post by adafruit_support_bill »

I tried just connecting a 10K resistor across the two pins with no sensor attached, and it wouldn't false trigger with the threshhold set as low as 15 or so.
That suggests that the noise is being picked up by the sensor and/or sensor leads.
It did trigger readily if I touched either leg of the resistor with my finger.
The human body makes a surprisingly good antenna too.

RossW
 
Posts: 10
Joined: Mon Dec 26, 2011 1:44 pm

Re: Piezo Sensor Problem with Wave Shield

Post by RossW »

Sounds very likely, thanks. Any ideas how to shield the cable from noise? The sensor datasheet/manual warns about cable shielding causing other problems. I may just get a 6xAA battery holder and run it from that. Thanks for your help.

By the way, I got the idea from Sparkfun, where one of their engineers made a "Young Frankenstein" door knocker for his office using their mp3 shield. The Wave Shield was much less expensive and easier to code, so I used that instead. Really slick little player. The Knock Arduino tutorial was also quite helpful, and it verified that my approach (Sparkfun guy's, too) was the right way to do it. Kind of cool little project.

User avatar
adafruit_support_bill
 
Posts: 88093
Joined: Sat Feb 07, 2009 10:11 am

Re: Piezo Sensor Problem with Wave Shield

Post by adafruit_support_bill »

Dealing with noise is sort of a black-art. Basically, you can try to shield it and/or filter it. These remedies can be applied at the source and/or the affected component. If shielding the sensor leads is undesirable, you might try putting the electronics in a metal (or foil lined) box. It might help to shield the power-supply cable too.

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino Shields from Adafruit”