Open jk opened 5 years ago
Not sure if will help anyone, but i've been scratching my head on this for ages. If I followed all the help and did everything through console logged on a pi then everything worked fine. However, every time I tried to sudo the code or remote debug(sudo) then my sound class kept giving an error about unable to find device "dmic_sv"...
After many obscure searches I stumbled upon https://www.alsa-project.org/main/index.php/Asoundrc. In there it suggests you can create the devices in the ~/.asoundrc is AdaFruit instruct, but also in /etc/asound.conf for system wide configuration. I did this and now I can see the "dmic_sv" running under sudo.
Reason, I need this, is my pi has no desktop and my code will run as a Service on boot, so ordinarily not logged in to console. Hope this helps soem others too.
hi all . great to see this continually progressing. appreciate the work @roscoe81
I'm wondering about a couple of things:
1) is it possible to have some kind of 'smoothing' to the noise detection, such that there is less fluctuation? even when sound levels seem steady, there is oscillation of around 5 dB. is that potentially due to air fluctuations?.... I've noticed the device is very sensitive to this (just waving hand in front of it registers as quite loud, presumably due to pressure fluctuation at the sensor). has anyone tried to reduce this with a microphone cover etc?
2) how would you recommend streaming the data to a central server if I was to use a number of devices? is installing MQTT the best route and could this be incorporated into your code?
Thanks for your feedback @dguk25.
I followed the instructions here and then the noise-amps-at-freqs.py
and noise-profile.py
scripts worked
I find I'm having to do this step each time I reboot the pi:
nano ~/.asoundrc
copying specific text, then running
arecord -D plughw:0 -c1 -r 48000 -f S32_LE -t wav -V mono -v file.wav
Otherwise it doesn't recognise the i2smic. Is there a way round this @roscoe81 ? Have I missed something in the setup.
I haven't come across that issue @dguk25 and the i2smic is recognised on my unit after each reboot, so I'm not sure that I can help you. The only thing I can suggest is to ask if you set up the auto load at boot in "Auto Load at Boot" in these instructions.
Thanks. I have done that (on multiple occasions!). Is ~/.asoundrc meant to be a permanent doc? It seems to need creating after each boot. I'll hopefully be setting up a couple of other devices soon, so will see if I get the same behaviour.
On Thu, 6 May 2021 at 07:06, Ross Fowler @.***> wrote:
I haven't come across that issue @dguk25 https://github.com/dguk25 and the i2smic is recognised on my unit after each reboot, so I'm not sure that I can help you. The only thing I can suggest is to ask if you set up the auto load at boot in "Auto Load at Boot" in these instructions https://learn.adafruit.com/adafruit-i2s-mems-microphone-breakout/raspberry-pi-wiring-test .
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/pimoroni/enviroplus-python/issues/11#issuecomment-833252480, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETBUPWWTGAVXMXSYKGIRM3TMIWWLANCNFSM4H62SO7A .
--
-- http://youngrobot.com/ Young Robot | App Development Specialists Registered in England and Wales. Company No 06076173. Registered Office: International House, 24 Holborn Viaduct, London, EC1A 2BN
Technical Support UK: +44 7872 825 008 | @. @.>
IMPORTANT NOTICE This e-mail and the information it contains may be privileged and/or confidential. The unauthorized use, disclosure or copying of this e-mail or any information it contains, is prohibited and could, in certain circumstances be a criminal offence. If you are not the intended recipient please notify us immediately and delete this message from your system.
For anyone in the future who is also trying to make noise-amps-at-freqs.py
and noise-profile.py
work on their Enviro/+, and it spits out the "adau7002" device not found error - but doesn't want to modify FFsocket as per https://github.com/pimoroni/enviroplus-python/issues/11#issuecomment-524489500 :
i2scmic.py
script - set it up so that it loads automatically, but when presented with the option to reboot, don't do that yet with n
.cd Raspberry-Pi-Installer-Scripts
. Then cd i2s_mic_module
snd-i2smic-rpi.c
. Edit the following line: .card = "snd_rpi_i2s_card", // -> snd_soc_card.name
to .card = "adau7002", // -> snd_soc_card.name
make clean
, make
, make install
/boot/config.txt
with dtparam=i2s=on
(some distros like DietPi)reboot
ssh
back into your pi, create a new config file in your home directory ~
called .asoundrc
with your text editor of choice. Copy and paste the following from @roscoe81:#This section makes a reference to your I2S hardware, adjust the card name
#to what is shown in arecord -l after card x: before the name in []
#You may have to adjust channel count also but stick with default first
pcm.dmic_hw {
type hw
card adau7002
channels 2
format S32_LE
}
#This is the software volume control, it links to the hardware above and after
#saving the .asoundrc file you can type alsamixer, press F6 to select
#your I2S mic then F4 to set the recording volume and arrow up and down
#to adjust the volume
#After adjusting the volume - go for 50 percent at first, you can do
#something like
#arecord -D dmic_sv -c2 -r 48000 -f S32_LE -t wav -V mono -v myfile.wav
pcm.dmic_sv {
type softvol
slave.pcm dmic_hw
control {
name "Master Capture Volume"
card adau7002
}
min_dB -3.0
max_dB 30.0
}
Format it like so:
After running these steps, test if everything works through:
alsamixer
, pressing F4
on your keyboard, and seeing the following screen:
noise-amps-at-freqs.py
and noise-profile.py
and having an output on the Enviro/+'s screen.Thank you to everyone who has contributed to this awesome thread! Thanks especially to @roscoe81 I can now record from the mic. What is going over my head through is just getting a simple output to a csv e.g. a csv with the noise level every minute or the average noise level in the past minute.
E.g. similar to the other outputs here https://angelaambroz.com/blog/posts/2021/Mar/08/pi_project_2_indoor_environment_monitor/
Also want to chime in and mention that with the help of @roscoe81's repo here I was able to successfully get accurate dbA readings. It will be my goal in the next few weeks to write up a script that saves readings to a database every few seconds to get a historical sound pressure record.
That really is EXCELLENT news! Thank you. I'll be experimenting more with this functionality and hopefully improve my Grafana dashboard.
Sorry for the lack of response here. I don't have a good answer for why it slipped me by, other than: ARGH.
I think it goes without saying that the effort of @roscoe81 is greatly, greatly appreciated. I am not in possession of the time, expertise and headspace to produce as well-rounded a solution. Our software always straddles some awkward line between "feature complete, usable example" and "very basic starter for makers to take and run with" and it doesn't always work out.
Should this library try to implement @roscoe81's code? I believe we should probably have a basic setup in the Enviro library, but also link to @roscoe81's excellent project as a more complete solution. This is so we can direct credit where credit is due, lend some exposure to a good project, but also not simply kick the can for proper noise monitoring support completely down the road.
I received my enviro+ last week and over the weekend I managed to install the examples and build my own InfluxDB bridge to show all those measurements via Grafana. Had a lot of tinkering fun, thanks :)
But I'm missing a way to interface the MEMS microphone to read out noise levels. I suppose that support is under way, can someone give an ETA or directions where to read further.