0% found this document useful (0 votes)
22 views18 pages

Class 08 - REC-Basic Robotics

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

Class 08 - REC-Basic Robotics

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Basic 𝐑𝐨𝐛𝐨𝐭𝐢𝐜𝐬

– Robotics Engineering Certification

Let’s Start the Robotics Journey


Class 08-

Analog Sensors
What is
Analog
Sensor?
What is Analog Sensor?
Analog sensors in Arduino are devices
that measure continuous physical
quantities, such as temperature, light,
or pressure, and convert them into an
analog voltage signal.
What is Analog Sensor?
Analog sensors in Arduino are devices that measure continuous physical
quantities, such as temperature, light, or pressure, and convert them into an
analog voltage signal.
What is Analog Sensor?
Key Points about Analog Sensors in Arduino:
1. Analog Signals: Analog sensors produce a voltage that varies continuously depending
on the measured parameter.
2. Arduino Analog Pins: Most Arduino boards have analog input pins (A0–A5 on Arduino
Uno) that can read voltage levels from 0V to 5V (or 3.3V on some boards).
3. ADC (Analog-to-Digital Converter): Arduino converts the analog voltage into a digital
value (0 to 1023 for a 10-bit ADC) so it can be processed in software.
4. Common Analog Sensors:
○ Temperature Sensors (e.g., LM35, DHT11)
○ Light Sensors (e.g., LDR - Light Dependent Resistor)
○ Potentiometers (Variable Resistors)
○ Gas Sensors (e.g., MQ-2)
○ Force/Pressure Sensors (e.g., FSR - Force Sensitive Resistor)
Example: Reading an Analog Sensor in Arduino
analogRead(pin)
This function reads the voltage from an analog input pin (A0–A5 on Arduino Uno) and
converts it into a digital value (0–1023 for 10-bit ADC).

int sensorPin = A0; // Analog pin connected to the sensor


int sensorValue; // Variable to store the sensor reading
void setup() {
[Link](9600); // Start serial communication
}
void loop() {
sensorValue = analogRead(sensorPin); // Read the analog value
[Link](sensorValue); // Print the value to Serial Monitor
delay(500); // Wait for half a second
}
LDR (Light Dependent Resistor) in Arduino
An LDR (Light Dependent Resistor),
also called a photoresistor, is an analog
sensor that changes its resistance based
on light intensity. It is commonly used in
Arduino projects for automatic lighting,
light-following robots, and smart home
applications.
LDR (Light Dependent Resistor) in Arduino
How LDR Works

● In bright light, the resistance of the LDR decreases, allowing more current to pass.
● In darkness, the resistance of the LDR increases, reducing the current flow.
● Typically, an LDR is used with a voltage divider circuit to get a measurable voltage
output for the Arduino.
LDR (Light Dependent Resistor) in Arduino
LDR reading-
LDR (Light Dependent Resistor) in Arduino
How to Use LDR in a Project?
1. Automatic Light Control: Turn ON an LED when it's dark.
2. Light-Following Robot: Adjust robot movement based on light intensity.
3. Solar Tracking System: Position solar panels towards maximum sunlight.
LDR (Light Dependent Resistor) in Arduino
int ldr_pin=A0;
int sen_val;
int led_pin=7;
void setup() {
[Link](9600);
pinMode(led_pin,OUTPUT);
}

void loop() {
sen_val=analogRead(ldr_pin);
[Link](sen_val);
if(sen_val<300){
digitalWrite(led_pin,HIGH);
}
digitalWrite(led_pin,LOW);
}
IR Sensor (Infrared Sensor) in Arduino
An IR sensor (Infrared Sensor) is a
device that detects infrared radiation,
commonly used in motion detection,
object detection, and line-following
robots. It consists of an IR transmitter
(LED) and an IR receiver (photodiode
or phototransistor).
IR Sensor (Infrared Sensor) in Arduino
How an IR Sensor Works
● The IR LED emits infrared light.
● The IR receiver detects reflected IR light from an object.
● The sensor outputs a signal based on object presence:
○ HIGHER Value → No object detected
○ LOWER Value → Object detected (IR reflected)
IR Sensor (Infrared Sensor) in Arduino

Connecting an IR Sensor to Arduino

Pins of an IR Obstacle Sensor:

● VCC → 5V
● GND → Ground
● OUT → Analog Pin
IR Sensor (Infrared Sensor) in Arduino
Applications of IR Sensors

1. Object Detection (e.g., automatic doors, security systems)


2. Line Following Robots (detecting black and white surfaces)
3. Remote Controls (TV remotes use IR communication)
4. Motion Detection (PIR sensors for home security)
QnA

You might also like