Skip to content

Two state sensor (On/Off) reacting on sound levels measured by I2S microphones ( SPH0645LM4 or INMP441 )

Notifications You must be signed in to change notification settings

RoSchmi/Esp32_I2S_Microphone_Vol_Switcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Esp32_I2S_Microphone_Vol_Switcher

SoundSwitcher is a class to implement a two state sensor reacting on sound levels. The sound volume is measured by an I2S micophone (SPH0645LM4 or INMP441) The state toggles when a changeable arbitrary soundvolume level is exceeded A changeable hysteresis is accomplished

Example:

https://www.hackster.io/RoSchmi/heating-burner-monitoring-using-esp32-and-microphone-80015d

https://github.com/RoSchmi/Esp32_WiFiManager_HeatingSurvey

Constructor: has two parameter, a configuaration struct and the used microphone type

Initialization: .begin method with 4 parameters (has to be called in setup()) * switchThreshold * hysteresis * updateIntervalMs * delayTimeMs

The first two parameters need not be explained.

updateIntervalMs : a time interval in ms. Only when the time interval has expired a new sound level average is calculated

delayTimeMs: this delay time is introduced for reading the analog soundlevel after the threshold is exceeded. This parameter determins after which timeinterval the analog value is sampled (to read not just at the very beginning of the new state)

soundSwitcher.SetActive() : Has to be called right after the soundSwitcher.begin function

soundSwitcher.SetCalibrationParams() : Is optional, determins an offset and a factor

soundSwitcher.feed() : This function is called frequently from the loop() of the main program It returns a struct Feedresponse. After the feed command, Feedresponse.isValid has to be checked If .isValid is true, Feedresponse.hasToggled is checked If .hasToggled is true, your reaction on the change of the state has to be performed

About

Two state sensor (On/Off) reacting on sound levels measured by I2S microphones ( SPH0645LM4 or INMP441 )

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages