Piezo response

Am wondering about mounting piezo sensors on targets to detect when they are hit.
The targets will most likely be 0.1 to 0.15m2, made of 12mm ply, and be mounted as close as 1cm apart.

Is the response of piezos likely to be reliable enough to distinguish when adjacent targets are hit?

If you can stagger the mounting of small piezo discs so that each is fixed to its own target.

If they're all mounted on the same piece of ply and only 1cm apart then they're all going to respond when the target is hit. Theoretically it could be made to work by looking for the largest output assuming that all you piezo devices are mounted precisely the same and all have identical sensitivity. Even so, you'd need to be able to read all the outputs very quickly because it's a impact noise and there will be one very fast peak. It might be slightly easier to do if each target and sensor was acoustically insulated from the main plywood sheet.
The number of targets you have will need to be considered.

Mount each target on some type of isolating medium, such as rubber or plastic foam.

Then only the one hit directly will give significant output.

Just to clarify, this is the intended arangement.
The frame would be made of 20x20x2mm steel angle and there would likely be rubber washers between the boards and the frame.

With the piezos on analog input pins, is it likely that the targets will be discernible?

Piezo placement.jpg

In respect of duration of voltage spike resulting from a hit, would there be an easy way to get a longer signal?

Piezo placement.jpg

If there are only four targets, it should be relatively easy. The transducer will produce a a large spike but it will probably ring for a few milliseconds before decaying down and that should give you ample time to to take four a/d readings to determine which was hit. You may actually need to limit this voltage spike if the target is hit hard otherwise it might damage the a/d inputs.

Regards

Bill

I doubt that analogIn() will ever happen to catch such a spike. If the voltage is high enough you may use PCINT to catch events, else the signals will have to be limited, amplified and stretched. Protection against negative voltages from piezos is mandatory.

The Knock example sketch (see code below) suggests the use of piezo sensors to detect hits should be realy simple.

/*
  Knock Sensor

  This sketch reads a piezo element to detect a knocking sound.
  It reads an analog pin and compares the result to a set threshold.
  If the result is greater than the threshold, it writes "knock" to the serial
  port, and toggles the LED on pin 13.

  The circuit:
	- positive connection of the piezo attached to analog in 0
	- negative connection of the piezo attached to ground
	- 1 megohm resistor attached from analog in 0 to ground

  created 25 Mar 2007
  by David Cuartielles <http://www.0j0.org>
  modified 30 Aug 2011
  by Tom Igoe

  This example code is in the public domain.

  http://www.arduino.cc/en/Tutorial/Knock
*/


// these constants won't change:
const int ledPin = 13;      // LED connected to digital pin 13
const int knockSensor = A0; // the piezo is connected to analog pin 0
const int threshold = 100;  // threshold value to decide when the detected sound is a knock or not


// these variables will change:
int sensorReading = 0;      // variable to store the value read from the sensor pin
int ledState = LOW;         // variable used to store the last LED status, to toggle the light

void setup() {
  pinMode(ledPin, OUTPUT); // declare the ledPin as as OUTPUT
  Serial.begin(9600);       // use the serial port
}

void loop() {
  // read the sensor and store it in the variable sensorReading:
  sensorReading = analogRead(knockSensor);

  // if the sensor reading is greater than the threshold:
  if (sensorReading >= threshold) {
    // toggle the status of the ledPin:
    ledState = !ledState;
    // update the LED pin itself:
    digitalWrite(ledPin, ledState);
    // send the string "Knock!" back to the computer, followed by newline
    Serial.println("Knock!");
  }
  delay(100);  // delay to avoid overloading the serial port buffer
}

To me, some of the above advice suggests the Knock sketch shouldn't really work. It's not using interupts for a start, so I'm a little confused why they would be better than analogRead()

(I have some piezos ordered, so I'll find out soon enough anyway.)

Using interrupts, the code can very simple, but you would need a little hardware to translate the output of each piezo into the correct logic levels for the chip. This method also has the advantage that it can be used in sleep mode to conserve battery life, only waking up the instant an interrupt occurs. If power isn't an issue then scanning four a/d inputs will take about 500 micro seconds and involve a bit more coding but the interface becomes quite simple.

What hit's the target by the way?

Regards,

Bill

You seem to be ignoring the fact that a piezo will generate an AC signal.

Paul

BillGreen:
What hit's the target by the way?

A sword.

Paul_KD7HB:
You seem to be ignoring the fact that a piezo will generate an AC signal.

As long as it's above the threshold for long enough for the Arduino to detect it, does that matter?

"You seem to be ignoring the fact that a piezo will generate an AC signal."

It really doesn't matter especially if using an a/d but for interrupts, the piezos would need to be amplified into a digital square wave and any small low power quad op amp would do the job.