Community project

Household Multisensory Alert System

Photo of Household Multisensory Alert System
Generated with AI

alfred perez

Published November 19, 2026

This household alert system combines sound and motion detection to trigger visual and tactile warnings. Built around an Arduino Uno, it uses a KY-038 sound sensor and HC-SR501 PIR motion sensor to monitor for activity, with LED indicators and a vibration motor providing immediate feedback when alerts are triggered.

The guide includes a complete wiring diagram showing how to connect both sensors to the Arduino's digital inputs, wire the LEDs through current-limiting resistors, and build a transistor-based motor driver circuit with flyback protection. Assembly steps cover power rail preparation, sensor calibration, indicator light configuration, and motor driver construction, along with the firmware needed to detect sound and motion events with adjustable alert timing.

Wiring diagram

Wiring diagram for Household Multisensory Alert System
Loading diagram…

Gather all the parts

QtyComponent
1

Ky 038 Sound Sensor

KY-038 sound-detection module: electret microphone + LM393 comparator. Analog raw + digital threshold output (potentiometer-tuned). Common ringer / clap detector; not suitable for audio capture.

1

HC-SR501 PIR Motion Sensor

HC-SR501 passive infrared (PIR) motion sensor module with a Fresnel dome lens, detecting moving people up to about 7 m away. Its OUT pin goes to 3.3 V when motion is detected, with trimmers for sensitivity and on-time and a jumper for single or repeat triggering. It runs from 4.5 to 20 V, typically 5 V.

1

LED

Red

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

LED

Blue

Standard 3mm/5mm through-hole LED. A current-limiting series resistor is added automatically.

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

220 Ω

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

1 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

Resistor

10 kΩ

Through-hole resistor (current-limiting in series with an LED)

1

NPN Transistor (2N2222 / BC547)

P2N2222A

General-purpose NPN bipolar junction transistor (BJT) in TO-92 package. Used as a low-side switch to drive loads (e.g. buzzers) whose current exceeds ESP32 GPIO source capability (~12 mA). A ~1 kΩ base resistor is placed between the ESP32 GPIO and the transistor base. The collector connects to the load negative terminal (buzzer –), and the emitter connects to GND. When the GPIO goes HIGH (3.3 V), the transistor saturates and switches the load on. Compatible with both 2N2222/2N2222A and BC547/BC547B variants. Add a flyback diode (e.g. 1N4148) across inductive load terminals.

1

1N4001 Flyback Diode

General-purpose silicon rectifier diode used as a flyback / freewheeling diode to suppress back-EMF voltage spikes from inductive loads (DC motors, relays). Rated 50 V reverse voltage and 1 A forward current. Connected in parallel across the motor terminals with cathode (striped band) to the motor positive (+) / 5 V supply side and anode to the motor negative (−) / transistor collector side. Requires no firmware or library — purely passive protection component. Higher-voltage 1N400x rectifier variants are compatible substitutes when the current and package fit the design.

1

Flourishing FM0610-032 5 V vibration motor

Two-terminal eccentric motor rated 5 V, 40 mA at rated speed. Switch with the P2N2222A and protect with a flyback diode.

1

Ceramic Capacitor

100 nF ceramic

Through-hole ceramic capacitor bought by value, such as 22 pF, 10 nF or 100 nF (0.1 µF). It is non-polarised, so either lead can go to either net. Its most common job is decoupling: a 100 nF capacitor between an IC's supply pin and ground, placed as close to the chip as possible.

1

Electrolytic Capacitor

100 µF, 10 V

Radial aluminium electrolytic capacitor bought by value and voltage rating, such as 10 µF, 100 µF or 1000 µF 10 V. It is polarised: the + lead goes to the higher voltage and the - lead, marked by the stripe on the sleeve, to the lower voltage or ground. It is mostly used for bulk filtering across a power rail, with a voltage rating comfortably above the rail.

Assemble it in 6 steps

1. Prepare the power rails

With USB unplugged, connect UNO 5V to the breadboard positive rail and GND to the negative rail. Bridge split rails if your breadboard has them. Use USB power only for this prototype.

2. Connect the sensors

Connect KY-038 VCC to 5V, GND to ground, AO to A0 (raw sound reading), and DO to D2 (threshold trigger). Connect HC-SR501 VCC to 5V, GND to ground, and OUT to D3 (motion signal). Follow the printed pin labels, not guessed pin order.

  • Leave A4 and A5 unconnected for a future OLED.
  • Allow 60 seconds for the PIR to settle. Set its time control near minimum for testing.

3. Connect the two indicator lights

Connect D8 through its 220 ohm resistor to the red LED long leg. Connect D9 through its separate 220 ohm resistor to the blue LED long leg. Both short legs go to ground.

4. Build the motor switch

Use a P2N2222A transistor. Connect D6 through 1 kiloohm to its base, emitter to ground, and collector to motor negative. Connect the 10 kiloohm resistor between base and ground to keep the motor off at startup. Connect the specified 5V FM0610-032 motor positive to 5V.

  • Verify emitter/base/collector against the exact transistor supplier pinout before powering. Similar transistor names may have different leg orders.
  • Do not substitute a 3V coin motor on the 5V rail. Keep the rotating weight unobstructed and away from fingers.

5. Protect and steady the motor supply

Connect the diode across the motor, striped cathode to motor positive and anode to motor negative. Connect the 100 nF ceramic capacitor across the same motor terminals. Place the 100 microfarad capacitor across 5V and ground near the driver, positive lead to 5V and marked negative lead to ground.

  • A reversed diode can short the supply when the motor switches on. A reversed electrolytic capacitor can rupture.

6. Position and calibrate the prototype

Secure the motor housing to a surface the person can touch, leaving its moving weight free. Separate the microphone from the motor to reduce self-triggering. Aim the PIR into the monitored area. Keep the room quiet during the first two seconds after powering, then adjust the KY-038 trimmer until the desired test sound changes its trigger indicator. Restart quietly after adjustment.

  • Test sound alone, motion alone, and both together. Sound gives red flashes and long vibrations; motion gives blue flashes and paired short vibrations.
  • When both alerts overlap, motor pulses combine; use the two LEDs to identify the triggered sensors.
  • If the motor causes sound alerts, increase physical separation and adjust the sound threshold, then retest with the motor running.
  • Plug in USB and press Deploy in Schematik. No simulation setting or extra library is needed.
  • Both LEDs flash once per second. Alerts last four seconds.
  • This is a demonstration prototype, not a certified fire, security, or emergency alert system.
  • It detects sound thresholds, not particular alarm types or calibrated decibel levels. Vibration is only useful with physical contact.
  • Motor startup and stall current are not specified in the available motor table. Do not obstruct the rotating weight; disconnect power if the motor stalls or the board resets.

Review all connections

1. Connections between "sound" and "Arduino"

FunctionsoundArduino
powerVCC5V
groundGNDGND
analogAOGPIO 14
dataDOGPIO 2

2. Connections between "motion" and "Arduino"

FunctionmotionArduino
powerVCC5V
groundGNDGND
digitalOUTGPIO 3

3. Connections between "red_resistor" and "Arduino"

Functionred_resistorArduino
digitalP1GPIO 8
digitalP2 → LED ANODEEXT

4. Connections between "red" and "Arduino"

FunctionredArduino
groundGNDGND

5. Connections between "blue_resistor" and "Arduino"

Functionblue_resistorArduino
digitalP1GPIO 9
digitalP2 → LED ANODEEXT

6. Connections between "blue" and "Arduino"

FunctionblueArduino
groundGNDGND

7. Connections between "base_resistor" and "Arduino"

Functionbase_resistorArduino
digitalP1GPIO 6
digitalP2 → NPN Transistor (2N2222 / BC547) BASEEXT

8. Connections between "pulldown" and "Arduino"

FunctionpulldownArduino
digitalP1 → NPN Transistor (2N2222 / BC547) BASEEXT
groundP2GND

9. Connections between "transistor" and "Arduino"

FunctiontransistorArduino
groundEMITTERGND
digitalCOLLECTOR → Flourishing FM0610-032 5 V vibration motor MINUSEXT

10. Connections between "motor" and "Arduino"

FunctionmotorArduino
powerPLUS5V

11. Connections between "diode" and "Arduino"

FunctiondiodeArduino
passiveCathode → Flourishing FM0610-032 5 V vibration motor PLUSEXT
passiveAnode → Flourishing FM0610-032 5 V vibration motor MINUSEXT

12. Connections between "decoupling" and "Arduino"

FunctiondecouplingArduino
digital1 → Flourishing FM0610-032 5 V vibration motor PLUSEXT
digital2 → Flourishing FM0610-032 5 V vibration motor MINUSEXT

13. Connections between "bulk" and "Arduino"

FunctionbulkArduino
power+5V
ground-GND

Deploy the firmware

#include <Arduino.h>
// No simulated inputs: real KY-038 DO triggers; AO is diagnostic only.
constexpr uint8_t SOUND=2, PIR=3, MOTOR=6, RED=8, BLUE=9;
constexpr unsigned long WARMUP=60000, ALERT=4000;
bool idleSound=HIGH, lastSound=false, lastMotion=false;
bool soundAlert=false, motionAlert=false;
unsigned long soundStart=0, motionStart=0, lastReport=0;
uint16_t highVotes=0, samples=0;
unsigned long bootTime=0, lastCalibrationSample=0;
bool pirReady=false;
void setup() {
  digitalWrite(MOTOR,LOW); pinMode(MOTOR,OUTPUT);
  pinMode(RED,OUTPUT); pinMode(BLUE,OUTPUT);
  pinMode(SOUND,INPUT_PULLUP); pinMode(PIR,INPUT);
  bootTime=millis();
  Serial.begin(115200);
  Serial.println(F("Keep quiet for first 2 seconds: learning sound idle level. PIR warms up for 60 seconds."));
}
void loop() {
  unsigned long now=millis();
  unsigned long sinceBoot=now-bootTime;
  if(sinceBoot<2000) {
    // Sample once per millisecond: counters cannot overflow during calibration.
    if(samples==0 || now-lastCalibrationSample>=1) {
      lastCalibrationSample=now;
      highVotes += digitalRead(SOUND)==HIGH;
      ++samples;
    }
    return;
  }
  // Latch readiness so the millis rollover does not restart warm-up.
  if(!pirReady && sinceBoot>=WARMUP) pirReady=true;
  static bool calibrated=false;
  if(!calibrated) {
    idleSound=highVotes>samples/2;
    calibrated=true;
    Serial.print(F("Sound idle level: ")); Serial.println(idleSound);
  }
  bool sound=digitalRead(SOUND)!=idleSound;
  bool motion=pirReady && digitalRead(PIR)==HIGH;
  // Rising edges start finite alerts; a held sensor does not run the motor forever.
  if(sound && !lastSound && !soundAlert) {
    soundStart=now; soundAlert=true; Serial.println(F("Sound alert"));
  }
  if(motion && !lastMotion && !motionAlert) {
    motionStart=now; motionAlert=true; Serial.println(F("Motion alert"));
  }
  lastSound=sound; lastMotion=motion;
  if(soundAlert && now-soundStart>=ALERT) soundAlert=false;
  if(motionAlert && now-motionStart>=ALERT) motionAlert=false;
  // LEDs: one flash per second, independent for simultaneous events.
  digitalWrite(RED,soundAlert && (now-soundStart)%1000<500);
  digitalWrite(BLUE,motionAlert && (now-motionStart)%1000<500);
  // Sound: one long vibration. Motion: two shorter vibrations each 2-second cycle.
  unsigned long s=(now-soundStart)%2000, m=(now-motionStart)%2000;
  bool vibration=(soundAlert && s<800) || (motionAlert && (m<250 || (m>=500 && m<750)));
  digitalWrite(MOTOR,vibration);
  if(now-lastReport>=1000) {
    lastReport=now;
    Serial.print(F("AO(raw, not dB)=")); Serial.print(analogRead(A0));
    Serial.print(F(" DO=")); Serial.print(digitalRead(SOUND));
    Serial.print(F(" PIR=")); Serial.print(digitalRead(PIR));
    if(!pirReady) Serial.print(F(" warming up"));
    Serial.println();
  }
}

Remix this project

Make it yours in one click

Open a full copy of this project in your own Schematik workspace, diagram, code, parts, and assembly steps included. Swap the sensor, add features, or redesign the whole thing with AI. The author's original stays untouched.

Open in Schematik