Hi,
I want to make a solution that uses Piezoelectric sensors. I have played with the basic disk type you can get cheaply and they are more than sensitive for what i need
In fact what i want it to be build an electronic scouring system for archery.
So quite straight forward, position 3 (could do it with 2 I know if for example i place them below the target and assume all hits are above)
So my current way to to do this is to keep running a loop checking each sensor for a change above a threshold and one it sees one, log the time stamp and then keep checking for a signal from the other 2. once it has this its a simple task to work out the location after calibration.
So this works fine but it means there is a loop running and if I am doing any thing else, such as updating a display there is a risk that i will miss the start of the signal and introduce some inaccuracy / Inconsistence.
So i was wondering is there a way to use an interrupt on the analogue pin. Because of course on an analogue pin is always going to have noise i don't want to have a full interrupt for all the back ground noise so I want to be able to say some thing like
If the change in signal is > 10 then interrupt.
I was thinking i could have it keep interrupting even with false positives and simply writing the value and time then returning and doing the checks once each loop, but if the intetupte get to frequent I could end up missing the real one due to a false one.
Any thoughts on a better way to do this than i am thinking of.
I suppose the other way would be to create a timed interrupt every few mills and using it to read the pin values before retuning so I can be sure other process don't make me miss them. and as soon as I record a signal, then lock in to reading the others until either
- I have recorded a peak from all three
- a set time has passed and reset so I don't get locked up due to miss read.
Really just looking for ways to improve my code, if any one can suggest some ideas.
Cheers