22brs1044 Sensors
22brs1044 Sensors
BCS420P
SENSORS LAB
EXPERMENTS
SUBMISSION
WINTER SEMESTER (2023-2024)
Sayandeep Das
22BRS1044
Btech, CSE with specialization in AI and Robotics
22BRS1044
CONTENTS
S. TITLE OF
NO EXPERIMENT
1 ULTRASONIC SENSOR
2 SOIL MOISTURE
3 TEMPERATURE SENSOR
4 PULSE OXIMETER
5 OBSTACLE DETECTION
6 HUMIDITY SENSOR
7 INVERTING AMPLIFIER
9 SUMMING AMPLIFIER
10 DIFFERENTIAL AMPLIFIER
22BRS1044
EXPERIMENT-1
AIM: ULTRASONIC SENSOR
To build a circuit that measures distance using ultrasonic sensor.
COMPONENTS REQUIRED:
● Arduino UNO R3
● Wires
● Breadboard
CIRCUIT DIAGRAM:
Procedure:
1. Place an Arduino UNO on the tinnkercad workspace.
2. Connect the GND pin of the Ultrasonic Sensor to the GND pin of the Arduino, Connect the
VCC pin of the Ultrasonic Sensor to the 5V pin of the Arduino, Connect the Trig pin of the
Ultrasonic Sensor to digital pin of the Arduino, Connect the Echo pin of the Ultrasonic Sensor HC
SR04 to digital pin of the Arduino.
3. Write Arduino code to read the distance from the ultrasonic sensor.
4. Start the simulation in Tinkercad.
5. Observe the behavior of the LED, which will either light up or turn off based on the
distance measured by the ultrasonic sensor.
6. Monitor the serial monitor for distance readings.
Y.Rushik
22BRS1271
CODE:
OUTPUT:
RESULT:
Thus, we have successfully built a circuit using Ultrasonic Sensor that measures distance.
Y.Rushik
22BRS1271
EXPERIMENT – 2 SOIL
AIM: MOISTURE
To create a Soil Moisture Monitoring System with LED’s that indicate the amount of Soil Moisture.
APPARATUS REQUIRED:
● Arduino UNO R3
● LEDs
● Wires
● Breadboard (optional)
CIRCUIT DIAGRAM:
PROCEDURE:
1. Open the Tinkercad Software and make a new schematic
2. Take the Arduino UNO R3 and place it down
3. Take 3 LEDs of colors RED, YELLOW, and GREEN and place them down above
the Arduino
4. Now take a Soil Monitoring Sensor and place it in the schematic
5. Connect the components using wires
6. Go to the Code Section and Write the code given below
7. Run the Code and Check the Output in the Serial Monitor and the glow of LEDs.
CODE:
void setup(){
Serial.begin(9600);
void loop(){
int level;
level = analogRead(0);
Serial.print(levPerc);
Serial.println("%");
if(levPerc<=40){
digitalWrite(4,LOW);
digitalWrite(5,LOW);
digitalWrite(6,HIGH);
else if(levPerc<=70)
{ digitalWrite(4,LOW)
digitalWrite(5,HIGH);
digitalWrite(6,LOW);
}
else if(levPerc>70){
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
digitalWrite(6,LOW);
OUTPUT:
RESULT:
Thus, the soil monitoring experiment has been done successfully and the LED lights are made to blink
accordingly with respect to Moisture Level.
Y.Rushik
22BRS1271
EXPERIMENT – 3
AIM: TEMPERATURE SENSOR
To create a Temperature monitoring system with LED’s that indicate the temperature.
APPARATUS REQUIRED:
● Arduino UNO R3
● LEDs
● Wires
● Breadboard (optional)
CIRCUIT DIAGRAM:
PROCEDURE:
1. Procure the components and connect the resistors to the breadboard.
2. Connect the cathodes of LED’s(red, green, yellow) to GND.
3. Connect the cathodes of LED’s(red, green, yellow to digital pins 5,3,4 respectively in
the Arduino board
4. Connect the power pin of Temperature sensor to VCC of Arduino
5. Connect the GND pin to respective ground terminal of Arduino
6. Connect the Vout pin to Analog in A0.
7. Plug in the Arduino to the system.
8. After ensuring the correct COM port, compile and upload the code into the board
9. The respective LED will glow based on temperature measured.
CODE:
void setup()
{ Serial.begin(9600
Y.Rushik
22BRS1271
); pinMode(A0,
INPUT);
void loop(){
Y.Rushik
22BRS1271
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,LOW);
Serial.println(ans);
Serial.println((ans*9/5)+32);
if(ans<30)digitalWrite(3,HIGH);
else digitalWrite(5,HIGH);
delay(1000);
}
OUTPUT:
RESULT:
Thus, the temperature monitoring experiment has been done successfully and the LED lights are made
to blink accordingly with respect to Temperature Level.
Y.Rushik
22BRS1271
EXPERIMENT – 4 PULSE
AIM: OXIMETER
To measure heart rate using pulse oximeter and display it in serial monitor.
APPARATUS REQUIRED:
● Arduino Uno R3
● wires
CIRCUIT DIAGRAM:
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.
CODE:
void setup() {
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{ long pulse;
long sum = 0;
for (int i = 0; i < 20; i++)
sum += analogRead(A0);
pulse = sum / 220;
Serial.print("Pulse Rate: ");
Serial.println(pulse);
Y.Rushik
22BRS1271
delay(100);
}
OUTPUT:
RESULT:
The heart rate has been detected successfully with the pulse oximeter
Y.Rushik
22BRS1271
EXPERIMENT-5: OBSTACLE DETECTION
AIM:
To design and test a circuit that utilizes an ultrasonic sensor for obstacle detection.
COMPONENTS REQUIRED:
Arduino UNO R3
Jumper Wires
Ultrasonic Sensor HC-SR04
Breadboard
CIRCUIT DIAGRAM:
PROCEDURE:
Code:
#define trigPin 10 pin
#define echoPin 11
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);
distance = 0;
Serial.println(distance);
delay(100);
OUTPUT:
Y.Rushik
22BRS1271
RESULT:
The experiment successfully demonstrates the use of an ultrasonic sensor in conjunction with an
Arduino to detect obstacles.
Y.Rushik
22BRS1271
● Arduino UNO R3
● Jumper Wires
● DHT11 Sensor
● Breadboard
CIRCUIT DIAGRAM:
PROCEDURE:
CODE:
void setup(){
Serial.begin(9600);
pinMode(A1, INPUT);
}
void loop(){
RawValue = analogRead(analogIn);
Voltage = (RawValue / 1023.0) * 5000; // 5000 to get millivots.
tempC = (Voltage-500) * 0.1; // 500 is the offset
tempF = (tempC * 1.8) + 32; // convert to F
Serial.print("Raw Value = " );
Serial.print(RawValue);
Serial.print("\t milli volts = ");
Serial.print(Voltage,0); //
Serial.print("\t Temperature in C = ");
Serial.print(tempC,1);
Serial.print("\t Temperature in F = ");
Serial.println(tempF,1);
humiditysensorOutput = analogRead(A1);
Serial.print("Humidity: "); // Printing out Humidity Percentage
Serial.print(map(humiditysensorOutput, 0, 1023, 10, 70));
Serial.println("%");
}OUTPUT:
The serial monitor should display the measured relative humidity in percentage (%) at regular intervals
RESULT:
The experiment successfully demonstrates the use of a DHT11 sensor and an Arduino to measure
relative humidity in the environment.
Y.Rushik
22BRS1271
● Breadboard
● Jumper Wires
● Operational Amplifier (Op-Amp) IC 741
● Resistors (two of different values)
● Signal Generator (or alternative signal source)
● Oscilloscope
CIRCUIT DIAGRAM:
PROCEDURE:
1. Build the circuit on a breadboard using the components listed above and following the provided circuit
diagram. Ensure proper connections between the IC 741 pins, resistors, and signal source.
2. Connect the power supply to the circuit, ensuring the correct voltage polarities The recommended
voltage range for the IC 741 is typically ±15V, but it can vary depending on the specific model.
Double-check the datasheet for your IC.
3. Connect the signal generator to the inverting input of the IC 741 through Rin. You can adjust the signal
amplitude and frequency on the signal generator.
4. Connect the oscilloscope probe to the output of the circuit (pin 6) to observe the amplified signal.
5. By measuring the peak-to-peak voltages of the input and output signals on the oscilloscope, you can
calculate the voltage gain of the inverting amplifier using the formula: Gain = Vo / Vi (where Vo is the
output voltage and Vi is the input voltage).
OBSERVATIONS:
Y.Rushik
22BRS1271
● The oscilloscope should display an amplified replica of the input signal with an inverted polarity.
● The gain of the amplifier can be adjusted by varying the values of the feedback resistor (Rf) and the
input resistor (Rin). A larger Rf value results in a higher gain.
RESULT:
The experiment successfully demonstrates the design and functionality of an inverting amplifier using
the IC 741. The circuit amplifies the input signal with an inverted output, and the gain can be controlled
by the ratio of the feedback and input resistors.
● Breadboard
Y.Rushik
22BRS1271
● Jumper Wires
● Operational Amplifier (Op-Amp) IC 741
● Resistors (two of different values)
● Signal Generator (or alternative signal source)
● Oscilloscope
CIRCUIT DIAGRAM:
PROCEDURE:
o Build the circuit on a breadboard using the components listed above and following the provided
circuit diagram. Ensure proper connections between the IC 741 pins, resistors, and signal source.
o Connect the power supply to the circuit, ensuring the correct voltage polarities .The
recommended voltage range for the IC 741 is typically ±15V, but it can vary depending on the
specific model. Double-check the datasheet for your IC.
o Connect the signal generator to the non-inverting input of the IC 741 through Rin. You can
adjust the signal amplitude and frequency on the signal generator.
o Connect the oscilloscope probe to the output of the circuit to observe the amplified signal.
o By measuring the peak-to-peak voltages of the input and output signals on the oscilloscope, you
can calculate the voltage gain of the non-inverting amplifier using the formula: Gain = Vo / Vi
OBSERVATIONS:
● The oscilloscope should display an amplified replica of the input signal with the same polarity.
● The gain of the amplifier can be adjusted by varying the values of the feedback resistor (Rf) and the
input resistor (Rin). A larger Rf value results in a higher gain.
Y.Rushik
22BRS1271
RESULT:
The experiment successfully demonstrates the design and operation of a non-inverting amplifier using
the IC 741. The circuit amplifies the input signal while maintaining the same polarity at the output, and
the gain is controlled by the ratio of the feedback and input resistors.
● Breadboard
● Jumper Wires
● Operational Amplifier (Op-Amp) IC 741
● Resistors (multiple of equal value) - (quantity based on the number of inputs)
Y.Rushik
22BRS1271
● Signal Generators (or alternative signal sources) - (quantity based on the number of inputs)
● Oscilloscope
Circuit Diagram:
Procedure:
1. Build the circuit on a breadboard using the components listed above and following the provided circuit
diagram. Ensure proper connections between the IC 741 pins, resistors, and multiple signal sources .
2. Connect the power supply to the circuit, ensuring the correct voltage polarities Refer to the datasheet
for the recommended voltage range for the specific IC 741 model you are using.
3. Connect each signal generator to its corresponding input resistor connected to the inverting input of the
IC 741. You can adjust the amplitude and frequency of each signal independently.
4. Connect the oscilloscope probe to the output of the circuit to observe the summed and amplified signal.
Observations:
● The oscilloscope should display a combined waveform representing the sum of the individual input
signals.
● The relative amplitudes of the components in the summed output depend on the amplitudes and
frequencies of the original input signals.
● Adjusting the input signal amplitudes and frequencies will alter the summed output.
Results:
Y.Rushik
22BRS1271
The experiment successfully demonstrated the design and operation of a summing amplifier using the
IC 741. The circuit effectively combined and amplified multiple input signals into a single output, with
the weighting of each input controllable by the ratio of its input resistor to the feedback resistor.
● Breadboard
● Jumper Wires
● Operational Amplifier (Op-Amp) IC 741
● Resistors (two pairs of equal value)
● Signal Generators (or alternative signal sources) - 2
● Oscilloscope
Circuit Diagram:
Y.Rushik
22BRS1271
Procedure:
1. Build the circuit on a breadboard using the components listed above and following the provided circuit
diagram. Ensure proper connections between the IC 741 pins, resistors, and signal sources.
2. Connect the power supply to the circuit, ensuring the correct voltage .Refer to the datasheet for the
recommended voltage range for the specific IC 741 model you are using.
3. Connect each signal generator to its corresponding input resistor connected to the inverting and non-
inverting inputs of the IC 741. You can adjust the amplitude and frequency of each signal
independently.
4. Connect the oscilloscope probe to the output of the circuit to observe the amplified difference between
the input signals.
Observations:
● The oscilloscope should display an amplified waveform representing the difference between the two input
signals.
● If both input signals are identical the output should be minimal, demonstrating common-mode rejection.
Y.Rushik
22BRS1271
Results:
The experiment successfully demonstrated the design and operation of a differential amplifier using the IC
741. The circuit effectively amplified the difference between two input signals while rejecting any common-
mode signals present on both inputs.