Pages: [1]   Go Down
Author Topic: Three externally triggered counters possible on Due?  (Read 49 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 4
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have three microphones with comparators that I'd like to use to triangulate sudden loud sounds, such as a hand-clap.

Years ago I designed a method to do this using a Z80-CTC (Counter/Timer Circuit) but I would now like to implement this with more modern technology, such as an Arduino Due.

I've read chapter-37 of the datasheet and finally deduced that there are 3 TC circuits on the Due and each TC contains 3 channels. I also read a post in this forum that implied that the SAM3X/A does not bring out TC1 to an output pin - only the SAM3H/A does that.

My question is: will the Due have enough TC ciruits and channels to do what I want, without impacting other system requirements such as UART clocking and system timers (millis, e.g.).



Here's my design:

Three counters, each externally triggered by a mic comparator.

When a counter is triggered, it counts down (or up) until it overflows, then it generates an interrupt.

Meanwhile, the sound will have triggered the other two counters, which will start counting.

When the first of the three counters interrupts, the ISR reads and saves the current count from each counter, saves the ID of the interrupting counter, resets all three counters, then returns.

Only the first interrupt of the three is taken. The ISR clears any pending 'rupts from the other two counters.

Inline code later analyizes the three counter values, applies some trig and geometry, and comes up with the direction from where the sound originated.



So the Due would need to have 3 counters that can be independently started via an external trigger.
Each counter would be able to interrupt on overflow.
Each counter would be able to have its current count read in the ISR.
Using these 3 counters would not prevent other normal system functions that rely on the Due's TC circuits.

Is the Arduino Due the right choice for this?

Thank you for any insights.
Logged

Pages: [1]   Go Up
Jump to: