amc2021:groupl:code:sound_detection
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
amc2021:groupl:code:sound_detection [2021/09/05 01:38] – kshama001 | amc2021:groupl:code:sound_detection [2023/01/05 14:38] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 11: | Line 11: | ||
<file c++ Sound_Detection.ino> | <file c++ Sound_Detection.ino> | ||
- | const int OUT_PIN = 12; // The OUTPUT of the sound sensor is connected to the digital pin D12 of the Arduino | + | const int OUT_PIN = 12; // The OUTPUT of the sound sensor is connected to the digital pin D12 of the Arduino |
- | const int SAMPLE_TIME = 10; // The sampling time in milliseconds, | + | const int SAMPLE_TIME = 10;// The sampling time in milliseconds, |
- | const int Threshold = 90; | + | const int Threshold = 90; // Threshold on decibel value for LED switching ON, the value has been optimized with respect to |
+ | //the used sampling time (900 cumulative digital counts ≈ 90 dB from " | ||
| | ||
Line 39: | Line 40: | ||
sampleBufferValue++; | sampleBufferValue++; | ||
} | } | ||
- | if (millisElapsed > SAMPLE_TIME) { //if the elapsed time surpasses the sampling time, print the sampleBufferValue and test threshold for alarm | + | if (millisElapsed > SAMPLE_TIME) { //if the elapsed time surpasses the sampling time, |
+ | //print the sampleBufferValue and test threshold for alarm | ||
- | dB = 0.0666 *(sampleBufferValue) + 30.223; //linear regression to calculate the decibel value based of the rough calibration of the sensor response | + | dB = 0.0666 *(sampleBufferValue) + 30.223; //linear regression to calculate the decibel value based of |
+ | //the rough calibration of the sensor response | ||
Serial.println(dB); | Serial.println(dB); | ||
Serial.print(" | Serial.print(" | ||
Line 61: | Line 64: | ||
</ | </ | ||
+ | [[amc2021: |
amc2021/groupl/code/sound_detection.1630798704.txt.gz · Last modified: 2023/01/05 14:38 (external edit)