Go Down

Topic: What does the 1M resistor do in this circuit? (knock sensor) (Read 9078 times) previous topic - next topic

mahela007

Hi..
what does the 1M resistor do here? http://www.arduino.cc/en/Tutorial/KnockSensor

I don't have any 1M resistors at the moment.. would using a 10k resistor damage the arduino?

CrossRoads

Would not damage the arduino, but might load down the piezo too much and thus you would not see a measurable voltage.

The piezo puts out some current - that current needs to go somewhere. The 1M gives it a place to go besides into the arduino.
You still need some to go into the arduino for the ADC's sample & hold to charge up - 10K might drain too much away and not leave enough to allow the sample & hold to charge up.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.

Grumpy_Mike

If you have any diodes then put the 10K in series with the piezo, then to the arduino input. Then put a diode from input (cathode) to 5V (anode) and another from the input (anode) to ground (cathode).

MarkT

A series resistor might not add much protection, a piezo element is a close to ideal current/charge source in parallel with a capacitor. 

To get a signal that is well defined that parallel resistor is required, otherwise the piezo output will just float (everything is very high impedance).  Also its output voltage depends sensitively on temperature due to differential expansion, so without a load resistor you have a crude thermometer thrown in!
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

mahela007


If you have any diodes then put the 10K in series with the piezo, then to the arduino input. Then put a diode from input (cathode) to 5V (anode) and another from the input (anode) to ground (cathode).

How does that work?

A series resistor might not add much protection, a piezo element is a close to ideal current/charge source in parallel with a capacitor. 

There aren't any caps in the circuit.. (do you mean parallel in the electrical sense?)

MarkT

A piezo element is a capacitor...  The best piezo-electric materials have high dielectric constant, such as PZT (used for ultrasound transducers and high-value ceramic capacitors).  You can think of a piezo-electric material as linking mechanical stress to electric field.

The diodes are to beef up the on-chip protection diodes, preventing the gate voltages from going too high or too low (both will fry CMOS transistors).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

mahela007

Thanks for the quick reply...
but I still can't understand why a resistor has to be put in.. wouldn't that mean that the 'capacitor' would discharge? It seems that it would be desirable for all the charge to be sent in to the arduino (instead of passing to the other side of the "capacitor" through the resistor..)

MarkT

Yes, its exactly so the charge discharges - otherwise you'll just see a large DC(*) component that depends on history, temperature, and totally swamps the input signal from the knocks.

(*) Strictly speaking not DC, just very low frequencies on scale of seconds and minutes.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

mahela007


If you have any diodes then put the 10K in series with the piezo, then to the arduino input. Then put a diode from input (cathode) to 5V (anode) and another from the input (anode) to ground (cathode).


GrumpyMike.. could you please post a schematic of that?


SeriouslySerious


Would not damage the arduino, but might load down the piezo too much and thus you would not see a measurable voltage.

The piezo puts out some current - that current needs to go somewhere. The 1M gives it a place to go besides into the arduino.
You still need some to go into the arduino for the ADC's sample & hold to charge up - 10K might drain too much away and not leave enough to allow the sample & hold to charge up.


Why is it, that the peizo loads too much dowm with a lower/weaker resistance (and not opposite, since there should be a higher voltage drop)? And how is it, that this affects the sensitivty of the peizo, so a high resistance makes it more sensitive (and not less)?

MarkT

voltage = resistance x current.

The piezo outputs current (at almost any voltage - it doesn't care).  The resistor fixes the voltage to be a
function of the current.

Put another way the piezo pushes out electrons as hard as it needs to to get them out (they are almost literally
squeezed mechanically out of the crystal).  With no resistance load the voltage will go up to 1000's of volts (or
with the arduino simply conduct away through the protection diodes).  So you would see a nearly square wave
and lose all the analog detail.

[ actually to be a bit more accurate the piezo outputs charge proportional to physical distortion, but otherwise acts
like an insulator (with some capacitance) - this is how ferroelectric materials behave, mechanical strain coupled to charge
displacement ]
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

sonnyyu


voltage = resistance x current.

The piezo outputs current (at almost any voltage - it doesn't care).  The resistor fixes the voltage to be a
function of the current.

Put another way the piezo pushes out electrons as hard as it needs to to get them out (they are almost literally
squeezed mechanically out of the crystal).  With no resistance load the voltage will go up to 1000's of volts (or
with the arduino simply conduct away through the protection diodes).  So you would see a nearly square wave
and lose all the analog detail.

[ actually to be a bit more accurate the piezo outputs charge proportional to physical distortion, but otherwise acts
like an insulator (with some capacitance) - this is how ferroelectric materials behave, mechanical strain coupled to charge
displacement ]


bookmarked, learn something everyday.

jptacek

Hearty thanks to everybody contributing to this discussion.  For anybody still confused by the role of the parallel resistor in this circuit, I also found the following post very enlightening:

http://forum.arduino.cc/index.php/topic,144736.0.html

oric_dan

One day, I'll investigate this. I suspect the 1M value was found "empirically",
namely what worked to produce a readable voltage between 0 & 5v for a
common piezo and nominal knocks - eg, somewhat less than a hammer
blow. If the R is too small, it'll load down the piezo, and lessen the max
voltage, and the voltage will also decay away rather quickly. If you don't
have 1M, how about 100K.

Go Up