Arduino Forum

Using Arduino => General Electronics => Topic started by: mahela007 on Dec 30, 2011, 04:12 pm

Title: What does the 1M resistor do in this circuit? (knock sensor)
Post by: mahela007 on Dec 30, 2011, 04:12 pm
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?
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: CrossRoads on Dec 30, 2011, 05:13 pm
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.
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: Grumpy_Mike on Dec 30, 2011, 05:37 pm
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).
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: MarkT on Dec 30, 2011, 06:21 pm
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!
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: mahela007 on Dec 30, 2011, 07:03 pm

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?)
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: MarkT on Dec 30, 2011, 07:15 pm
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).
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: mahela007 on Dec 30, 2011, 07:25 pm
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..)
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: MarkT on Jan 03, 2012, 12:18 am
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.
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: mahela007 on Jan 03, 2012, 09:04 am

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?
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: Grumpy_Mike on Jan 03, 2012, 10:09 pm
For schematic see:-
http://www.thebox.myzen.co.uk/Tutorial/Protection.html (http://www.thebox.myzen.co.uk/Tutorial/Protection.html)
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: SeriouslySerious on Jun 16, 2013, 03:07 pm

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)?
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: MarkT on Jun 16, 2013, 03:31 pm
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 ]
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: sonnyyu on Jun 17, 2013, 05:15 am

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.
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: jptacek on Jul 05, 2013, 10:22 pm
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 (http://forum.arduino.cc/index.php/topic,144736.0.html)
Title: Re: What does the 1M resistor do in this circuit? (knock sensor)
Post by: oric_dan on Jul 07, 2013, 06:53 am
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.