0% found this document useful (0 votes)
16 views5 pages

نسخة LAB - Cover Page - 4

Uploaded by

hosam.amjad.oran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views5 pages

نسخة LAB - Cover Page - 4

Uploaded by

hosam.amjad.oran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Tafila Technical University

College of Engineering
Department of Computer and Communication Engineering
Real-Time and Embedded Systems (0107445)

LAB Lab 4
Title Interfacing Digital Sensor
Student Name Hosam Amjad Oran
Student ID Number 320190112015

Page 1

Objective
EXP 1:

The main objective of this experiment is to read the digital sensor (PIR) value and
display the sensor value in serial monitor.

EXp 2:

The main objective of this experiment is to read the analogue sensor value and
Turn on Buzzer if digital sensor value is HIGH.

Apparatus
EXP 1:
 Arduino Uno development board
 USB cable
 Digital PIR
 Bread board
 Jumber wires

EXP 2:
 Arduino Uno development board
 USB cable
 Digital PIR
 Bread board
 Jumber wires
 Buzzer

Block Diagram / Circuit Schematics


Program Code

EXP 1:

// digital pin 2 has a pirSensor attached to it. Give it a name:


int pirSensor = 2;
//const int ledPin = 13; // pin that the LED is attached to
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pirSensor's pin an input:
pinMode(pirSensor, INPUT);
//pinMode(ledPin, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int pirSensorState = digitalRead(pirSensor);
// print out the state of the button:
Serial.print("PIR Sensor value = ");
Serial.println(pirSensorState);
delay(500); // delay in between reads for stability
}

EXP 2:

// digital pin 2 has a pirSensor attached to it. Give it a name:


const int pirSensor = 2;
const int buzzer = 4;
// the setup routine runs once when you press reset:
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
// make the pirSensor's pin an input:
pinMode(pirSensor, INPUT);
pinMode(buzzer, OUTPUT);
}
// the loop routine runs over and over again forever:
void loop() {
// read the input pin:
int pirSensorState = digitalRead(pirSensor);
// print out the state of the button:
Serial.print("PIR Sensor value = ");
Serial.println(pirSensorState);
if(pirSensorState == 1)
digitalWrite(buzzer,HIGH);
else
digitalWrite(buzzer,LOW);
delay(300); // delay in between reads for stability
}

Theory / Calculations/ Plots

No theory or calculations

Observation / Data / System under Test

EXP 1:

When I connected the circuit , any small movement in front of the PIR the build in
LED will light.

EXP 2:

When I connected the circuit , any small movement in front of the PIR the buzzer
will be high and make a sound.

Discussion / results

EXP 1:
EXP 2:
Conclusion and recommendations

 Using this circuit , we can use it for detecting movments like door shops
or elivators.
 We can take binary reading 1 if there is a movement and 0 if there is no
movement.

Attachments & References

Page 2

You might also like