Hi,
I'm unsuccessfully trying to change the default setting so that they record at 256kHz instead of 48kHz. I've tried modifying the "main.c", under the header
/* USB configuration data structure */
I have changed the following line, trying different values (1, for 384kHz sampling rate; and 1.5 for 256kHz sampling rate):
.sampleRateDivider = 8,
But as a result the devices do not record at all when the switch is in "DEFAULT" position. Instead the green led flashes every two seconds.
Any indications on how to achieve this change in the default settings will be greatly appreciated.
Many thanks,
Hi, What you are seeing is the delayed affect of updating the default parameters. This data structure is stored in FLASH initially and is copied to the backup RAM when the AudioMoth detects that it has experienced a power-up reset. The backup RAM is maintained when the AudioMoth switches itself off whilst waiting to make recordings and the settings are read from the backup RAM each time the AudioMoth makes a recording. When you edit the default settings and refresh the AudioMoth you won't see the impact of the changes unless you cycle the power on your AudioMoth - remove batteries and USB connection. When re-powered it will then register that it has experiences a power-up reset and will copy the new default values to the backup RAM. You can set the sample rate to any value but it is most accurate when it is a divisor of 48 MHz. The audioMoth.c code uses TIMER2 to trigger the ADC -
TIMER_TopSet(TIMER2, CMU_ClockFreqGet(cmuClock_TIMER2) / sampleRate - 1);
- inside the -
static void enablePrsTimer(uint32_t sampleRate)
- function and this will set the clock period to the integer division of the clock frequency (48 MHz) and the sample rate. The minus one accounts for the overflow and the counter starting to count up from zero again. Sometimes you can change the sampleRateDivider to get a more accurate sample rate (e.g. half both the sample rate and sample rate divider to avoid a fractional result), but in most settings it is worth using the higher sample rate divider to a get better signal to noise ratio in the recordings as the sample rate error is pretty small. Alex
Hi,
is it possible to choose a sampling rate different from default ones?
I tried in defaultConfigSettings :
.clockDivider = 4, .acquisitionCycles = 16, .oversampleRate = 1, .sampleRate = 352800, .sampleRateDivider = 8,
to get a frequency of 41000 Hz, but the sampling rate came up to be 48 kHz.
EDIT: I chose the following parameters to get 32000 Hz, but when I import the file in matlab, frequency appears to be 41000 Hz.
.clockDivider = 4, .acquisitionCycles = 16, .oversampleRate = 1, .sampleRate = 256000, .sampleRateDivider = 8,
Is final sampling frequency
sampleRate/sampleRateDivider or is there another parameter that affect that value?
Thanks in advance!
Thanks Alex! I'll try it again following your explanation.
The green LED issue might be misleading in this case because I also made other changes in the firmware that may be responsible of its flashing. I'll try on a 'clean' version with no further changes.
Best,
Xavi
Hi, If you set the two parameters below, the AudioMoth will default to 256kHz, rather than 48kHz:
.sampleRate = 256000,
.sampleRateDivider = 1,
The sampleRate parameter determines the rate at which the samples are actually taken, and the sampleRateDivider determines the software downsampling of these samples. The default setting for 48kHz is:
.sampleRate = 384000,
.sampleRateDivider = 8,
The AudioMoth library wiki describes how the microphone parameters are set, and we don't change these at all in the basic firmware:
.clockDivider = 4,
.acquisitionCycles = 16,
.oversampleRate = 1,
When the sampling rate is changed in the configuration app it is just the sampleRate and the sampleRateDivider which are changed.
The green LED flashing suggests that the AudioMoth is trying to write to the SD card, fails for some reason, and is waiting for the start of the next recording cycle (sleep duration + recording duration) before trying again. Are you sure the SD card is writable and formatted correctly?
Alex