Malfunctioning Microphone

Play with it! Please tell us which board you're using.
For CircuitPython issues, ask in the Adafruit CircuitPython forum.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Waggy6
 
Posts: 7
Joined: Tue Jul 26, 2022 11:33 pm

Malfunctioning Microphone

Post by Waggy6 »

When using the mic to detect loud sounds or just background sounds if I have it graph the sound via the lights it always has at least 4-5 lights lit up. it does detect noise but if I am trying to detect loud noises its basically constantly detecting noises above the threshold. There is also a constant buzzing from the speaker which i'm wondering is contributing to the problem. Is there a firmware update or did I get a bad playground express?

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Malfunctioning Microphone

Post by mikeysklar »

What hardware are you using? Can you post a picture of your setup so we can review the wiring and soldering?

User avatar
Waggy6
 
Posts: 7
Joined: Tue Jul 26, 2022 11:33 pm

Re: Malfunctioning Microphone

Post by Waggy6 »

It is the circuit playground Express. I'm just using the built in mic. I'm using make code and I'm using "graph sound to 255" but I'm also having trouble with the when loud sound because that command is constantly triggering as well.

Separately but maybe not is that when running any code the speaker has a very faint buzzing and clicking.

User avatar
petespaco
 
Posts: 128
Joined: Thu Apr 19, 2012 7:53 pm

Re: Malfunctioning Microphone

Post by petespaco »

What are you using to power the CPE? If you are using a (possibly defective) power source that runs on mains power, you could be introducing power line noise.
So---- is the noise still there if you use battery power?

User avatar
Waggy6
 
Posts: 7
Joined: Tue Jul 26, 2022 11:33 pm

Re: Malfunctioning Microphone

Post by Waggy6 »

The noise is still there if I use battery only. The noise seems to be feedback based on which pixels are lit up on the board.

User avatar
mikeysklar
 
Posts: 13936
Joined: Mon Aug 01, 2016 8:10 pm

Re: Malfunctioning Microphone

Post by mikeysklar »

What code have you been using? Is it an Adafruit example or your own? Are you running Arduino, CircuitPython or MakeCode on the CPX?

I ask because there are some options for measuring sound with the onboard microphone versus measuring sound pressure (overall volume).

https://learn.adafruit.com/circuit-play ... und-sensor

User avatar
Waggy6
 
Posts: 7
Joined: Tue Jul 26, 2022 11:33 pm

Re: Malfunctioning Microphone

Post by Waggy6 »

I am using makecode for now as its the easiest start and will probably do enough for my first project, with the ability to edit the javascript. ive got a workaround for now.
let soundave = 0
let list: number[] = []
for (let index = 0; index <= 99; index++) {
list[index] = input.soundLevel()
}
forever(function () {
for (let index2 = 0; index2 <= 99; index2++) {
list[index2] = input.soundLevel()
soundave = 0
for (let index22 = 0; index22 <= 99; index22++) {
soundave = soundave + list[index22]
}
light.graph(soundave / 100 - 100, 100)
}
})

This gives me a pretty good rolling average but that arbitrary -100 . That just bugs me. I'll look at that link you sent me.

User avatar
DJDevon3
 
Posts: 210
Joined: Wed Mar 06, 2019 11:02 am

Re: Malfunctioning Microphone

Post by DJDevon3 »

You have to account for the bias voltage first. Basically for a microphone you have to code a floor limiter first to account for ambient voltage and room noise. Then your mic will be more precise. https://learn.adafruit.com/adafruit-pdm ... cuitpython

I looked up the datasheet and it appears not to be an auto-gain mic. That's good news for audio react projects as you won't have to fight against automatic sensitivity adjustments. However it also means any sound source must be close to the mic as there is no automatic sensitivity adjustment. https://cdn-learn.adafruit.com/assets/a ... DT01-M.pdf

You should see better results once you factor in some floor limiting bias voltage code.

Here's a learn guide that has audio react and the bias limiter included for the Circuit Playground Express: https://learn.adafruit.com/adafruit-cir ... ound-meter Please notice the bias limiter code for normalized_rms used in this example is the same as in the example for the PDM breakout. ;)

Locked
Please be positive and constructive with your questions and comments.

Return to “Circuit Playground Classic, Circuit Playground Express, Circuit Playground Bluefruit”