Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
81 views

Electronics

This project report describes a clap sensor that controls a DC fan. It includes an introduction explaining the components used - an electret microphone, transistors, resistors, capacitors, an Arduino, relay, and DC fan. The methodology section describes how the microphone detects claps and the preamplifier circuit amplifies the sound. The Arduino code uses analog readings and a threshold to detect double claps within 1 second and toggle the relay to turn the fan on or off.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views

Electronics

This project report describes a clap sensor that controls a DC fan. It includes an introduction explaining the components used - an electret microphone, transistors, resistors, capacitors, an Arduino, relay, and DC fan. The methodology section describes how the microphone detects claps and the preamplifier circuit amplifies the sound. The Arduino code uses analog readings and a threshold to detect double claps within 1 second and toggle the relay to turn the fan on or off.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

PROJECT REPORT

ANALOG AND DIGITAL SYSTEM (UEE505)


TOPIC OF OUR PROJECT: CLAP SENSOR DC FAN

NAME OF STUDENTS: ROLL NUMBER:


SRINJAY BHATTACHARYA 101704123
SAKSHAM MAHAJAN 101704105
SIDDHARTH SINGH 101704120

SUBMITTED TO
Dr. VISHAL SRIVASTAVA

ELECTRICAL AND INSTRUMENTATION ENGINEERING


DEPARTMENT
THAPAR INSTIUTE OF ENGINEERING AND
TECHNOLOGY
(DEEMED UNIVERSITY)
PATIALA – 147001, PUNJAB

i
AKNOWLEDGEMENT

We take the opportunity to express our greatest gratitude and


deep regards towards our teacher Vishal sir for his kind
support, constant monitoring, thorough guidance and always
encouragement throughout the project. This has been a source
of constant motivation for the completion of the project. We
would also like to extend our greatest thanks to our friends,
lab in charge, lab assistant without them it wouldn’t have been
possible to complete the project. We are very grateful to
receive such kind of project and are looking forward for more
projects.

i
ABSTRACT

On a winter night, when we just become to lazy to get out of our


warm blanket, we do wander what if we could just clap our hands and
or make any such gestures to turn ON/OFF the bedroom light or
maybe the TV or any such device like that? Well this dream can be
made into reality as in this project using the simple knowledge of
Analog electronics and basic microcontroller based high end coding
devices like Arduino and then using it to control a switch without
involving any actual contact with it.

ii
LIST OF CONTENTS
NAME OF THE PAGE
TITLE NO.
Acknowledgment i
Abstract ii
Introduction 1
Components used 4
Methodology 4
Schematic Diagram 9
Result and discussion 12
Future use 13
References 14

iii
INTRODUCTION

An electret microphone is a type of electret (capacitor) based microphone that


converts sound energy to electrical energy. It is a low cost microphone that
can be found in every cellphone, laptop, camera, and so on. The main
component of the circuit is the electret microphone and it is used as the sound
sensor.
The transistor Q1 is in collector feedback bias, whose configuration is
explained as follows:-
This self biasing collector feedback
configuration is another beta dependent
biasing method that requires only two
resistors to provide the necessary DC
bias for the transistor. The collector to
base feedback configuration ensures
that the transistor is always biased in
the active region regardless of the value
of Beta (β) as the DC base bias voltage
is derived from the collector
voltage, VC providing good stability.
Fig1:- Collector Feedback Biasing
In this circuit, the base bias resistor, RB is connected to the transistors
collector C, instead of to the supply voltage rail, Vcc. Now if the collector
current increases, the collector voltage drops, reducing the base drive and
thereby automatically reducing the collector current to keep the transistors Q-
point fixed. Then this method of collector feedback biasing produces negative
feedback as there is feedback from the output to the input through resistor, RB.
The biasing voltage is derived from the voltage drop across the load resistor, RL.
So if the load current increases there will be a larger voltage drop across RL, and
a corresponding reduced collector voltage, VC which will cause a corresponding
drop in the base current, IB which in turn, brings IC back to normal.
The opposite reaction will also occur when transistors collector current becomes
less. Then this method of biasing is called self-biasing with the transistors
stability using this type of feedback bias network being generally good for most
amplifier designs.
A Low Pass Filter is a circuit that can be designed to modify, reshape or reject
all unwanted high frequencies of an electrical signal and accept or pass only
those signals wanted by the circuits designer

1
In other words they “filter-out” unwanted signals and an ideal filter will
separate and pass sinusoidal input signals based upon their frequency. In low
frequency applications (up to 100kHz), passive filters are generally constructed
using simple RC (Resistor-Capacitor) networks, while higher frequency filters
(above 100kHz) are usually made from RLC(Resistor-Inductor-Capacitor)
components. The low pass filter thus only allows low frequency signals from
0Hz to its cut-off frequency, ƒc point to pass while blocking those any higher.

Fig 2:- Passive Low Pass Filter

A relay is an electrically operated switch. Current flowing through the coil of


the relay creates a magnetic field which attracts a lever and changes the switch
contacts. The coil current can be on or off so relays have two switch positions
and most have double throw(changeover) switch contacts as shown in the
diagram.

Fig 3:- Circuit Symbol of a Relay


Arduino is an open-source hardware and software company, project and user
community that designs and manufactures single-board
microcontrollers and microcontroller kits for building digital devices and
interactive objects that can sense and control both physically and digitally. Its
products are licensed under the GNU Lesser General Public License (LGPL) or
the GNU General Public License (GPL),[1] permitting the manufacture of

2
Arduino boards and software distribution by anyone. Arduino boards are
available commercially in preassembled form or as do-it-yourself (DIY) kits.

Fig 4:- Arduino UNO

These electronic elements will be used to construct the clap based switch
involving of a preamplifier microphone which acts as an input to the Arduino
and a relay based switch which is connected to its output to turn ON/OFF the
DC fan.

3
COMPONENTS USED
 1 x Arduino UNO
 1 x Electret Microphone
 2 x 2N3904 NPN BJT Transistor
 1 x SPDT 12V Coil Relay
 1 x 100R 1/4W Resistor
 1 x 330R 1/4W Resistor
 2 x 1K 1/4W Resistor
 2 x 10K 1/4W Resistor
 1 x 100K 1/4W Resistor
 2 x 100nF Capacitor
 1 x 1N4007 Diode
 1 x 5mm Green LED
 1 x 5mm Yellow LED
 1 x SPST Tact Switch
 Jumper Wires
 Perf-board

METHODOLOGY

The electret microphone is connected to the preamplifier stage built around


the Q1 transistor in collector feedback biasing which amplifies the input
signal coming from the microphone and is connected through a low pass filter
to eliminate unwanted noise. The amplified signal is applied to the A0 analog
input of the Arduino. We can easily read this analog input and monitor the
behaviour of the signal during the claps by using the sketch code below.

void setup()
{
Serial.begin(9600);
}

4
void loop()
{
int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);
}

On the serial plotter of the Arduino IDE , we can get the graph. Here you can
see what the audio signal looks like during the clap test:

You can see that the DC offset of the audio signal is about 175-180 units. The
peaks generated by the claps can go up to 185-190 units. The main purpose of
the Arduino code is detect these peaks and activate the relay when a double clap
is sensed.

Fig. 5: The testing waveform in the preamplifier circuit

5
Fig. 6: The preamplifier circuit built on breadboard for testing

Actually, sensing any double clap is not enough for the desired clap operation.
The interval between the two claps is also important. A timeout procedure is
applied in the code and a clap is discarded if it is not followed by another clap
in 1000ms.
A tact switch is used to adjust the threshold level of the clap action that will
be detected. There are three different threshold levels and the yellow LED
brightness changes depending on the selected level. The LED gets brighter
when the sensitivity gets higher.
When the software detects the double clap, it toggles the P1.1 output which
drives a green LED and a relay through a relay driver. The green LED
indicates the output status. The relay driver circuit based on the Q2 transistor
is required since the output pin current rating of the Arduino is limited to
6mA and not capable to drive the relay coil. A 1N4007 diode is placed
between the coil terminals to prevent the back EMF.

6
The Software
The software of the application is built in Arduino IDE and it is provided
below. The Arduino sketch includes comments to clarify each step.

CODE:

unsigned long int timestamp;


int sensitivity=182;
int P1_1=1, P1_2=2, P1_3=3;

void setup()
{
//Serial.begin(9600);

// Set the pin modes


pinMode(P1_1, OUTPUT);
pinMode(P1_2, OUTPUT);
pinMode(P1_3, INPUT_PULLUP);
digitalWrite(P1_1, LOW);
analogWrite(P1_2, 150);
}

void loop()
{
/*int sensorValue = analogRead(A0);
// print out the value you read:
Serial.println(sensorValue);*/

7
// Detect the first clap sound
if (analogRead(A0) > sensitivity) {

delay(100);
timestamp = millis();

do {
// Detect the second clap sound
if (analogRead(A0) > sensitivity) {
digitalWrite(P1_1, !digitalRead(P1_1));
delay(100);
break; // Second clap is detected, break the while loop
}

//Discard the first clap if the second clap is not received in 500ms
while(millis() < (timestamp + 1000));

// If the sensitivity buton is pressed, change the sensitivity level


if (!digitalRead(P1_3)) {

if (sensitivity == 185) {
sensitivity = 182;
analogWrite(P1_2, 150);
}

8
else if (sensitivity == 182) {
sensitivity = 180;
analogWrite(P1_2, 250);
}
else if (sensitivity == 180) {
sensitivity = 185;
analogWrite(P1_2, 50);
}
delay(500);} }

Schematic diagram

Fig. 7– Circuit Diagram of Sound Activated Switch.

9
Project Images

Fig 8:- Finished pre-amplifier circuit with Arduino UNO

10
Figs 9,10:- Relay based DC Fan switch circuit

11
RESULT AND DISCUSSION

Whenever 2 successive clap sounds are made with a gap less than
1000 ms, we can observe from the Serial Plotter that the average
spikes that go during the clapping sounds is around 180-185. This
value may go up and down depending on the selection of microphone
and the background. Now the Arduino code is adjusted such that if
two successive spikes of value more than 182 is received by the
arduino at a time difference of 1000 mS, then the nature of the switch
is inverted, i.e. it is switched “ON” if it was originally “OFF” and
vice-versa. Now through the relay based switch, the circuit
comprising of BJT as a switch through the coil of the 12 V relay gets
closed when the Arduino returns “ON” and this in turn shifts the
moveable contact to short the Normally Open(NO) coil instead of the
Normally Closed(NC) coil which is connected to the supply of the DC
Fan making it on. The same gets inverted when the Arduino returns
“OFF”. The Relay is used here to avoid direct contact of 12 V load
with Arduino pins to protect the device.
This project has thus helped to know about the working of electret
microphone and how to use it to operate a 12 V DC fan using dual
clapping sound via a microcontroller device like Arduino.

12
FUTURE USE AND SCOPE

The range of the circuit can be extended over a large distance using a
required set of radio frequency transmitter and reciever to wirelessly
control electrical devices like fan,lights etc.

One can create additional functions like varying the speed of a


fan,intensity of a light or maybe varying the volume of a music
system via certain combinations of claps.

The circuit can also be used as a means to communicate in a special


language where the sound of clapping and other such patterns of
sounds can relate to various secretive codes that can be transmitted
and receive by systems for confidential and sensitive communications
like that in the army and intelligence.

13
REFERENCES

[1] ALL About Electronics, (2018, Dec.) Working of Sound activated


Switch[online].Available:https://www.allaboutcircuits.com/projects/m
ake-your-sound-activated-switch[Accessed April.20,2019].
[2] Robert L. Boylestad, Louis Nashelsky,
Electronic Devices and Circuit Theory.

[3] "Arduino - BareMinimum". www.arduino.cc. Retrieved 20


February 2018.

[4] Electronics Tutorials,(2018, Aug.) Collector Feedback Biasing a


Transistor[online].Available:https://www.electronics-
tutorials.ws/amplifier/transistor-biasing.html[Accessed April.20,2019].

14

You might also like