A simple burglar Alarm: the noise sensor

The estimated reading time for this post is 73 seconds

The noise sensor FC04 is really easy to use.
It only has 3 pins: Vcc, GND e SNG, therefore the connections I have established are the followings:

Pin Receiver Pin Arduino
Vcc 5 V
GND GND
SNG Pin 2 (digital)

The sensor has a noise threshold set by a screw: if a noise  over the threshold is detected, a HIGH signal is sent to the selected pin (2 in our case).

Therefore the sketch can be:

 

int SERIAL_BAUD        = 9600;
int SENSOR_DIGITAL_PIN =    2;
int SOUND_DELAY        =   50; /* a small delay to not detect multiple noises or echos */
void setup() {
    Serial.begin(SERIAL_BAUD);
    pinMode(SERIAL_BAUD, INPUT);
}
void loop() {
    if (digitalRead(SENSOR_DIGITAL_PIN) == LOW) {
        Serial.print("Rumore!");
        delay(SOUND_DELAY);
    }
}

Now we can merge together the two programs (movement and noise sensor) to make Arduino send me an email in case of suspected intrusion.

I’ll work on internet shield in the next post: as always done i’ll try to understand how it works itself  and then add it with the noise sensor above and the movement sensor previously published .

A presto!

Rispondi