Audio out of Nano Sense BLE?

Hello, I am looking for a method of getting digital audio out of the Nano Sense BLE. Initially, I tried the I2S (sic) audio protocol, ( Adafruit I2S 3W Class D amplifier - MAX98357A ) but no libraries for the nano sense for I2S. I then tried PWM to use as a DAC but the frequency output on the Arduino pin A2 is only 495Hz. For my audio speech use, I need at least a sample rate of 10Kz to 20Kz. I have searched online but no results yet. Any help appreciated.

For my audio speech use, I need at least a sample rate of 10Kz to 20Kz

Telephony speech bandwidth is only 3kHz.

Arduino pin A2 is only 495Hz.

There is a [u]TMRpcm[/u] library that runs PWM at a higher frequency. (I don’t know what the frequency is.)

For my audio speech use, I need at least a sample rate of 10Kz to 20Kz. I have searched online but no results yet. Any help appreciated.

Don’t confuse the sample rate (which has to be at least twice the audio frequency) with the PWM frequency which is often much higher. For example, class-D audio amplifiers often run in the MHz range.

Note that unfiltered PWM is NOT analog and feeding it into an amplifier’s analog input can sometimes do “bad things” to the amplifier I wouldn’t feed PWM into my stereo system. :wink: I2S is a MUCH better solution (if you can get it working) and it should give you much better quality than TMRpcm.

Thanks all for your help. Another example I have seen is the 12bit DAC I2C MCP4725. from Adafruit. https://www.arduino.cc/reference/en/libraries/adafruit-mcp4725/ says compatible with all Arduino architectures, but no date on it. I am not sure if it includes the nRF52840 of the Nano Sense BLE.

I have seen is the 12bit DAC I2C MCP4725. from Adafruit.

No good for audio as the I2C bus is not fast enough, you need one with an SPI interface. Lots of those about.

Thanks for the speed reminder of I2C and audio.

For manipulating the pwm timer frequency on the BLE 33 I think the Adafruit_ZeroTimer.h might offer a way. But I haven’t checked it with the BLE. Look at the examples that come with it and there is a PWM example.

Have you got any success with this? I’m also trying to play a wav file from a SD card connected to my Nano 33 BLE Sense, tried several libraries but they are not compatible with the board running mbed os.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.