-
Notifications
You must be signed in to change notification settings - Fork 88
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
Enviro Urban Noise Sensor #170
Comments
OK, after some more digging around I found the #98 thread with info on the bug in urban.py about the incorrect / 3.3 * 65535 line. Would still like to know how V relates to dB though?? I’ve also downloaded the newer firmware as I had the failed to connect to wifi issue too. I didn’t see a thread specific to the noise sensor issue so that’s why I posted. |
Hi @Astro-Pete. As you spotted, there was an error in the code, that was subsequently fixed in patch v0.0.9. As for relating V to dB, that's something I looked into but did not find a definitive answer for how to do that conversion (since V is an absolute measurement, and dB is a relative measurement). I would happily accept a pull request from someone knowledgeable in the area. |
Hi @ZodiusInfuser - I have spent a few days down this rabbit hole and there is a solution. I may get round to a pull, but now that my Urban is operational I'd have to take it down to hack it. I currently do the calculation post reading. This provides the solution. https://electronics.stackexchange.com/questions/96205/how-to-convert-volts-to-db-spl The one thing that is not in the specification is the gain on the operational amp, which the spec says is "user defined" - this would make sense as one may wish to use a variable resistor across the op amp to adjust the gain. You need to subtract this gain from your final reading because the reading has been amplified. The specification states the gain is a ratio of two resistors, but no values are given. No schematic either. Since you guys put this together, would you know that gain? Note we are just taking peak values and have no frequency or multiple samples to do a mean-square average. So its somewhat of a fudge, and some people may prefer the raw data to a fudged dB value. Roughly, by comparing the to an app on my phone and adjusting the offset/gain to get a similar answer. I came up with (logs are base 10)
GAIN was calibrated to
The Note the stack overflow formula mentions the offset from the log is @Astro-Pete - FYI |
Will nudge this as I know there were issues with GitHub and my comments appearing when I posted the above. The formula (and its derivation) is explained very long-windedly here: This could be put in the enviro-urban code, but I object to doing so on the premise that a Scientific Instrument should return the raw data, what you do with that post-processing is your business. Secondly, the formula is an approximation as the Specification sheet states the gain is determined by the ratio of two resistors that the installer would have provided. So the So someone is welcome to change the code, as I probably am not motivated to do so myself for the above reasons. I'd suggest a config parameter that allows you to choose decibels or the raw voltage reading. @ZodiusInfuser - I'm happy to make a more succinct writeup for the doco as a pull request. Thanks, I hope this helps. |
I seem to get a constant 1.5V reading. Is this sensor functional? Even if i shout at it while it takes a reading it only jumps to say 1.53V
Also is there any info on how to convert this reading to dB?
The text was updated successfully, but these errors were encountered: