@signal15 - I have finished the development of a high-speed SPL measurement device for ST_Anything/HubDuino. I have added the new PS_SoundPressureLevel.h and PS_SoundPressureLevel.cpp files to the ST_Anything library.
This new class polls the analog input pin every 50ms (by default) and keeps the MAX SPL value. It then transmits this value ~every 30 seconds (defined in the example sketch) to Hubitat and then resets the local variable to gather the next MAX value.
The new example sketch is named ST_Anything_SPL_ESP8266WiFi.ino.
This should get you going. Can't wait to hear how the children react!
Here is the documentation for the new SPL class/device.
// Summary: PS_SoundPressureLevel is a class which implements the "Sound Pressure Level" device capability.
// It inherits from the st::PollingSensor class. The current version uses an analog input to measure the
// voltage on an anlog input pin and then scale it to engineering units.
//
// The last four arguments of the constructor are used as arguments to an Arduino map() function which
// is used to scale the analog input readings (e.g. 0 to 1024) to Engineering Units before sending to SmartThings.
//
// Create an instance of this class in your sketch's global variable section
// For Example: static st::PS_SoundPressureLevel sensor1(F("soundPressureLevel1"), 60, 0, PIN_SPL, 0, 1024, 0.0, 165.0, 50);
//
// st::PS_SoundPressureLevel() constructor requires the following arguments
// - String &name - REQUIRED - the name of the object - must match the Groovy ST_Anything DeviceType tile name
// - long interval - REQUIRED - the polling interval in seconds
// - long offset - REQUIRED - the polling interval offset in seconds - used to prevent all polling sensors from executing at the same time
// - byte pin - REQUIRED - the Arduino Pin to be used as an analog input
// - double s_l - OPTIONAL - first argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - minimum raw AI value
// - double s_h - OPTIONAL - second argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - maximum raw AI value
// - double m_l - OPTIONAL - third argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Min (or Max if inverting)
// - double m_h - OPTIONAL - fourth argument of Arduino map(s_l,s_h,m_l,m_h) function to scale the output - Engineering Unit Max (or Min if inverting)
// - long m_nHighSpeedPollingInterval - OPTIONAL - number of milliseconds between high speed analog reads - defaults to 50ms