Lesson 5: Using Sensors

Learning Objectives 

By the end of this lesson, you will be able to:

  • Explain what Sensors are and how they work in IoT Systems.

  • Identify different types of sensors such as light sensors, motion sensors, and temperature sensors.

  • Demonstrate how to use sensors to control actuators like LEDs and Buzzers in a circuit simulation.

  • Build and test sensor-based projects in Tinkercad.


What are Sensors?

A sensor is a device that detects changes in the environment and converts that information into a signal that can be read by a microcontroller, such as an Arduino.

Sensors act like the sense organs of an IoT device — they can see (light), feel (temperature), hear (sound), or detect movement (motion).

Why are sensors important in IoT?

  • They collect real-world data that IoT devices use to make smart decisions.

  • Without sensors, IoT devices would have no awareness of their surroundings.


Types of Sensors in this Lesson

  1. Light Sensor - LDR (Light Dependent Resistor)

    • Detects brightness levels in the environment.

    • Resistance changes with light intensity — more light means less resistance, less light means more resistance.

    • Example: Street lights that automatically turn on when it gets dark.

  2. Motion Sensor (PIR - Passive InfraRed)

    • Detects movement by sensing infrared radiation from people, animals, or objects.

    • Can trigger alarms, lights, or cameras.

    • Example: Security systems that sound an alarm when motion is detected.

  3. Temperature Sensor (LM35, DHT11, etc.)

    • Measures temperature in the environment.

    • Sends temperature readings to the microcontroller for processing.

    • Example: Air conditioners that turn on when the room gets too hot.


How Sensors Work in IoT

Sensors are connected to the Arduino’s input pins(or in any Microcontroller) .

When the sensor detects a change, it sends an electrical signal to the Arduino.
The Arduino then processes this signal and can control an actuator (like an LED or buzzer) in response.

Example:

  1. Light sensor detects darkness.

  2. Arduino receives the signal.

  3. Arduino turns on the LED.


Hands-On Activities

Activity 1: Light Sensor to Turn LED On/Off

Goal: Use a light sensor LDR (Light Dependent Resistor) to control an LED.

Steps:

  1. In Tinkercad, place an Arduino Uno, an LDR, a LED, and a resistor.

  2. Connect the LDR to analog pin A0 and GND.

  3. Connect the LED’s positive leg to digital pin 7 and negative leg to GND    

  4. Write a program so that when it gets dark (low light), the LED turns on, and when it’s bright, the LED turns off.



Activity 2: Motion Sensor to Trigger Buzzer

Goal: Use a motion sensor to activate a buzzer when movement is detected.

Steps:

  1. In Tinkercad, place an Arduino Uno, a PIR motion sensor, and a buzzer.

  2. Connect the PIR sensor output to digital pin 2.

  3. Connect the buzzer’s positive pin to digital pin 8 and negative to GND.

  4. Write a program so that when the PIR detects movement, the buzzer makes a sound.



Real-World Applications

  • Light sensor + LED →Automatic Street Lighting.

  • Motion sensor + buzzer → Home Security Alarm.

  • Temperature sensor + fan → Automatic Cooling System.

Comments