Hi Max, welcome where are you from (I can't see in your profile)
Think you have a reasonable idea how you would do it. Have you checked the tutorial section allready, There are several samples that contain code parts that I recognize in your project.
learn how to measure time wilt millis()
Here some code to get started...
void setup()
{
Serial.begin(115200);
Serial.println("Soundmeter 0.1");
}
void loop()
{
// DO MEASUREMENT
unsigned long startTime= millis();
while (analogRead(A0) > 300); // 300 threshold to be tuned
unsigned long duration = millis() - startTime;
Serial.print("duration:\t ");
Serial.println(duration);
if (duration > 10000) // 10 seconds minimum value to be tuned
{
// wait 30%
// switch on Relay 100%
}
}
now it's your turn to finish it ![]()