Co2 QB
Co2 QB
5. Describe the Pin Structure and list the advantages & disadvantages
of LDR.
Working Principle:
Construction:
1. IR detector (photodiode or thermopile)
2. Optical filter (blocks visible light)
3. Amplifier (boosts signal)
Working Principle:
1. IR radiation from objects/environments reaches sensor.
2. Detector converts IR radiation into electrical signal.
3. Amplifier boosts signal for processing.
Applications:
1.motion detection.
2.object detection.
8. Describe the Pin diagram of IR sensor
A.
sensitivity).
11. Provide a detailed explanation of how an ultrasonic sensor
measures distance.
• A. An ultrasonic sensor is an instrument that measures the
distance to an object using ultrasonic sound waves.
• An ultrasonic sensor uses a transducer to send and receive
ultrasonic pulses that relay back information about an object’s
proximity.
• High-frequency sound waves reflect from boundaries to produce
distinct echo patterns.
}
void loop()
{
int baselineTemp = 30;
int sensor_data = analogRead(A0);
float voltage = sensor_data * (5.0 / 1024.0);
float celsius = (voltage - 0.5) * 100;
float fahrenheit = ((celsius*9) / 5 + 32);
Serial.print(celsius);
Serial.print(" C, ");
Serial.print(fahrenheit);
Serial.println(" F");
}
2. Develop an Arduino code that reads data from a temperature
sensor (LM35) indicates that through 2 LED's with the help of a
threshold value.
void setup()
{
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{
int baselineTemp = 30;
int sensor_data = analogRead(A0);
float voltage = sensor_data * (5.0 / 1024.0);
float celsius = (voltage - 0.5) * 100;
float fahrenheit = ((celsius*9) / 5 + 32);
Serial.print(celsius);
Serial.print(" C, ");
Serial.print(fahrenheit);
Serial.println(" F");
}
3. Create an Arduino program that reads data from a gas sensor and
sounds a buzzer if the gas concentration exceeds a certain
threshold.
3.int gasval = 0;
void setup()
{
pinMode (9,OUTPUT);
pinMode (A0,INPUT);
Serial.begin(9600);
}
void loop()
{
gasval = analogRead (A0);
Serial.print("Gas Value::");
Serial.println(gasval);
if (gasval <200 )
{
digitalWrite (9, LOW); // (or) noTone(9);
}
else
{
digitalWrite(9, HIGH); // (or) tone(9,500);
}
delay(1000);
}
4. Create an Arduino sketch that reads data from an LDR and turns
on an LED if the light intensity falls below a certain threshold.
5.const int ledpin = 11; // digital pin 11
const int ldrpin = A0; // analog pin 0 void setup()
{
Serial.begin(9600);
pinMode(ledpin, OUTPUT);
pinMode(ldrpin, INPUT);
}
void loop()
{
int ldrstatus = analogRead(ldrpin);
if (ldrstatus <= 300)
{
digitalWrite(ledpin, HIGH);
}
else
{
digitalWrite(ledpin, LOW);
}
delay(1000)
5. Provide an Arduino code to display the darkness/sufficient light
message on serial monitor using LDR for measuring of light
intensity.
5.const int ldrpin = A0; // analog pin 0 void setup()
{
Serial.begin(9600);
pinMode(ldrpin, INPUT);
}
void loop()
{
int ldrstatus = analogRead(ldrpin);
if (ldrstatus <= 300)
{
Serial.print("Darkness over here, turn on the LED:");
Serial.println(ldrstatus);
}
else
{
Serial.print("There is sufficient light , turn off the LED : ");
Serial.println(ldrstatus);
}
delay(1000);
6. Develop an Arduino code that interfaces with a gas sensor to
measure the concentration of a specific gas and displays it on the
serial monitor.
const int gasSensorPin = A0;
void setup() {
Serial.begin(9600);
}
void loop() {
int gasValue = analogRead(gasSensorPin);
delay(1000);
}