You are on page 1of 16

ENGG 200

Introduction to Engineering

Temperature Sensor
Light Dependent Resistor
Sensors

 The sensors in the kit can be used to interact with your


circuits through vibration, movement, light or temperature.
 Sensor information could displayed on the serial monitor or
on the serial plotter.
 Sensors are devices that convert a physical quantity, such as
light intensity or temperature, into an electrical quantity.
 There are many different types of sensors:
 Light sensor, Motion sensor, Temperature sensor, Magnetic fields
sensor, Gravity sensor, Humidity sensor, moisture sensor, Vibration
sensor, Pressure sensor, Electrical fields sensor, Sound sensor,
Position sensor

LIU ENGG200- Introduction to Engineering 2


Temperature Sensor: LM35DZ

 The LM35DZ is a temperature


sensor from 0°C to 100°C that
outputs 10mV for every degree
increase in temperature.
 The maximum output voltage is
100°C × 10mV, or one volt.

LIU ENGG200- Introduction to Engineering 3


LM35DZ
  Outputs: 10mV  1 Celsius increase in temperature
 Example: T= 20°C = 200mV = 0.2 V

 Maximum output voltage


 Arduino analog-to-digital conversion (ADC) converts a voltage
to a digital value between 0 and 1023.

 V out
T °C 𝑉𝑎𝑙𝑢𝑒[0
  −1023]
ADC

LIU ENGG200- Introduction to Engineering 4


LM35DZ
  Default ADC maximum voltage = 5V
 5V  1023
 1V ? = 1023/5 = 205
 Range of output [0-1v][0-205]
 Changing the ADC maximum voltage to 1.1 V
 1.1 V  1023
 1V  ? = 1023/1.1 = 930
 Range of output [0-1v][0-930]
 provide greater resolution for the temperature sensor.
 Example: temperature increase of 1°C corresponds to
 For = 5V : 1°C  10 mv  1023*0.01/5 = 2 in ADC range
 For = 1.1 V : : 1°C  10 mv  1023*0.01/1.1 = 9 in ADC range

LIU ENGG200- Introduction to Engineering 5


LM35DZ
  ADC voltage can be reduced from 5V to 1.1V with the
analogReference(INTERNAL) instruction.

 𝑉 𝑜𝑢𝑡
 For = 1.1 V
1023
  1.1 V   mv  1 °C
10
Reading value [0-1023]   T °C

LIU ENGG200- Introduction to Engineering 6


LM35DZ
 Connection To Arduino
 right-hand side of the flat side  5V;
 Left-hand side of the flat side  GND
!! If not LM35DZ temperature sensor rapidly overheats.
 output pin One of Arduino analog input pin (A0- A5)

LIU ENGG200- Introduction to Engineering 7


LM35DZ
.

Serial.begin open up a connection


between Arduino and computer.
9600 is the speed at which Arduino
will communicate 9600 bits per sec.

To set axis and plot on a graph.


LIU ENGG200- Introduction to Engineering 8
Temperature Sensor TMP36
 Tinkercad does not include LM35DZ, it has another sensor
called TMP36. (Note that both sensors are analog, so
Arduino uses analogRead to read from these sensors). Digital

TMP36

LIU ENGG200- Introduction to Engineering 9


Light Dependent Resistor (LDR)

LIU ENGG200- Introduction to Engineering 10


Light Dependent Resistor

 LDR’s
  resistance is between 3kΩ and 5kΩ in average daylight
 LDR can be used to change the brightness of an LED,
depending on the incident light, LED turn on when the light
intensity is low (dark)
 LDR is combined with a 4.7kΩ resistor to form a voltage divider

)

 Incident light  

 𝑉 𝑜𝑢𝑡

LIU ENGG200- Introduction to Engineering 11


Light Dependent Resistor
  reflecting the LDR resistance is
converted by Arduino ADC to a digital value.

 → 𝑟𝑒𝑎𝑑𝑖𝑛𝑔 𝑣𝑎𝑙𝑢𝑒 = 𝑉 𝑜𝑢𝑡 ×10 23


𝑉 𝑖𝑛
Light
 V out 𝑉𝑎𝑙𝑢𝑒[0
  −1023]
ADC

 in light conditions (reading = 890)


 in dark (reading = 90)

LIU ENGG200- Introduction to Engineering 12


Light Dependent Resistor
 Example 1: Use LDR to turn on a LED only when the light intensity is
low, with a threshold of 500 for the voltage divider reading.

LIU ENGG200- Introduction to Engineering 13


Light Dependent Resistor

Read value [0-1023]

low reading is mapped to high LED


brightness values.

Analog input value is [0-1023] A mapping of analog inputs to analog outputs is


Analog output value is [0-255] required  Use map function
map(value, fromLow, fromHigh, toLow, toHigh)  re-maps a number from one
range[fromLow, fromHigh] to another[toLow, toHigh]
LIU ENGG200- Introduction to Engineering 14
Light Dependent Resistor
 Example 2: use a LDR to turn on a number of LEDs,
 a brighter light turning on more LEDs

LIU ENGG200- Introduction to Engineering 15


Light Dependent Resistor

LIU ENGG200- Introduction to Engineering 16

You might also like