You can do what you want to do, but don't think this is going to be an easy project for the weekend. You'll need to convert to square waves, use the internal comparator, use as high a clock speed as possible, 2 PICs, comms between the PICs, and OPAMPs externally for a start. Yes, you need 3 mics (or 4 might be easier). Or, just deal with the left-right ambiguity if you can (much simpler if you know which 180 degrees of the originating signal). You're probably not going to be happy with the results in the end. You're trying to accomplish Time Difference of Arrival (TDOA) with a ~40 MHz (10 really) PIC. Get really comfortable with PBP and interrupts. Read up on "zero crossing detection" as well. It isn't because of the speed of sound, but the looong waves and abiguity in the zero crossings that will make this rough. You'll have to get good with the internal counters also.Brush up on your trigonometry too. PBP isn't strong in that area. In the end, you're going to have most of the chip working toward the goal and still not be happy with the result. YOU'RE GOING TO LEARN A TON TRYING!! I don't mean to sound like this is impossible, but you're biting off a REALLY big chunk of work. Great idea, but hard (and advanced) to implement! Even experienced programmers struggle with TDOA and higher power processors than PICs.
Another possible way to do it if you're not worried about accuracy so much is to set up 8 mics in a wide as possible circle (omni mics pointing up) and external circuits to amplify and convert to square waves at zero crossings, and then use port B (interrupt on change). At least you can tell the basic direction of arrival (45 degrees-ish) instead of all the work of true TDOA. As others said, this is going to be hard to do if you have interfering sounds at all. How would you want to display the information? LEDs in a compass rose? To the LCD? Serial data out?
Post your code when you're done! Good luck.
Bookmarks