Difference between revisions of "AudioMoth"
(30 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | I plan to | + | {{Project |
+ | |Name=AudioMoth | ||
+ | |Status=In progress | ||
+ | |Picture=audiomoth.png | ||
+ | |Contact=bertrik | ||
+ | }} | ||
+ | |||
+ | == What == | ||
+ | I have an AudioMoth board, and plan to improve its software: | ||
* https://www.openacousticdevices.info/ | * https://www.openacousticdevices.info/ | ||
* https://github.com/OpenAcousticDevices/AudioMoth-Project source code | * https://github.com/OpenAcousticDevices/AudioMoth-Project source code | ||
− | + | Ideas: | |
+ | * general clean-up | ||
+ | ** fix white space, remove many of the empty lines (earlier CR/LF mistake?), like these https://github.com/bertrik/AudioMoth-Firmware-Basic/blob/master/main.c#L154 | ||
+ | ** fix sprintf statements, like these https://github.com/bertrik/AudioMoth-Firmware-Basic/blob/master/main.c#L167 | ||
+ | ** fix complicated and non-portable casts (sensitive to endianness), like this https://github.com/bertrik/AudioMoth-Firmware-Basic/blob/master/main.c#L161 | ||
+ | * update tool-chain to newer version | ||
+ | ** update gcc | ||
+ | ** attempt to make it possible to compile with platformio | ||
+ | ** document it and upstream it when it works | ||
+ | * extend functions | ||
+ | ** add trigger functionality, maybe a specific bat trigger (high pass filter)? | ||
+ | ** crest (instantaneous vs average) trigger? | ||
+ | ** save files in sub-directories (per day) instead of a flat filesystem? | ||
+ | |||
+ | == Hardware == | ||
+ | [[File:SPM0408LE5H_response.png|thumb|right|Frequency response]] | ||
+ | |||
See https://circuithub.com/projects/OpenAcoustics/AudioMoth | See https://circuithub.com/projects/OpenAcoustics/AudioMoth | ||
− | + | The microphone is a [https://www.mouser.com/datasheet/2/218/-532499.pdf SPM0408LE5H]. | |
+ | Can't find much about its ultrasonic performance. The official graph shows a hint of resonance above 10k so it does have ultrasonic sensitivity. | ||
+ | For frequencies higher than the resonance peak the response of a typical microphone drops off steeply with 6 dB/octave. | ||
+ | I have been able to record some pipistrelle bats with it (40 - 50 kHz). | ||
+ | |||
+ | The processor is EFM32WG380F256, [https://www.silabs.com/mcu/32-bit/efm32-wonder-gecko/device.efm32wg380f256-qfp100 link] | ||
+ | |||
+ | Where is the schematic? | ||
+ | |||
+ | == Software == | ||
+ | My fork on github: https://github.com/bertrik/AudioMoth-Project | ||
+ | |||
+ | === Suggested trigger extension === | ||
+ | A bat specific trigger is desireable because this way we only get "interesting" files. | ||
+ | |||
+ | The idea is that bat signals are, in general: | ||
+ | * ultrasonic, frequency above 10 kHz | ||
+ | * organised in short pulses, e.g. 8 pulses per second of 5 ms each for a pipistrelle | ||
+ | Challenges: | ||
+ | * crickets, sound is also at least partly ultrasonic, overlapping with the calls of some of the larger bats and with social bat calls in general | ||
+ | |||
+ | Proposed algorithm: | ||
+ | # Apply a high-pass filter at about 10 kHz, this needs not be super-sharp filter. Perhaps just a simple 1-pole IIR (easy to calculate). | ||
+ | # Calculate the energy in each millisecond by summing the squared amplitude of the high-pass filtered signal over this millisecond. Perhaps we can also just calculate variance here and forget about step 1). | ||
+ | # Calculate a running average energy over several (say 500) of these milliseconds values. | ||
+ | # If the millisecond energy exceeds the average energy by a factor X (the sensitivity of the trigger) for a duration of Y consecutive milliseconds, consider the trigger to be active. | ||
+ | |||
+ | === Running the tools === | ||
+ | Running the AudioMoth tools (configuration tool, flash tool, etc) requires the --no-sandbox option (at least on my system), for example | ||
+ | ./AudioMothConfigurationAppSetup1.2.5.AppImage --no-sandbox | ||
+ | |||
+ | === IDE for development === | ||
+ | A description of all steps to get the firmware compiled is written here: | ||
+ | https://github.com/OpenAcousticDevices/AudioMoth-Project/wiki/AudioMoth | ||
+ | |||
+ | === Compiling === | ||
+ | ==== platformio ==== | ||
+ | It compiles and produces a firmware.bin file, but it's not recognized by the flashing tool as a valid file. | ||
+ | |||
+ | Use this platformio.ini file: | ||
+ | [platformio] | ||
+ | src_dir = src,fatfs_src | ||
+ | include_dir = inc,fatfs_inc | ||
+ | [env:default] | ||
+ | framework = zephyr | ||
+ | platform = siliconlabsefm32 | ||
+ | board = efm32wg_stk3800 | ||
+ | |||
+ | Install platformio: | ||
+ | sudo apt install python3-pip | ||
+ | sudo pip3 install platformio | ||
+ | sudo pip3 install -U PyYAML | ||
+ | |||
+ | Compile it: | ||
+ | pio run |
Latest revision as of 11:43, 7 April 2021
Project AudioMoth | |
---|---|
Status | In progress |
Contact | bertrik |
Last Update | 2021-04-07 |
What
I have an AudioMoth board, and plan to improve its software:
- https://www.openacousticdevices.info/
- https://github.com/OpenAcousticDevices/AudioMoth-Project source code
Ideas:
- general clean-up
- fix white space, remove many of the empty lines (earlier CR/LF mistake?), like these https://github.com/bertrik/AudioMoth-Firmware-Basic/blob/master/main.c#L154
- fix sprintf statements, like these https://github.com/bertrik/AudioMoth-Firmware-Basic/blob/master/main.c#L167
- fix complicated and non-portable casts (sensitive to endianness), like this https://github.com/bertrik/AudioMoth-Firmware-Basic/blob/master/main.c#L161
- update tool-chain to newer version
- update gcc
- attempt to make it possible to compile with platformio
- document it and upstream it when it works
- extend functions
- add trigger functionality, maybe a specific bat trigger (high pass filter)?
- crest (instantaneous vs average) trigger?
- save files in sub-directories (per day) instead of a flat filesystem?
Hardware
See https://circuithub.com/projects/OpenAcoustics/AudioMoth
The microphone is a SPM0408LE5H. Can't find much about its ultrasonic performance. The official graph shows a hint of resonance above 10k so it does have ultrasonic sensitivity. For frequencies higher than the resonance peak the response of a typical microphone drops off steeply with 6 dB/octave. I have been able to record some pipistrelle bats with it (40 - 50 kHz).
The processor is EFM32WG380F256, link
Where is the schematic?
Software
My fork on github: https://github.com/bertrik/AudioMoth-Project
Suggested trigger extension
A bat specific trigger is desireable because this way we only get "interesting" files.
The idea is that bat signals are, in general:
- ultrasonic, frequency above 10 kHz
- organised in short pulses, e.g. 8 pulses per second of 5 ms each for a pipistrelle
Challenges:
- crickets, sound is also at least partly ultrasonic, overlapping with the calls of some of the larger bats and with social bat calls in general
Proposed algorithm:
- Apply a high-pass filter at about 10 kHz, this needs not be super-sharp filter. Perhaps just a simple 1-pole IIR (easy to calculate).
- Calculate the energy in each millisecond by summing the squared amplitude of the high-pass filtered signal over this millisecond. Perhaps we can also just calculate variance here and forget about step 1).
- Calculate a running average energy over several (say 500) of these milliseconds values.
- If the millisecond energy exceeds the average energy by a factor X (the sensitivity of the trigger) for a duration of Y consecutive milliseconds, consider the trigger to be active.
Running the tools
Running the AudioMoth tools (configuration tool, flash tool, etc) requires the --no-sandbox option (at least on my system), for example
./AudioMothConfigurationAppSetup1.2.5.AppImage --no-sandbox
IDE for development
A description of all steps to get the firmware compiled is written here: https://github.com/OpenAcousticDevices/AudioMoth-Project/wiki/AudioMoth
Compiling
platformio
It compiles and produces a firmware.bin file, but it's not recognized by the flashing tool as a valid file.
Use this platformio.ini file:
[platformio] src_dir = src,fatfs_src include_dir = inc,fatfs_inc [env:default] framework = zephyr platform = siliconlabsefm32 board = efm32wg_stk3800
Install platformio:
sudo apt install python3-pip sudo pip3 install platformio sudo pip3 install -U PyYAML
Compile it:
pio run