This week's assignment is about Input Devices. Since my PCB fabrication is not yet completed, I am using an Arduino UNO to complete this week's work.
Learning Objectives
๐ฅ Group Assignment
Probe an input device(s)'s analog levels and digital signals.
๐ค Individual Assignment
Measure something: add a sensor to a microcontroller board that you have designed and read it.
Learning highlights
Noise Alarm System
1 Introduction
๐ก1.1 Sound Sensor
A sound sensor is a component that receives sound waves and converts them into electrical signals. It works like a microphone to detect the sound intensity in the surrounding environment. It has various applications, such as noise monitoring, voice control, and security alarms.
Component
๐Sound Sensor Pins
Pin
Function
A0
Analog Output (Range 0~1023)
VCC
Power Input (5V)
G
Ground
๐ก1.2 Buzzer
A buzzer is an audio signaling device that can be controlled by electrical signals to produce sounds of different frequencies and intensities. It is commonly used for alarms, notifications, and sound feedback applications.
๐Passive Buzzer Pins
Pin
Function
VCC
Power Inpuy (5V)
I\O
Connected to D9 via tone() control
GND
Ground
๐Active Buzzer & Passive Buzzer
Feature
Active Buzzer
Passive Buzzer
Internal Oscillator
โ Built-in Oscillator
โ Requires PWM
Control Method
Simply turn on/off with HIGH/LOW signal
Requires PWM signal for sound generation. Requires tone()
Upload the code and test it by monitoring sound intensity in the Serial Monitor.
๐ Buzzer signal is unstable
Issue
Cause
Solution
Buzzer keeps beeping
Threshold too low or sensor too sensitive
Adjust threshold (e.g., set to 400)
No sound from buzzer
Sound level below threshold
Increase sound source or lower threshold
Unstable sensor values
Connection issue or noise interference
Check wiring and minimize interference
โ๏ธBuzzer Keeps Beeping
Issue
Possible Cause
Solution
Buzzing too frequently
Sound sensor threshold too low
Increase the threshold value in the code.
Incorrect buzzer type usage
Using passive buzzer with digitalWrite(HIGH)
Use tone(BUZZER_PIN, frequency) for passive buzzers.
Incorrect wiring
Incorrect VCC or GND connection
Verify the buzzerโs VCC and GND connections to Arduino.
Unstable sensor values
Connection issue or noise interference
Check wiring and minimize interference
6 Conclusion
This project demonstrates a sound-based alarm system. When sound intensity exceeds a set threshold, the buzzer activates. Adjusting the threshold and frequency can optimize performance for noise monitoring and smart classroom applications.