Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 2 of 2

Thread: Timestamp Rising Edge Using Hardware Timers for Capstone Project, Teensy 4.1

  1. #1
    Junior Member
    Join Date
    Oct 2021

    Timestamp Rising Edge Using Hardware Timers for Capstone Project, Teensy 4.1

    I am a mechanical engineering student in the beginning stages of my capstone project. For this project my group and I are building an electronic target system. We will be using time difference of arrival (TDOA) and multilateration to determine the location of the bullet's impact on a target.

    Currently, I have an audio detector which ouputs a logic high when a loud enough sound occurs. The idea is that the pressure wave from the bullet will trigger the audio sensor to output a logic high and TDOA will be used to determine the bullets location. For this project we set a goal of sub 1 mm accuracy when it comes to locating the target hit location. Using the dimensions of our target and an accuracy of < 1mm I determined that the minimum time difference of arrival between two sensor will be about 5 microseconds.

    Now, as for why I'm posting on the forum. I would like to use a hardware timer on the Teensy 4.1 to timestamp the arrival of a rising edge signal. There will be at least three rising edge signals arriving at three different pads on the Teensy. The more accurate the timestamp the better, ideally under 0.5 microseconds. Additionally, latency isn't necessarily a big concern when it comes to timestamping the rising edge as long as the latency is the same every time. I only care about the difference in arrival time.

    I have done a lot of research looking for code which I could adapt to my use. I've pieced together different code snippets with some very minor success. However, I don't believe my implementation is very well done and I think I will struggle to scale the code to work with multiple sensors ( I only have one audio detector at the moment). I think I have a good understanding of how to handle my timestamps after they have been recorded.

    So, in conclusion, I would really appreciate some help in writing code which will timestamp the rising edge signal with a high degree of accuracy, less that 0.5 microseconds if possible.

  2. #2
    Senior Member
    Join Date
    Jul 2020
    Sounds travels much faster in solids than air, so you may have multiple paths for acoustic energy to travel to your sensors unless
    you go for the shortest path inside the solid target itself? In which case you timing requirements are an order of magnitude tighter
    (but the risk of false readings is probably less).

    Also the acoustic signature of a solid impact in the solid will be much simpler to detect than in the air, as there is no background
    noise to worry about - its like detecting the P-wave from an earthquake.

    As for detection you ideally want to do this in hardware (interrupts and software have too much latency and jitter), using in input
    that supports this (alhough the 4.x are so fast it might be feasible in interrupts, but you have the issue that if two interrupts come in
    together they will be serialized in the hardware giving a false delay to one of them.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts