I've put together a first prototype for our wolf boxes - see the photo below. The main components are:
- Raspberry Pi. With a couple of status LEDs added for data write and GPS fix.
- Solar panel, charger with LiPo battery, power conditioner - all OTS Adafruit parts.
- USB cellular modem (pay-as-you-go for the moment).
- OTS Adafruit GPS module. Note that the timing is via the PPS signal - more on that later.
- OTS Behringer USB audio interface. This is easier for a prototype than a dedicated ADC, but there may be sensitivity and/or latency issues.
- Software written in C++ using PortAudio for the audio interface, GPSD for the GPS, and wiringPi for the hardware lines (LEDs and PPS signal).
The whole thing works, broadly speaking. The main issues are:
- Is the USB audio interface sufficient? There are a number of problems with PortAudio, particularly with the callback interval at low sampling rates. If anyone has experience of that library it would be useful to discuss further. However, we'll probably have to run it at a high sample rate and downsample offline because:
- Time synchronisation is probably only reliable using the PPS (pulse per second) GPS signal. On receiving a callback for the PPS, we raise a flag and then mark the PPS signal when next entering the audio callback. As callbacks are probably ISRs, the best we can do is mark the first byte in an audio buffer as corresponding to the PPS, so our synchronisation precision is only (buffer size)/(sampling rate). That means that if we use a tiny audio buffer (32 samples) and sample fast (44000 Hz), we can synchronise to 0.7 ms. Good enough, as long as the processor can handle such rapid task switching (we're writing data in a separate thread as well).
Any thoughts and suggestions are welcome! I'm off to North Carolina next week to check out the field site where we're hoping to track red wolves in the wild.