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 10
10
+-- ------------------------------------ --+
11
11
left RPI | (1) GND (2) DIN (3) BCLK (4) LRCLK (5) 3.3V | AIY right
12
12
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.
13
26
*/
14
27
15
28
#include < I2S.h>
@@ -20,15 +33,21 @@ void setup() {
20
33
Serial.begin (115200 );
21
34
22
35
i2s.setDATA (0 );
23
- i2s.setBCLK (1 ); // LRCLK = GP2
36
+ i2s.setBCLK (1 ); // Note: LRCLK = BCLK + 1
24
37
i2s.setBitsPerSample (16 );
25
38
i2s.setFrequency (22050 );
39
+ // NOTE: The following values are known to work with the Adafruit microphone:
40
+ // i2s.setBitsPerSample(32);
41
+ // i2s.setFrequency(16000);
26
42
i2s.begin ();
27
43
28
44
while (1 ) {
29
45
int16_t l, r;
30
46
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);
32
51
}
33
52
}
34
53
You can’t perform that action at this time.
0 commit comments