Make I2S microphone work on SODAQ Autonomo

With the Cortex M0 I thought the SODAQ Autonomo is a good option for digital sound recording also. Unfortunately this is not working out of the box, seems that some SAMD code is missing for the Autonomo: :-/ but after some tweaking it is now running, see the full story at:

How to

You have to add in C:\Users\[yourUserName]\AppData\Local\Arduino15\packages\SODAQ\hardware\samd\1.6.14\variants\sodaq_autonomo\variant.h

best after the USB definition in line 236

/*
 * I2S Interfaces
 */
#define I2S_INTERFACES_COUNT 1

#define I2S_DEVICE          0
#define I2S_CLOCK_GENERATOR 3
#define PIN_I2S_SD          (14u)
#define PIN_I2S_SCK         (1u)
#define PIN_I2S_FS          (2u)

wiring is:

SCK: D1
FS:  D2
SD:  D14

FFT Results

Some results using the ArduinoSoundSpectrumSerialPlotter see adapted code for the Autonomo and real serial (graph) plotter instead of serial console and FFTAnalyzerClass.

Sinus tones

… and Bach’s Toccata und Fuge d-moll

1 Like

Cool, congratulations!


Can you try to add these definitions just to your main .ino file? I believe this would also work fine.

It’s not working. I placed the section on top of the main.ino file and got this error message:

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp: In member function 'int AudioInI2SClass::begin(long int, int)':

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp:36:8: error: 'I2S' was not declared in this scope

   if (!I2S.begin(I2S_PHILIPS_MODE, sampleRate, bitsPerSample)) {
        ^

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp:44:3: error: 'I2S' was not declared in this scope

   I2S.onReceive(AudioInI2SClass::onI2SReceive);
   ^

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp: In member function 'virtual void AudioInI2SClass::end()':

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp:58:3: error: 'I2S' was not declared in this scope

   I2S.end();
   ^

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp: In member function 'virtual int AudioInI2SClass::read(void*, size_t)':

C:\Users\xx\Documents\Arduino\libraries\ArduinoSound\src\AudioInI2S.cpp:85:14: error: 'I2S' was not declared in this scope

   int read = I2S.read(buffer, size);
              ^

exit status 1
Fehler beim Kompilieren für das Board SODAQ Autonomo.

A post was merged into an existing topic: SODAQ Autonomo

You already ran into this error:

… so i don’t think this is related to the placement of the pin definitions in any way.

To cite you:

My “old” fix did now “work” in direction compiling, don’t know what was wrong at my last trial. But is not working functionally.

Maybe you can find the trick again about how to make this piece compile?

Yes it worked but after placing it in the variant.h file, it’s part of the board definition and Jan from SODAQ advised me also to put it in this file exactly.

I have not too much knowledge about the including logic at the Arduino IDE but it did not work in my main sketch. with the other serial plotter code.

Perhaps we can make a pull request for the official Autonomo variant.h file. So I2S would be available for all user with this new board definition file.

1 Like

All right. Do you believe this would be the right place?

We just made a pull request, so let’s see how SODAQ responds to that:
https://github.com/SodaqMoja/SodaqCore-samd/pull/7

Thanks, Jan, Gabriel and @clemens!

1 Like

The answer from SODAQ didn’t take much time, thanks! If you like to follow the discussion, please visit Provide I2S definitions for Autonomo by amotl · Pull Request #7 · SodaqMoja/SodaqCore-samd · GitHub.

They mentioned that the changes should probably go into the appropriate repository maintained by Arduino:

However, there’s currently no Autonomo board variant at all. So things still have to be sorted out. Time will tell…

SODAQ made a release incorporating the changes. Thanks!

There is a test JSON at http://downloads.sodaq.net/test/package_test_sodaq_samd_index.json
That one includes the v1.6.15 version. If all is well I’ll make it an “official” release.