File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed
libraries/I2S/examples/I2SInput Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change 1010 +-- ------------------------------------ --+
1111 left RPI | (1) GND (2) DIN (3) BCLK (4) LRCLK (5) 3.3V | AIY right
1212 logo +---------------------------------------------+ logo
13+
14+ For an Adfruit I2S MEMS microphone (https://www.adafruit.com/product/3421),
15+ connect the pins as follows:
16+
17+ DOUT -> GPIO0
18+ BCLK <- GPIO1
19+ LRCL <- GPIO2 # LRCLK = BCLK + 1
20+ GND <-> GND
21+ 3V <-> 3V3OUT
22+
23+ The other idiosyncrasy of most modern MEMS microphones is that they
24+ require a minimum clock rate to wake up. For example, the SPH0645
25+ microphone needs at least 1MHz.
1326*/
1427
1528#include < I2S.h>
@@ -20,15 +33,21 @@ void setup() {
2033 Serial.begin (115200 );
2134
2235 i2s.setDATA (0 );
23- i2s.setBCLK (1 ); // LRCLK = GP2
36+ i2s.setBCLK (1 ); // Note: LRCLK = BCLK + 1
2437 i2s.setBitsPerSample (16 );
2538 i2s.setFrequency (22050 );
39+ // NOTE: The following values are known to work with the Adafruit microphone:
40+ // i2s.setBitsPerSample(32);
41+ // i2s.setFrequency(16000);
2642 i2s.begin ();
2743
2844 while (1 ) {
2945 int16_t l, r;
3046 i2s.read16 (&l, &r);
31- Serial.printf (" %d %d\n " , l, r);
47+ // NOTE: Adafruit microphone word size needs to match the BPS above.
48+ // int32_t l, r;
49+ // i2s.read32(&l, &r);
50+ Serial.printf (" %d %d\r\n " , l, r);
3251 }
3352}
3453
You can’t perform that action at this time.
0 commit comments