I used to have a paintball hopper that would advance when it "heard" the paintball gun fire. It was pretty good at rejecting other noise and only firing when it heard the sharp, but not all that loud, sound. I want to make a similar thing with arduino to detect a paintball fun firing, but I don't know how to proceed. I can run the microphone output straight through a voltage divider and into an analog pin, or I can use a op-amp differentiator and feed that into an interrupt, or I might need to use high-pass or low-pass filters. Any ideas?
Hi,
I have some ideas, for example you can use a low pass filter made with a opamp so you adjust it to only let it pass the peak sound you said.
Also you might wanna try making a comparator with a opamp so you set a threshold voltage to decide with what intensity you want it to be triggered the thing is that any loud noise will trigger it.
You could make an amplifier with a transistor like a 2222n and design it to respond only to peaks, I don“t know how to explain it. I did that for a clap switched I made.
The last thing I can think of right now is making a "filter" using software, getting with the ADC the response of the microphone and decide whether its time to trigger or not.
I hope this helps.
If you can identify what makes the sound of the paintball gun distinct, then it'll be relatively easy to build some electronics to isolate and identify the sound.
Sadly, the Analogue to Digital converter on the Arduino is set up to be quite slow, so you'd be a bit lucky if you could use the Arduino to do that directly.
Do you have access to electronic test equipment like a storage oscilloscope? You could probably play around and find a solution empirically using that.
May I ask why detecting the paintball gun firing must be done using sound? There are oodles of other sensor approaches that could be used.
For example:
- optical detector to detect movement of part of the gun or paintball out of the barrel
- accelerometer detecting gun recoil,
- the signal from a microphone attached directly to the paintball gun would need less processing,
- etc.
If you do need to use sound, you probably will need a bandpas filter, which will remove all but a narrow band of frequencies. It may be you need a couple of bandpass filters to get an accurate characterisation, but probably not.
To understand how to build these, get hold of a copy of "The Art of Electronics, 2nd Edition" by Paul Horowitz and Winfield Hill. It is better than brilliant. I learned more about electronics over a weekend reading it, than I did in a year of undergraduate electronics at university.
The likely approach, if you resort to sound, will be to make a narrow bandpass filter using some operational amplifiers, resistors and capacitors. The part cost will likely be under $3 (2 GBP, 2.50 Euro). If you're lucky, you won't need to measure the value, just put it into a digital pin, and maybe measure its duration, to eliminate spurious sounds.
HTH
GB-)
Check out this thread: it has links to an earlier thread about detecting handclaps, and to a circuit I used for detecting the firing of blanks.
I wound up tweaking the envelope detector a little while it was on the breadboard, because I didn't like the gain and response for my purposes. It works fairly well for detecting the sharp report of a gunshot, while sacrificing some fidelity in the voice/music envelope detection the original circuit was designed for. So it might help with detecting paintball shots, too. If you want a copy of the revised schematic, email me: I don't have a good long-term home for hosting files, and I don't want to create any more links likely to break in the long term than the few I already have.
Ran Talbot, could you fill this in:
Check out this thread
TIA
GB