Using a Sparkfun Sound Detector
What is the Sound Detector?
The Sound Detector is a board made by Sparkfun electronics that provides a way to detect ambient sound levels.
There are three connections on the board:
- Audio - This is the raw audio from the microphone.
- Envelope - This is a analog value representing the volume of the ambient sound.
- Gate - This is a digital value representing if sound levels are low or high.
Wiring
There are two options for wiring, you can use both at the same time:
Digital
Wired up in digital mode the sound detector signals if the sound level is low with a LOW
signal, and high with a HIGH
signal.
This method requires:
- Power (VCC to 5V)
- Ground (GND to GND)
- Gate to a digital pin on the Arduino (yellow wire in the diagram)
Analog
Wired up in analog mode the sound detector provides voltage proportional to the sound level.
This method requires:
- Power (VCC to 5V)
- Ground (GND to GND)
- Envelope to a analog pin on the Arduino (turquoise wire in the diagram)
There are three wires:
Getting started
Once wired, the code is that of a standard digitalRead
or analogRead
to obtain the value.
Example code reading envelope
#define envelopePin A0
void setup() {
Serial.begin( 9600 );
pinMode( envelopePin, INPUT );
}
void loop() {
Serial.println( analogRead( envelopePin ) );
}
Example code reading gate
#define gatePin 2
void setup() {
Serial.begin( 9600 );
pinMode( gatePin, INPUT );
}
void loop() {
Serial.println( digitalRead( gatePin ) );
}