warcher1 wrote:Maybe the piezo circuit really needs that pull-down?
Yes. Here's the circuit I started with today.
(click on to open and enlarge)
What it has is 2 envelope detectors, one 2 channel MUX and the Arduino. The Arduino also has a MUX, but I've modeled that as being "stuck" on just one channel. As it turns out the Arduino model isn't important to the analysis. In between the above items I've placed some resistors to model the wiring and traces connecting the items. Again their exact values turn out to be un-important. What I then did was vary the resistances of the MUX channels to see what happens when one channel is switched on (low resistance, = 70 ohms) and the other is switched off (high resistance, = 1 - 10 Mohms). I fiddled with the magnitude of the piezo output until it was just 5V at the detector output.
What I saw was with the off resistance = 1 Mohm, the detector #1 voltage (when "hit") was showing up at the detector #2 output at just about the same level. This was the case no matter what channel was selected (#1 or #2) to be on (the other channel would then be off). At first this surprised me but looking at the circuit some more, it made sense. A simple DC analysis with the Arduino having a very high input resistance gives me that same result. If you look back from the output of the MUX towards the input connected to the detector, you "see" a very very very high resistance. It's the leakage resistance of your 47 pF cap with a reversed biased diode in parallel. So even a 1 Mohm off MUX resistance is small in comparison and the voltage divider made by this resistance with the resistance of the active, "hit" channel gets you that same "hit" voltage on the inactive, "un-hit" channel. Increasing the MUX off resistance to 10 Mohm reduces the voltage divider but there's still some voltage that shows up on the inactive channel due to the hit.
What's the true off resistance of the MUX ? Hard to say but from the specs I'd say about 5 Mohm (which is why I picked 1 and 10 Mohm as my test cases). So depending on how large the piezo output is, you may be saturating the Arduino ADC when looking at the hit channel and still saturating (or nearly so) when looking at an un-hit channel. Dummy reads and waiting between reads won't help this problem. They only solve another problem, which you may (or may not) still have when this issue gets fixed.
So what's a simple fix ? It's to make the output resistance of the detector "small" compared to the off resistance of the MUX. Adding a resistor in parallel with the 47 pF cap does that. It also makes the voltage bleed off that cap sooner and reduces the sensed voltage at the ADC when the channel is chosen. This last part might be good if the voltage is really too high (>> 5v) at the Arduino. The reduced pulsewidth may, or may not be a problem, depending on the time it takes to poll the input. If your code is repeatedly sampling just that one channel, waiting for a hit, then the polling can be done very quickly (< 200 us btw samples) and so a short PW probably isn't an issue. A larger than 47 pF cap can also be used to "stretch" the pulse (as you've already seen).
Right now I'm playing with the sim to see what kind of resistance and cap values might be good. Something like a 100k resistor might be "small" enough to reduce the crosstalk btw channels and still retain a "long enough" PW so as to be caught by your code loop polling. But in reality a lot depends on the kind of voltage is coming out of the detector when smacked. I know the piezos can output > 100V. I was planning on placing some 5.1V Zeners on the inputs to my PIC (equivalent to your Arduino ADC pins) to make sure the voltage spikes don't smoke the input circuitry. If you're seeing 1023 counts when sampling the hit channel, you might want to think about doing that. Alternately making the resistor in parallel with the 47 pF cap smaller, your 10k or maybe even less, will also reduce the detectors output voltage. Of course this will also make the PW shorter and so you may then need to increase the 47 pF to something larger. This is where an o-scope measurement would come in very handy. Perhaps a series of measurements (using the Arduino) of the hit channel with varying resistances would be just as good as having a o-scope.
You do not have the required permissions to view the files attached to this post.