High resolution trigging Ardunio via Piezoelectric sensor

Hi I was hoping for some sugestions on part of a project.

I am hoping to make digitial target by detecting sound propergation using pizeo Transducers.

So the idea is that for archery the target is 120cm X 120cm and i am not looking for mm accuracy, the gold is 12cm across, so as long as it with in 1-2cm the main aim is to provide a idea of where on the target is hit and the order of the arrows, so after an end of arrows you can review, and when shooting at 70m you can get an idea of where your arrows are going with out getting out the scope.

But mostly this is just an intresting project to see what kind of accuracy is possible.

becasue each target will be silghtly different and can be made of different materials I want to make it so its plug and play, where you set up 3 or 4 sensors in each corner of the target, then shoot 5 -10 calibration arrows (randomly over the target face) input where each arrow lands on the target and then using this data caculate the characteristics of the target so future shoots can be caculated.

However I was looking to do this using Analog reads and setting a thresh hold, where a timer starts after the first sensor (which ever happends to be closest to the impact) goes over a set thresh hold, and as the sound wave hit the other sensors the time diffence it saves and once all have been triggered the point of impact can be caculated.

However my issues I see is that analog reads on the ardunio take about 100 microseconds, which makes it far to slow a read speed when needed to poll 3 - 4 sensors. Sound can travel 3.5cm. And i need to have 3 or 4 clear reads + any over head.

What i can see is I need to be able to monitor, react to the first sensor getting triggered and then read all other sensors with in around 2milliseconds. and need to be able to ensure i trigger on the same point in the wave as its not a clean signal

So does any one have any thoughts how to achive this, I am looking to do this a cost friendly as possible and as simply as possible, Is there a circuit I can use to amplify the signal from Pizeo to make it reliably trigger the ardunio, and can i use intrupts or something to reduce the responce / read times? I was also thinking if an arrow hits directly between two sensors they will recive the signal at the same time. So my other thought was to have 3 ardunios syncing there clocks, and each monitoing a seperate sensor, when each is triggers sending the time code to a central ardunio to compare, but i feel there must be a way to do this with a single Ardunio.

I hope that kind of makes sense and would love to hear some ideas.

Thank you

Aaron

This is the same problem of trying to use three Arduinos sending to a central computer to determine the winner of a foot race. Not done, so far because all data is processed sequentially at some place in the design.

I am not sure what you mean,

If you take 4 Arduino's and have unit one send a update to each slave in turn, recorded the time stamp it sends it and have the slave starts as timer.

Then each of the slave Arduino watches one of the people in the foot race and records the moment there "person" crosses the finish line. And then sends a report of its timer value at that moment.

The it's a simple process for the main unit to take each packet in turn, add the time received to the time stamp it sent the sync message for each slave and it will have the order that the people crossed the line.

If it sends a start code to unit 1 at 10 seconds
To unit 2 at 20 and unit 3 at 30. Then the responce from unit 1 is 50, unit 2 is 55 and unit 3 is 40 when there person crossed the line based on there timer.

You can work out the absolute times the crossed the finish line relative to unit one by.

Unit 1 is 10 + 50 = 60
Unit 2 is 20 + 55 = 75
Unit 3 is 30 + 40 = 70

So person 1 was first, 3 second and 3 was third.

Each Arduino sending the packet back to the central unit is not time sensitive, and they don't all need to be synced together. Only the central needs to know it's off set to the others.

You are funny! How will you ever keep a time stamp synchronized in 4 separate slaves? We are dealing in 1/1000 second in foot races. In your project, you are dealing with 1/100,000 seconds.

detecting sound propergation using pizeo Transducers.

Propagation in which medium, air or the target material? The speed of sound is much higher in solids than air.

The project is doable but you will need an Arduino (or compatible) with a fast ADC. The Teensy 4.x modules have ADCs that are a couple orders of magnitude faster than the one in the Uno R3.

Look up "trilateration". Accurately localizing a hit requires accurate knowledge of the speed of sound in the target material, and monitoring several transducers simultaneously.

Same way you keep time stamps synced in NTP, there are well known algrothems to caculate the inherrent delays in a system.

So before any more "ha ha your funny" such a grown up comments....

Just becasue you dont know how to sync sytems to sub millisecond dosen't mean it cant be done. GPS satellites sync there clocks to +/- 30 nano seconds from ground based atomic masters, and on the network we often sync platfrom down to single digit micro seconds in low latency networking. It just uses converging error correction by bouncing time stamps, the accuracy is limited on there being a consistant time to read and send time stamps and the accuracy of the onboard clock which in the case of an ardunio is a 8 or 16Mhz or a 65ns period. Drift is genealy in the order of 1ppm.

The accuracy of the sync is dependent on the consitancy of the time taken between an update ariving to starting the timer, reading the timer and sending a update. And the accuracy of each internal clock.

If the time taken from when a pin is triggered to starting the timer to starting the timer is 10 seconds, but is always exactly 10 seconds to the ns, and your internal clock resolution is a stable 1ns, then you can sync two systems to a few 1ns even if they are 100miles.

The entire world works on billions of clock being synced to with in 1millsecond, (your foot race limit) every single device connected to the internet. I mean your phone and your computer are at this moment synced to with in a few millseconds of UTC using NTP. And thats over a noise internet and a hierarchy of peers. My phone and your computer are going to be sitting at stratum 3 or 4 at least, that means between us the origianl time signal has passed though 8 or so seperate platfrom each syncing with the one above before passing on its time to the one below. And how would i know this? Becasue I manage 10,000+ network devices acorss the globe and one thing we do is ensure that there times are all synced to within 1 millsecond so they can accuratly time stamp their logs before sending them to a central logging system.

Speed of sound is about 350 m/s at sea level, which means about 1 meter every 3 ms. To get 1cm accuracy then you'd need to process the interrupts within about 30 usec of when they trigger.

Fortunately, that is well within the capabilities of many microcontrollers. I don't know which microcontroller you are using, but, for example, there are various methods of detecting GPIO edges on the RP2040 that take less than 500ns from GPIO edge to interrupt handler entry. If you assume handling the interrupt takes another 500ns (1 us processing time in total), then you could theoretically get accuracy down to 1/3 of a millimeter using an RP2040-based board.

Personally I wouldn't want to use an ADC for this since they are often slow, especially the MCU-based ones. I'd want to cause a digital edge and use fast analog components to generate that edge at the sensor. Maybe there would be some way to use a comparator to send an edge when a loud enough sound is detected?

There's a further breakdown of this here: Trigger at the peak of a pulse - Page 1

Thats why i was going to make it calibrate on start up, as we use foam / straw targets and they have different densities. Indeed it might not be consistent across a target face, So I depending how inconsitent it is, either based on the inital calibration shots build a basic model of the target face on the ardunio, or send the timings back to a raspberry pi and build a more accurate model.

So yes basicly rather than knowing the speed of sound upfrount, by knowing the location of the transducers, and the calabration hits, its easy to caculate the actual speed of sound for each target. Also as the idea is the tranducers would be attached to the back of the target that also need to be taken in to account depending where on the target an arrow hits. So its will be simpler to model this based on actualy data rather than worry about actuly figures.

But you are right it will be faster, at the moment i have in my box a few Nano every so i will look in to how fast they can read, I was also wondering if there is a way to turn the Pizeo output in to a digital signel to make it easier to use intrupts that i belive could incress sampling speed. again introducing delays is not a problem as longs as it is the same fpr each tranducer. Becasue all i am intrested in the delay between the signal hitting the first tranducer and then the others. If an amplifer circuit introduces 200ms per transducer it doesn't matter. its the diffence between A and B so once subtracted to get the time diffence the delay gets cancelled out.

Hi, this is what i was thinking, I think i worked out that for a target it was about 178usec for 15cm. Which works out at 11us per cm (sound in solid vs air) however as you point out that is still well with in the capabilities of a microcontroler.

So i think i need to gfigure out the comparator (didnt know the name for that one thank you :slight_smile: )

So i think this is now my goal, to reserch a method to turn the messy Analog signal of the Pize in to a clean crisp and reliable digital edge.

Thank you

When it comes time to build the circuit: smd components are really really cheap, and you can solder them onto perfboard. As long as you're not trying to make a lot of these things it is my recommended way of trying things out. You might also consider simulating your design in LTSpice to see if it works. :slight_smile:

Actually your computer is ONLY synced if you have a program that does that and then it only done once until you re-execute the program.

This seems like a bit of a technicality to me. Very nearly all modern computers do in fact sync to NTP or other time servers on a regular basis. I'm not sure it's correct to say that they achieve millisecond synchronization -- maybe they do, maybe they don't, I've never read a test of it -- but your comment suggests incorrectly that you have to manually run some program to sync your computer's RTC.

Actually I do have a program that does that at startup. The use of the FT8 digital communication protocol in amateur radio requires that of each station anywhere in the world. Many countries and amateurs do not or cannot do the time sync. Their communications show a time difference of up to 2 seconds, making communications impossible.

This did not address my point that you're bringing up a technicality that is overwhelmingly unlikely to apply to OP's computer and situation.

That being said, @DevilWAH, if I go to currentmillis.com or what have you, my phone and my desktop are separated by more than 1s. They are definitely not displaying as if they are synced at sub-second precision. Not sure if that's a display artifact or real, but I guess you should validate your assumptions about how well you can sync N arduinos if you want to go that route. (Idea: write a test program that pulses every 10s on the zero and have a fourth device measure the deviation of the pulses.)

All windows and most Linux distribution run NTP or domin time sync by default if they did not HTTPS would not work. Most encryption has a time out to protect agisnt replays, so computers have to be reasonable in time to UTC.

On windows is a simple process to go in to the registry to set this.

In terms of the accuracy of the sync this is down to how much drift you wish to allow. I believe on a windows domain it is allows to drift several seconds before it will converge in end devices. You can set it much lower, doing so increased the frequency of updates and time to converge.

Honestly I have been building and networks for 30 years and have some idea about it. I suggest you look up win32time service. It runs constantly as a service on all windows machines (unless disabled) and keeps them in sync.

But as I said I don't think that is the route to go with Arduinos, just the methods to sync clocks is well established critical on GPS and used all over the place partially the public standard of NTP.

And based in the Arduino specs sub millisecond is achievable.

I must look up LTspice I have always been looking for a decent test / emulator.

Precious project j played with tinker and but it is very limited.

Do you have any draft to show? The target and where you'd like to place sensors etc

after looking and learning My paln is to use something like a LM389 Comparator, I think i can drive it directly with a Pizo as the voltage spike is a couple of volts, though i was also considering using a 741 op amp to bost the signal from the data sheets responce times should be fine. Delays are ok as long as they are consistant as i only need the first spike from each tranducer. and then i was considering creating a latch so when each tranducer triggers the pin stays high for a moment after the intrupt to filter out any follow up signals.

So the sequence is

  1. arrow hits target

  2. shock/sound hits nearest tranducer

  3. anlog single hits comparator 1 and once breaks thrshold signle on out put goes from 0 to
    1 intrupting ardunio,

  4. Ardunio recourded time stamp and tranducer ID

  5. output from comparator feeds back and latches it high to stop any further intrupts on same pin while tranducers 2,3 and possible 4 trigger

  6. latch time out expire and reset for next shot

  7. i now should have 4 time stamps + order of tranducers recived from

  8. to calabrate i can tell the program where on the target (x,y) the arrows landed and have it reverse engineer the maths to determin the speed of signal propegration, I jsut have to tell it an Arbitrary size for the target to base the caculations on.

  9. then for the next shots using a new set ot time stamps and ID + the signal speeds caculatd in the calibration step should be able to determin the location of the arrows in the target.

Next step is once parts arive to build it for real and not simulation. assuming that works using oscilloscope to capture the time stamps see if in RL it is any where near close to accurate enough readings. I also need to use a signal generate from the oscilloscope to see what the shortest time interval i can recoured on the ardunio. I would like to be <10mico seconds to know that is not the limiting factor

After that and assuming that works out will be to derterming if all the maths and caculations can be done on the ardunio, or if a Pi would be better, i woudl like to have a interface and screen so it might be simpler to pass the time stamps and ID's to a Pi and let it do the heavy lifting.

I am sure there is a lot of stuff still to learn and mestakes to be made, but I think i actuly have a plan based on something that might possible work. some of the indivual bits that your sugestions have lead me to are actuly working in simulation and in practice :slight_smile: I have hope,

The purpose of this is that is should be self calibrating and work regardless of target face or type. Archery targets come in various materials and sizes.

Mathmaticaly if you think of the target like a dart board and place the sensors randomly over it, and tell a program

  1. the dart board is 1meter across
  2. dart one hit tripple 12 and the signal from that hit sensor one first, then X ms after that y and then Z
  3. dart two hit tripple 13, and the signel hit y then X then Z
  4. dart 3 hits tripple 7 and signel hits Z, then X then Y.

First you can easly using the cordinates of where the arrow land define a triangle between them we defined lenths. and using the order and time stamps of the signels you can caculate the positions of the sensros in realation ot the arrows and the speed the shock wave is propegating.

based on a straw target (and my limited accuracy when shooting) propergation does seem to be consistant across target face, its not going to be mm accurate but well with in a few cm's which for practice is plenty to tell you if you are pulling shots or how your groups are looking.

I am not looking for precision to score on matches. just when shooting when practicng where its hard to see shorts land to get a idea where on the target they are going. the gold is a 12cm ring, so as long as it can provide accuracy of 4-5 CM that is plenty and as good as you will be able to make out with a spotting scope.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.