-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPH0645: values are wrong #3
Comments
thanks for your help,
give "-inf" value but
value are still at 104db but when i clap my hand it goes to 112db max. I already try to solder SEL to GND, i try right now to put on 3.3V to see if something change |
with SEL on 3.3v give "-inf" value, "infinite" i guess... |
with SEL on 3.3v give 119 db and not move. Seems the more accurate is 32/14 with SEL on GND... I dont understand. Must i try another value? |
[This shows the compatibility problem between the ESP32 I2S interface and the SPH0645LM4H microphone.](url) seems i cant do anything with this shi.... LOL What mic do you use please? a INMP441 I2S ? |
Have your read Ivan's note on SPH0645? https://hackaday.io/project/166867-esp32-i2s-slm I guess that might be the issue. It needs specific initialisation to be applied to work correctly. And also an additional DC blocker filter, which you can add actually in config, copying coefficients from Ivan's repository. But the main issue is that I don't have that specific initialisation needed. You might try Ivan's project to see if it outputs correct values. Or you can try forking or copying my component locally and add https://github.com/ikostoski/esp32-i2s-slm/blob/b643efa1beae51b84d4ad9b2bfa35d439c81e9b6/esp32-i2s-slm.ino#LL272C3-L277C9 those lines to i2s component setup. |
Well, you found it yourself ) Yes, I'm using INMP441, but it is also a bit outdated. The best option AFAIK should be ICS 43434, but those are harder to find. |
You can probably add it to config, without modifying the component, thought I haven't tried it: esphome:
on_boot:
then:
- lambda: !lambda |-
REG_SET_BIT(I2S_TIMING_REG(0), BIT(9));
REG_SET_BIT(I2S_CONF_REG(0), I2S_RX_MSB_SHIFT); |
yes, buts its arduino ide...not esphome... with your peace of code added, its 98db and doesn change anymore ...sorry, doesnt work... Thanks I wait for the INMP441...in 3 weeks LOL |
Have you applied DC blocking filter? As reported here https://forums.adafruit.com/viewtopic.php?f=19&p=616024, looks like the signal is shifted down by half of full scale, so when calculating RMS it will be equivalent to pretty loud sound. Instead the signal should oscillate around 0. To achieve this, DC blocking filter should be used. Again I can't test it, but I hope those are correct filter coefficients. So the final config should be smth like this: esphome:
name: sound-level-meter
on_boot:
then:
- lambda: !lambda |-
REG_SET_BIT(I2S_TIMING_REG(0), BIT(9));
REG_SET_BIT(I2S_CONF_REG(0), I2S_RX_MSB_SHIFT);
external_components:
- source: github://stas-sl/esphome-sound-level-meter
esp32:
board: esp32dev
framework:
type: arduino
logger:
level: DEBUG
i2s:
bck_pin: 23
ws_pin: 18
din_pin: 19
sample_rate: 48000
bits_per_sample: 32
bits_shift: 14
sound_level_meter:
update_interval: 1s
mic_sensitivity: -26dB
mic_sensitivity_ref: 94dB
groups:
- filters:
- type: sos
coeffs:
# DC-blocker
# b0 b1 b2 a1 a2
- [1.00123377961525, -1.00123377961525, 0.0, -0.9992, 0.0]
- sensors:
- type: eq
name: Leq_1s |
Thanks for your time and help! but it doesnt work. 98db and it moves to 101 when i clap hands... i see some guys used 16000 as sample_rate but it doesnt change anything for me. |
hello i receive my inpm441 but now i have a compile error :
if you have an idea? thanks |
Thanks for reporting it, indeed I unintentionally used newer C++ version language feature. I've just fixed code, please update and try again. |
thanks! i can compile but i have -inf only... here is my code, the inmp441 is 3.3V power :
any idea why it doesnt work please? |
49 dBA or or dBZ? dBZ values are a bit higher than dBA. In complete silence there should be <40 dBA. I was able to get 36-37 dBA with INMP441, however it might depend on mic instance, power noise, radio noise etc... and it might require a bit of experimentation to figure out where the noise comes from. Maybe turning off WiFI, trying different PINS, wires... |
ok thanks, i will try :) |
Hello
i try your component and if i use advanced example code i have 121db and if i speak or clap my hand nothing happend.
I try the minimal sample code and i get 104db and same, not a lot of difference if i speak or clap my hand close to the mic nothing change.
I use a SPH0645 like this :
any idea please why i doesnt work?
The text was updated successfully, but these errors were encountered: