What sensor to use for paintball targets?

I'm trying to figure out what sensor to use for developing a paintball target. The paintball would shoot the target and then a large LCD readout would display how many times the target has been shot. There will be two targets, each one accruing a number. At the end of 30 seconds or 1 minute, whoever has hit the target the most times will win and a light audible sound will trigger above the perspective counter.

Ideas for best hardware?

I'd suggest maybe an accelerometer might be the best option. but i'm not sure how reliable it would be in telling the difference between the forced vibration by lots of paintballs hitting simultaneously and its own resonant response to a single paintball hitting and the target structure responding...

Other methods might be possible (i'm thinking pressure sensor behind a target plate on a spring which moves causing the variation in pressure in the chamber behind it) but we would have to know allot more about how you plan on building the target.

Yeah, I was looking at some pressure plates that others have developed and I just worry about the constant barrage of paintballs breaking the unit honestly. Paintballs travel at around 280 feet per second and will be shooting targets roughly 150 ft away, so the target will need to be designed to be rigid to stand up to the abuse.

If I where to have two pressure plates (say two pieces of thin aluminum) and if the force of the paintball where enough to cause these two pieces two touch therefore creating the circuit and increasing the count by 1, that would work. I'm just wondering the best approach.

How large of target do you envision? Will the paintball be going 280fps at the target, or is that the velocity at the gun?

Paul

I envision a 12 inch circular target. Yup, the paintball will be going 280 fps at the target

2 metal plates that contact upon the impact of a paintball is a great idea. The circuit and software for counting the number that hit would be the same as counting button pushes.

Connect one plate to ground and the other to a digital I/O pin that has it's internal resistor pulled high. When the two plates touch the state of the I/O pin will turn to LOW and you know something has hit it. All you need to do then is make sure your code doesn't count another hit until the pin has gone back to high (when plates stop touching).

look at the doubounce and button count example codes that come with the IDE.

Maybe a piezo or even conventional speaker. Voltage applied to the speaker results in displacement. The physics are reversible and displacement to the speaker results in voltage, so much so that when using a piezo speaker it may be necessary to protect processor outputs from the voltage spikes that can be produced.

A piezo speaker would probably be simpler to implement if the signal is suitable for sampling.

slzer:
2 metal plates that contact upon the impact of a paintball is a great idea. The circuit and software for counting the number that hit would be the same as counting button pushes.

Connect one plate to ground and the other to a digital I/O pin that has it's internal resistor pulled high. When the two plates touch the state of the I/O pin will turn to LOW and you know something has hit it. All you need to do then is make sure your code doesn't count another hit until the pin has gone back to high (when plates stop touching).

look at the doubounce and button count example codes that come with the IDE.

Yeah, my only fear is when shooting 12.5 balls per second that the time required for the button to depress and pop back up will be too long and not count all of the shots. I guess if the clearance between the two plates is 2 mil or the distance is as short as possible, it would lesson the problem, but I'll have to play with it and see!

HankB:
Maybe a piezo or even conventional speaker. Voltage applied to the speaker results in displacement. The physics are reversible and displacement to the speaker results in voltage, so much so that when using a piezo speaker it may be necessary to protect processor outputs from the voltage spikes that can be produced.

A piezo speaker would probably be simpler to implement if the signal is suitable for sampling.

That was my thought. I see lots of cheap speakers on Craig's List. Find one big enough to mount the metal target right to the front of the speaker. Should get a nice pulse from the speaker windings on each hit!

Paul

Paul_KD7HB:
That was my thought. I see lots of cheap speakers on Craig's List. Find one big enough to mount the metal target right to the front of the speaker. Should get a nice pulse from the speaker windings on each hit!

Paul

Great idea! So I would attach the piece of metal to the front of the speaker but how would I go about detecting the displacement to the speaker voltage? Any specific shield that you would recommend? I'm a arduino newbie for the most part...thanks.

vrockrick1:
Great idea! So I would attach the piece of metal to the front of the speaker but how would I go about detecting the displacement to the speaker voltage? Any specific shield that you would recommend? I'm a arduino newbie for the most part...thanks.

The context in which I heard about speakers generating voltage due to displacement was protecting the output from spikes when driving a piezo speaker. Caution seems to be the watchword for this endeavor.

I don't know that you need a shield for this, just a circuit to connect the speaker to the Arduino. I would suggest using a voltage divider to reduce the output of the speaker until you know what kind of voltages are going to be generated. Here's a thread that should give you some ideas: Overvoltage protection on analog input - Frequently-Asked Questions - Arduino Forum You can find more.

The next decision is to decide if you are going to use an analog input or digital input. I would probably start with analog sampling to get some idea of what the signal is going to look like. I would probably write code that samples an input at a relatively high rate and writes to a circular buffer. (In other words, once the end of the buffer is reached, start again at the beginning.) Then just let it free run and when it detects something, run a little longer and stop so the results can be written to a serial port.

Napkin style calculation... A quarter second of samples should capture the complete event. Sampling at 1000 Hz (IOW read ADC, delay(1)). Set up a buffer for 250 smpoles. When "something interesting" happens, record 200 more samples and write to a serial port.

Make sense?

The Knock tutorial explains everything you need. I'm sure there's a few thousand additional tutorials if you just do a little searching.

The pins on AVR chips contain high voltage protection, up to 1ma current, and that's a current limit well above what you can generate with a piezo. I don't see a need for anything additional.

HankB:
The context in which I heard about speakers generating voltage due to displacement was protecting the output from spikes when driving a piezo speaker. Caution seems to be the watchword for this endeavor.

I don't know that you need a shield for this, just a circuit to connect the speaker to the Arduino. I would suggest using a voltage divider to reduce the output of the speaker until you know what kind of voltages are going to be generated. Here's a thread that should give you some ideas: Overvoltage protection on analog input - Frequently-Asked Questions - Arduino Forum You can find more.

The next decision is to decide if you are going to use an analog input or digital input. I would probably start with analog sampling to get some idea of what the signal is going to look like. I would probably write code that samples an input at a relatively high rate and writes to a circular buffer. (In other words, once the end of the buffer is reached, start again at the beginning.) Then just let it free run and when it detects something, run a little longer and stop so the results can be written to a serial port.

Napkin style calculation... A quarter second of samples should capture the complete event. Sampling at 1000 Hz (IOW read ADC, delay(1)). Set up a buffer for 250 smpoles. When "something interesting" happens, record 200 more samples and write to a serial port.

Make sense?

Yup, makes sense. Thanks!

Chagrin:
The Knock tutorial explains everything you need. I'm sure there's a few thousand additional tutorials if you just do a little searching.

The pins on AVR chips contain high voltage protection, up to 1ma current, and that's a current limit well above what you can generate with a piezo. I don't see a need for anything additional.

The knock tutorial sounds like it will work as well. My only fear is the frequency of the pieces of metal registering fast enough for the 12.5 balls per second.

vrockrick1:
The knock tutorial sounds like it will work as well. My only fear is the frequency of the pieces of metal registering fast enough for the 12.5 balls per second.

12.5/second is not a problem for an AVR and the piezos are able to detect a hit within a few milliseconds as well. The problem you'll see is that the piezos might require some filtering to get them to stop ringing and if your target vibrates after a hit that will cause problems as well.

Google "piezo filtering" if you want to learn more about the problem, but suffice to say that piezos definitely are the proper sensor to use.

This interested me enough to have a go with it. I happen to have some small speakers for another project (about 1 3/8" - 3.5 cm diameter) so I hooked one up to an analog output and wrote the following sketch:

void setup() {
  Serial.begin(115200);
}
static const int buffSize = 256;
static const int readPin = A1;              // analog read
static unsigned int buffer[256];
static unsigned int  readIdx;
static const unsigned int  threshold = 5;  // ADC must read 10 counts to trigger capture
static int  triggerIdx = -1;

// one sample each loop
void loop() {

  delay(1);
  buffer[readIdx] = analogRead(readPin);
  if( triggerIdx == -1 ) {  // check for capture trigger?
    if(buffer[readIdx] > threshold ) {
      triggerIdx = (readIdx+buffSize) % buffSize;
      Serial.println("cap");
    }
  }
  else if(triggerIdx == readIdx ) { // have we looped since we triggered capture?
      Serial.println("fin");
    int printIdx = (triggerIdx+1) % buffSize;// First value to dump
    do {
    Serial.println(buffer[printIdx]);
    printIdx = (printIdx+1) % buffSize;
    } while( printIdx != triggerIdx );
    while(1) // infinite loop when we're done. reset to capture again
      ;
  }  
  readIdx = (readIdx+1) % buffSize;
  return;
}

Dropping the speaker from a couple inches to a wood table top gets the following results:

15
4
0
9
0
6
1
0
6
0
0
3
0
0
0

A 5" drop gets:

0
207
0
0
108
0
0
54
0
4
23
0
11
5
0
10
0
0
6
0
0
1
0
0
0
0
0

Project update: I ordered up a few piezos to play around with. They so far have worked great! Adjusting the sensitivity has been a bit of a process, but the project is coming together.

My next problem I need to find a solution for is a large LCD. I want to display the results of the total count of the piezo registering on an LCD at least 12in tall. Finding an LCD this large has been difficult.

Any recommendations? thanks

In most cases a large LED display will be a DIY kind of thing, stringing up discrete LEDs or LED strips yourself and wiring up shift registers to control them. I dunno if I've ever seen a 12" or other large, fully complete display. Here's a good headstart on building the numbers though:
http://www.seeedstudio.com/depot/7-Segment-Display-8-Inches-Red-p-1194.html

Chagrin:
In most cases a large LED display will be a DIY kind of thing, stringing up discrete LEDs or LED strips yourself and wiring up shift registers to control them. I dunno if I've ever seen a 12" or other large, fully complete display. Here's a good headstart on building the numbers though:
http://www.seeedstudio.com/depot/7-Segment-Display-8-Inches-Red-p-1194.html

Thanks for the seedstudio url. I ended up purchasing some of those units to see how they'll work out. I'm optimistic I'll be able to get it working...we'll see!

As far as programming the shift registry, have you come across any sample code for doing something like this? Would like to re-use code if possible.