22BRS1269 Lab Report
22BRS1269 Lab Report
BCSE303E SENSORS
LAB
EXPERIMENTS
SUBMISSION
FALL SEMESTER (2024)
CONTENTS
S. TITLE OF PAGE
NO EXPERIMENT NO:
1 TEMPERATURE SENSOR 3
2 ULTRASONIC SENSOR 7
3 DHT 11 10
4 IR SENSOR 13
5 SOIL MISTURE SENSOR 16
6 PROXIMITY SENSOR 19
7 PULSE OXIMETER 22
8 INVERTING AMPLIFIER 25
9 NON-INVERTING AMPLIFIER 27
10 SUMMING AMPLIFIER 30
11 DIFFERENTIAL AMPLIFIER 32
B Yaswanth 22BRS1269
AIM: To measure the temperature using tmp36 and display it on the serial
monitor.
MATERIALS REQUIRED:
1. Arduino Uno R3
2. TMP 36 Sensor
3. Wires
4. Bread Board
PROCEDURE:
Setup Breadboard: Place the Arduino Uno R3 and the TMP36 sensor on the
breadboard. Connect the components as follows:
Connect the left pin of the TMP36 sensor to the 5V pin on the Arduino Uno.
Connect the middle pin of the TMP36 sensor to the analog pin A0 on the
Arduino Uno.
Connect the right pin of the TMP36 sensor to the GND pin on the Arduino Uno.
Connect to Computer: Connect the Arduino Uno to your computer using a USB
cable.
Open Arduino IDE: Open the Arduino IDE on your computer.
Write the Code: Write the following code in the Arduino IDE:
const int tempPin = A0;
void setup() {
Serial.begin(9600);
}
B Yaswanth 22BRS1269
void loop() {
int sensorValue = analogRead(tempPin);
float voltage = sensorValue * (5.0 / 1023.0);
float temperatureC = (voltage - 0.5) * 100.0;
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" °C");
delay(1000);
}
Upload the Code: Upload the code to the Arduino Uno by clicking on the
"Upload" button in the Arduino IDE.
Open Serial Monitor: Once the code is uploaded, open the Serial Monitor in the
Arduino IDE by clicking on "Tools" > "Serial Monitor" or by pressing
Ctrl+Shift+M.
View Temperature Readings: You should now see the temperature readings
displayed in the Serial Monitor. The readings will be updated every second.
B Yaswanth 22BRS1269
B Yaswanth 22BRS1269
RESULT:
The temperature has been detected successfully by the tmp36 sensor.
B Yaswanth 22BRS1269
AIM: To measure the distance using a ultrasonic sensor and display it on the
serial monitor.
MATERIALS REQUIRED:
1. Arduino Uno R3
2. HC-SR04 Ultrasonic Sensor
3. Jumper Wires
4. Breadboard
PROCEDURE:
Setup Breadboard: Place the Arduino Uno R3 and the HC-SR04 sensor on the
breadboard. Connect the components as follows:
Connect the VCC pin of the HC-SR04 sensor to the 5V pin on the Arduino Uno.
Connect the GND pin of the HC-SR04 sensor to the GND pin on the Arduino
Uno.
Connect the TRIG pin of the HC-SR04 sensor to digital pin 2 on the Arduino
Uno.
Connect the ECHO pin of the HC-SR04 sensor to digital pin 3 on the Arduino
Uno.
Connect to Computer: Connect the Arduino Uno to your computer using a USB
cable.
Open Arduino IDE: Open the Arduino IDE on your computer.
Write the Code: Write the following code in the Arduino IDE:
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
}
void loop() {
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(100);
}
Upload the Code: Upload the code to the Arduino Uno by clicking on the
"Upload" button in the Arduino IDE.
B Yaswanth 22BRS1269
Open Serial Monitor: Once the code is uploaded, open the Serial Monitor in the
Arduino IDE by clicking on "Tools" > "Serial Monitor" or by pressing
Ctrl+Shift+M.
View Distance Readings: You should now see the distance readings displayed in
the Serial Monitor. The readings will be updated continuously.
RESULT:
The distance has been measured successfully by the ultrasonic sensor.
B Yaswanth 22BRS1269
AIM: To measure the temperature using a dht11 sensor and display it on the
serial monitor.
MATERIALS REQUIRED:
1. Arduino Uno R3
2. DHT11 Temperature and Humidity Sensor
3. Jumper Wires
4. Breadboard
PROCEDURE:
Setup Breadboard: Place the Arduino Uno R3 and the DHT11 sensor on the
breadboard. Connect the components as follows:
Connect the positive (VCC) pin of the DHT11 sensor to the 5V pin on the
Arduino Uno.
Connect the negative (GND) pin of the DHT11 sensor to the GND pin on the
Arduino Uno.
Connect the data pin of the DHT11 sensor to digital pin 2 on the Arduino Uno.
Connect to Computer: Connect the Arduino Uno to your computer using a USB
cable.
Install DHT Library: Before writing the code, you need to install the DHT
library. Open the Arduino IDE, go to "Sketch" > "Include Library" > "Manage
Libraries...", then search for "DHT" and install the library named "DHT sensor
library by Adafruit".
Open Arduino IDE: Open the Arduino IDE on your computer.
Write the Code: Write the following code in the Arduino IDE:
#include <DHT.h>
#define DHTPIN 2
B Yaswanth 22BRS1269
void setup() {
Serial.begin(9600);
dht.begin();
}
void loop() {
delay(2000);
if (isnan(humidity) || isnan(temperatureC)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Humidity: ");
Serial.print(humidity);
Serial.print(" %\t");
Serial.print("Temperature: ");
Serial.print(temperatureC);
Serial.println(" °C");
}
B Yaswanth 22BRS1269
Upload the Code: Upload the code to the Arduino Uno by clicking on the
"Upload" button in the Arduino IDE.
Open Serial Monitor: Once the code is uploaded, open the Serial Monitor in the
Arduino IDE by clicking on "Tools" > "Serial Monitor" or by pressing
Ctrl+Shift+M.
View Sensor Readings: You should now see the temperature and humidity
readings displayed in the Serial Monitor. The readings will be updated every 2
seconds.
RESULT:
AIM: To detect any obstacle using an IR sensor and display it in serial monitor
MATERIALS REQUIRED:
5. Arduino Uno R3
6. IR Sensor
7. Wires
PROCEDURE:
1. Take the Components Arduino UNO R3, IR sensor and connect
them using wires
2. Use a USB 2.0 Cable Type A and connect the Arduino board to the
Computer
3. Open the Arduino software and write the code given below
4. Make sure the correct COM port is selected by checking with the
device manager
5. Upload the code to Arduino
6. Run and open the Serial Monitor to check Output.
CODE:
B Yaswanth 22BRS1269
void setup() {
pinMode(LED, OUTPUT);
pinMode(irPin, INPUT);
Serial.begin(9600);
void loop() {
sensorOut = digitalRead(irPin);
if (sensorOut == LOW)
digitalWrite(LED, HIGH);
}
B Yaswanth 22BRS1269
else
Serial.println("No Obstacle");
digitalWrite(LED, LOW);
delay(200);
OUTPUT:
B Yaswanth 22BRS1269
RESULT:
The Obstacle has been detected successfully by the IR sensor.
B Yaswanth 22BRS1269
AIM: To measure moisture of soil using soil moisture sensor and display it in
serial monitor
MATERIALS REQUIRED:
1) Arduino Uno R3
2) Soil Moisture Sensor
3) Wires
PROCEDURE:
1) Take the Components Arduino UNO R3, Soil Moisture Sensor and
connect them using wires
2) Use a USB 2.0 Cable Type A and connect the Arduino board to the
Computer
3) Open the Arduino software and write the code given below
4) Make sure the correct COM port is selected by checking with the
device manager
5) Upload the code to Arduino
6) Run and open the Serial Monitor to check Output.
CODE:
const int moistureSensorPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int moistureValue = analogRead(moistureSensorPin);
int moisturePercentage = map(moistureValue, 0, 1023, 0, 100);
B Yaswanth 22BRS1269
RESULT:
The Moisture of the soil has been detected successfully by the soil
moisture sensor.
B Yaswanth 22BRS1269
MATERIALS REQUIRED:
1. Arduino Uno R3
2. Proximity Sensor
3. Wires
PROCEDURE:
1) Take the Components Arduino UNO R3, Soil Moisture Sensor and
connect them using wires
2) Use a USB 2.0 Cable Type A and connect the Arduino board to the
Computer
3) Open the Arduino software and write the code given below
4) Make sure the correct COM port is selected by checking with the
device manager
5) Upload the code to Arduino
6) Run and open the Serial Monitor to check Output.
CODE:
const int trigPin = 9;
const int echoPin = 10;
void setup() {
Serial.begin(9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
B Yaswanth 22BRS1269
void loop() {
long duration;
int distance;
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(" cm");
delay(1000);
}
B Yaswanth 22BRS1269
RESULT:
The proximity has been detected successfully by the proximity sensor.
B Yaswanth 22BRS1269
AIM: To measure heart rate using pulse oximeter and display it in serial
monitor
MATERIALS REQUIRED:
1. Arduino Uno R3
2. Pulse Sensor
3. Wires
PROCEDURE:
1) Take the Components Arduino UNO R3, Pulse Oximeter and
connect them using wires
2) Use a USB 2.0 Cable Type A and connect the Arduino board to the
Computer
3) Open the Arduino software and write the code given below
4) Make sure the correct COM port is selected by checking with the
device manager
5) Upload the code to Arduino
6) Run and open the Serial Monitor to check Output.
B Yaswanth 22BRS1269
CODE:
void setup() {
Serial.begin(9600);
OUTPUT:
RESULT:
The Heartrate has been detected successfully by the pulse sensor.
B Yaswanth 22BRS1269
MATERIALS REQUIRED:
1. Power Supply
2. Multimeter
3. opAmp
4. Breadboard
5. Wires
CIRCUIT DIAGRAM:
PROCEDURE:
1. Build the circuit as given in the circuit diagram
2. Adjust the voltage value and take the readings
B Yaswanth 22BRS1269
OUTPUT:
RESULT:
Thus an Inverting amplifier has been built and the output has been
verified
B Yaswanth 22BRS1269
MATERIALS REQUIRED:
1. Power Supply
2. Multimeter
3. opAmp
4. Breadboard
5. Wires
CIRCUIT DIAGRAM:
B Yaswanth 22BRS1269
PROCEDURE:
1) Build the circuit as given in the circuit diagram
2) Adjust the voltage value and take the readings
OUTPUT:
B Yaswanth 22BRS1269
RESULT:
Thus a Non Inverting amplifier has been built and the output has been
verified
B Yaswanth 22BRS1269
MATERIALS REQUIRED:
1. Power Supply
2. Multimeter
3. OpAmp
4. Breadboard
5. Wires
CIRCUIT DIAGRAM:
PROCEDURE:
1. Build the circuit as given in the circuit diagram
2. Adjust the voltage value and take the readings
B Yaswanth 22BRS1269
OUTPUT:
RESULT:
Thus a Summing amplifier has been built and the output has been
verified
B Yaswanth 22BRS1269
MATERIALS REQUIRED:
1. Power Supply
2. Multimeter
3. Dual Timer
4. Breadboard
5. Wires
CIRCUIT DIAGRAM:
PROCEDURE:
1. Build the circuit as given in the circuit diagram
2. Adjust the voltage value and take the readings
B Yaswanth 22BRS1269
OUTPUT:
RESULT:
Thus a differential amplifier has been built and the output has been
verified