0% found this document useful (0 votes)
45 views4 pages

Dec50122 Embedded Robotics - Pw2 (Procedure)

Dec50122,Embedded Robotics pw2,Politeknik Seberang Perai (PSP)

Uploaded by

JustShareIt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
0% found this document useful (0 votes)
45 views4 pages

Dec50122 Embedded Robotics - Pw2 (Procedure)

Dec50122,Embedded Robotics pw2,Politeknik Seberang Perai (PSP)

Uploaded by

JustShareIt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
You are on page 1/ 4

ELECTRICAL ENGINEERING

SESSION 1 2023/2024

DEC50122 – EMBEDDED ROBOTIC

PRACTICAL WORK 2 : LIGHT & TEMPERATURE SENSOR

PRACTICAL WORK DATE :

LECTURER’S NAME:

GROUP NO. :
1 LEARNING OUTCOMES (LO):

a) CLO3: manipulate the application of sensor and actuator, robot identification and
communication during practical work based on land mobile robot design (P4, PLO5)

2 OBJECTIVE

At the ends of this session, students should able to

a) Describe the basic functioning of the “standard” Arduino microcontroller board


b) Configure the Arduino IDE to communicate with the Arduino hardware
c) Use the Arduino IDE to load, compile, download and execute programs
d) Apply temperature sensor and LDR Sensor in robotic application

3 THEORY

TEMPERATURE SENSOR -

A temperature sensor is an electronic device that measures the temperature of its environment
and converts the input data into electronic data to record, monitor, or signal temperature
changes. There are many different types of temperature sensors. Some temperature sensors
require direct contact with the physical object that is being monitored (contact temperature
sensors), while others indirectly measure the temperature of an object (non-contact
temperature sensors).

⮚ Contact Temperature Sensor Types – These types of temperature sensor are required
to be in physical contact with the object being sensed and use conduction to monitor
changes in temperature. They can be used to detect solids, liquids or gases over a wide
range of temperatures.
⮚ Non-contact Temperature Sensor Types – These types of temperature sensor use
convection and radiation to monitor changes in temperature. They can be used to
detect liquids and gases that emit radiant energy as heat rises and cold settles to the
bottom in convection currents or detect the radiant energy being transmitted from an
object in the form of infra-red radiation (the sun).

The TMP36 temperature sensor is an easy way to measure temperature using an Arduino!
The sensor can measure a fairly wide range of temperature (-50°C to 125°C), is fairly precise
(0.1°C resolution), and is very low cost, making it a popular choice. In this tutorial we will go
over the basics of hooking the TMP36 up and writing some basic code to read the analog
input it is connected to.

How It Works:

Unlike a thermistor, the TMP36 does not have a temperature sensitive resistor. Instead this
sensor uses the property of diodes; as a diode changes temperature the voltage changes with
it at a known rate. The sensor measures the small change and outputs an analog voltage
between 0 and 1.75VDC based on it. To get the temperature we just need to measure the
output voltage

LIGHT SENSOR

A Light Sensor generates an output signal indicating the intensity of light by measuring the
radiant energy that exists in a very narrow range of frequencies basically called “light”, and
which ranges in frequency from “Infra-red” to “Visible” up to “Ultraviolet” light spectrum. The
light sensor is a passive devices that convert this “light energy” whether visible or in the infra-
red parts of the spectrum into an electrical signal output. Light sensors are more commonly
known as “Photoelectric Devices” or “Photo Sensors” because the convert light energy (photons)
into electricity (electrons).

LDR is a low-cost digital sensor as well as analog sensor module, which is capable to measure
and detect light intensity. This sensor also is known as the Photoresistor sensor.

5 PROCEDURE

TASK 1: TMP36 Temperature Sensor

a) Connect the circuit as shown below.

Schematic Diagram
b) Then, write the following code and compile and observe the result.

int sensorPin = A0;


int sensorInput;
double temp;

void setup()
{
Serial.begin(9600);
}

void loop()
{
sensorInput = analogRead(sensorPin);
//find percentage of input reading
temp = (double)sensorInput / 1024;

//multiply by 5V to get voltage


temp = temp * 5;

//Subtract the offset


temp = temp - 0.5;

//Convert to degrees
temp = temp * 100;

Serial.print("Current Temperature: ");


Serial.println(temp);
delay(1000);
}

TASK 2 : LIGHT DEPENDENT RESISTOR (LDR)

a) Build the circuit according to the circuit below.


c) Write the code, compile and observe the result
int ldrPin = 0;
int ledPin= 12;
int value = 0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(ldrPin, INPUT);
Serial.begin(9600);
}

void loop()
{
int value = analogRead(ldrPin);
if(value<500)
{
digitalWrite(12, HIGH);
Serial.println("LED ON");
Serial.println(value);
}
else
{
digitalWrite(12, LOW);
Serial.println("LED OFF");
Serial.println(value);
}
delay(1000);
}

You might also like