Main Site Documentation

InterruptPort sensetivity?


Hello everyone.
I’m trying to build a knock sensor using a Peizo element.
I want to avoid read the pin in a tight loop so I’m trying to use the InterruptPort.
But it’s not sensitive enough, is there a way to set the threshhold on which it fires ?



Micro pins have a definitive high and low trigger voltage (it will be in the data sheet) the only way to set a sensitivity is to incorporate a pre-amp " Schmitt trigger type " and allow yourself level adjustment.

Cheers Ian


How about just adding a transistor or an op amp to the Piezo output?


Could you give me a rough schematics of how that would come togeter ?
I have very little experience with electronics.

Thanks !


Sure, first thing you need to do is work out whats a “high” signal on your piezo sounder. Use a voltmeter or oscilloscope to find out what kind of voltage you want to perceive as high.

Let say you find out that the voltage your piezo outputs as “high” is 0.5V,

You now need to get yourself an op-amp (I would suggest LM193 as a decent allrounder), connect the output of your piezo to its noninverting input (symbol +) via a 10k resistor , and supply the inverted input (symbol -) with 0.5V.

Supply the LM293 with VCC = 5V, and have a potential divider of 9K/1K (or any values to that effect) producing the 0.5V you need. Pull the output up to 5V by a 3k resistor, and connect the output to the noninverting input via a 10meg resistor.

What the op amp will do is take the difference between inverting and noninverting input and amplyfies it. If noninverting is greater than inverting, it will just output positive, giving us no change, if it inverting is greater than noninverting, it will output 0V, giving us a low signal.

Op amps are great little devices :).


Look on wikipedia under schmitt trigger

PS: You could also connect the piezo to an ADC input, and monitor the voltage levels that way.


I wonder if you could do all that with just a simple resistor? Select one high enouph may not allow any current to be seen below a certain level? Not sure.


Yeah that’d be a pretty simple solution if you can get it working. Definitely much less work, does feel a bit hacky though :slight_smile:

William, have you ever done that successfully with a USBizi/Arm7 chip? I’ve never tried it before - I’ve got a whole box of omp amps laying about and I love them dearly :slight_smile: