Before I get to the mechanically very advanced bead sorting robot, I thought of creating a ball wall target board. A 1 m in diameter disc for throwing balls at. Or kicking footballs at (no, not handeggs). The board would have three embedded piezo sensors that measure the hit. A display, maybe the user's phone via bluetooth, would display the hit, how far from the bull's eye and the force of the hit.
I'm a complete novice in electronics, but I thought of this kind of wiring. The image shows one sensor and one port on the Microbit board. My target board would use three similar ports of Microbit.
Microbit runs on 3 V. P0 is a port that can output both digital and analog signals, meaning 3 V pulses of given length or any of 1024 values from 0 V to 3 V. And it can read digital and analog values as well. I decided on doing digital. What happens here is that the piezo produces a voltage spike due to a ball hitting it (or a piece of plywood, which distributes the pressure to the three piezos). The piezo charges the capacitor C1, which starts to discharge through the resistor R1. The charge keeps the transistor open for a while. When the transistor is open, P0 holds zero volt. When it's closed, P0 is 3 V.
The bigger impact on the piezo, the bigger charge and the longer P0 is zero. I have no clue at all what values all the components should have. Some of them I can test. And I need a simple loop in the program that counts how long P0 is zero. If I get reliable measurements from all three piezos, I can calculate and interpolate to find out both the coordinates of the ball impact on the plate and the force of the ball.
I put R2 there just because I thought there should be something at that spot to prevent too high voltage spikes from going through. But maybe an inductor is what that spot needs.
The running time of Microbit can be read in milliseconds. So to get accurate values of where the ball hit and with which force, I need the pulse length to be maybe 1000 ms as maximum. Say P0 gives 500 ms, P1 gives 300 ms and P2 gives 500 ms, the hit is on a line that goes through P1 and the middle point of P0 and P2, but nearer that middle point than P1. The system would need calibrating as well as mathematics. I have no idea if my logics are correct. And I have no idea if that circuit works and what the values of the components should be.
Haha! I just crashed two old wire telephones and picked out the mics and the speakers from them. It appears phones used to have more or less identical piezo elements both as speakers and as mics. A simple digital electrometer showed some 100 mV when I just held the elements in my hand. Knocking on them raised the voltage a bit. I have three almost identical elements. I'd need to view the signal in an oscilloscope to see if they really are identical. Or then I just use them as they are and calibrate everything to meet their differencies. But they are mics and speakers, not just piezo press or shock sensors. They have this convex plate with a small hole in the middle. I guess if I could detach the concave plate, I'd have just a flat plate, the essential piezo element that I need. A plate not receiving sound waves, but actual pressure shocks through the foamy plastic layer between the piezo element and the plywood.