I am trying to design a little game where you throw a baseball at a 3x3 grid of 24x18" polycarbonate panels (1/4" thick), and the game detects which of 9 panels is struck. I'm aware there are many piezo and impact questions on this site, and I've read just about all of them, but I'm hoping someone can provide some insight into the specific challenges I'm having.
My design: Piezo on every panel, connected to a 5V zener protection diode circuit, then to an envelope detector circuit (Diode-> R & C in parallel), then to an ADC (ADS1015), then back to my Raspberry Pi 4.
In the circuit above, D1 is a 50V Schottky diode and D2 is a 5.1 V Zener, V1 is my piezo. The 1 MOhm resistor at the end was to simulate my scope impedance. R2 doesn't appear in my real circuit, but if I don't include it, the protection circuit doesn't work at all in LTSpice.
This is the output from that circuit. The green trace is something I captured by feeding the piezo directly into a scope, and striking the center of a panel pretty hard. I saved the waveform and feed it into my LTSpice sim. From this simulation, it seems like this circuit should work. As I'll get to shortly, it does not. From my tests, a hit on a panel will produce 30V oscillations that last up to 250s, and neighboring panels will have a small (~1 V), short signal. So the circuit needs to be able to discriminate this. I also could have an impact where it strikes right on the seam of 2 panels, ideally this would take the "stronger" hit and register that impact as the real panel hit. I want to be able to register 2 hits a second, and I want it to register a hit from either an adult or a kid throwing the ball (so a wide range of potential impact strengths). The ADCs are connected to the Pi via I2C, and it takes anywhere from 20 to 50 ms to sample all 9 channels. So using my current method I can only sample once every 50 ms.
- Is there a better circuit to accomplish my goals?
- I might replace the 5V Zener with a bridge rectifier (KBP201G?)? If I did this, do I still need a 1 MOhm resistor in parallel?
- Is there some way to get rid of the ADC completely and use a comparator (MCP6004?) after the envelope detector? Would this be faster? Can I set up the Pi to just "trigger" whenever the output of the comparator goes high? Presumably I could set the threshold level to 4V or something that will not be triggered by hits to neighboring panels, but this might not work well for hits on seams. (My current plan also may not, I haven't tested that yet). This was suggested in another thread here, where someone was doing something similar, but that person was trying to capture frequency, and I'm more interested in peak/duration. I've found many variations of the comparator circuit, and I don't understand which ones might work for my application or how to pick the actual chip to use as the comparator.
- Should I replace the 10 Ohm resistor with a ~100 Ohm resistor to limit current into the ADC?
- Should that resistor be placed after the Schottky diode?
- Is there a reason this circuit would not work when tested on a breadboard with a scope instead of the ADC? I have tested it many times, and it works right up until I put the capacitor in place, then it just never triggers the scope (set for a rising 160 mV trigger). I can use the circuit below (with no cap) and tap the piezo with my finger, and see a 3-5V pulse come out. I've tested the cap and it holds charge. I've also tried using a 100uF cap, and tried a number of values for R1. This seemed to work a few times, and then has never worked again.
- Once I get a functional circuit, I'll need to make 9 of it, one for each channel. Is there a place online that will just fabricate this circuit for me, or is my best best to just get a perf board and solder all the components myself? I've seen JCLPCB.com suggested, but its not clear to me if they actually will make a complete board for a reasonable price, or if they will just make me a circuit board and I'd have to solder a bunch of SMTs.
- Is there somewhere in this circuit where I could insert a potentiometer to adjust the sensitivity of the piezo, in case every hit is producing 5V? I think maybe its R3, but I'm not sure.
Lastly, it seems that the protection circuits I have also shorten the duration of the oscillations from the piezo. The green trace below was captured using pizeo > 5V zener circuit > scope, and was a hard hit to the center of the panel, just like the 250 ms long one in the first image. I'm not sure why this is.