Home · Academy · Robotics & Coding · Sensors and Actuators · What Is a Sensor?

What Is a Sensor?

Learn how sensors gather information from the environment and their place in the sense–decide–act loop.

LESSON COMPASS

What will you use this page for?

Core idea

A sensor is the part that detects something in the environment — light, temperature, distance, sound or touch — and turns it into an electrical signal a circuit can read.

Evidence to produce

Complete the page task with your own input, test conditions and reasoning.

Control trap

Thinking the sensor makes the decision A sensor does not decide; it only measures and sends a number. The program's rules make the decision. A sensor is like a thermometer: it tells you the temperature, but it does not open the window. Forgetting the threshold value If you do not compare the sensor's number with a…

Next connection

What Is an Actuator? We will learn how a device moves in response to the information a sensor collects — that is, how LEDs, motors and sounds work.

Module sources: Python Tutorial · Arduino Learn

LevelBeginner
Age10–16
Duration30–45 min
PrerequisiteIntroduction to Electronics
ContentStandard lesson · 1,614 words
Last updated

One-sentence summary

A sensor is the part that detects something in the environment — light, temperature, distance, sound or touch — and turns it into an electrical signal a circuit can read.

Why does it matter?

A robot or smart device cannot make good decisions without knowing what is happening around it. A street lamp that does not know it is dark cannot tell when to switch on, and a robot that does not know there is a wall ahead cannot tell when to stop.

Sensors are a device's sense organs. You detect light with your eyes, sound with your ears and heat with your hands. A device does the same job with sensors. Without them, a program only repeats the steps it memorised; it cannot react to the world.

In the previous lesson we built a warning circuit. In this lesson we will see how that circuit gains its eyes, ears and skin.

What exactly does a sensor do?

A comparison with human senses

Think of your own body as a robot:

When you reach for a door, your skin tells your brain whether it is hot or cold. Your brain decides, and your arm moves. A sensor does the first step of this job: it collects information from the environment and sends it to the "brain" of the circuit (the microcontroller).

Turning physical information into a signal

Inside a sensor is a small part that reacts to a change in the outside world. In a light sensor (LDR), for example, the electrical resistance changes as more light falls on it. The circuit reads that change.

A sensor's job in one sentence is this: measure something physical and turn it into electricity. Temperature, distance, sound or light — in the end they all become an electrical signal so the circuit can understand them.

Common sensors

Light sensor (LDR)

Temperature sensor

Distance sensor (ultrasonic)

Sound sensor (microphone)

Button

Information from a sensor becomes a number

A sensor does not say "very bright"; instead it sends a number to the circuit. This is a very important idea.

There are two kinds of output:

The program reads this number and compares it with a threshold (a limit). As pseudocode:

light = read_light_sensor()
If light is less than 300
  display "It got dark"
Otherwise
  display "The room is bright"

The same idea in micro:bit-style code looks like this:

from microbit import *

while True:
    light = display.read_light_level()
    if light < 50:
        display.show(Image.HEART)   # show a heart in the dark
    else:
        display.clear()
    sleep(200)

The form of the code may change; the idea is the same: read the sensor, compare the number with a limit, then decide.

Where the sensor sits in the sense–decide–act loop

Every smart device runs a loop that repeats over and over: sense, decide, act.

Repeat:
  SENSE  -> read information from the sensor
  DECIDE -> compare the information with a rule
  ACT    -> drive an actuator (LED, motor, sound)

In this loop the sensor is the first link. Without a sensor, the "decide" step has no information to compare. Think of a line-following robot:

  1. Sense: A light sensor underneath reads whether the floor is black or white.
  2. Decide: Did it see the black line?
  3. Act: It steers the motors.

In the next lesson we will study the last step of this loop — the actuators that create movement. For now, keep this in mind: a sensor takes information in, and an actuator sends movement out.

Mini practice

Without writing code, plan a "sense–decide–act" design on paper. Your goal: a night light that switches on by itself when it gets dark.

Fill in this table:

Mini practice table
StepWhat is used?What does it do?
SenseLight sensorTurns the surrounding light into a number
Decide??
Act??

Then write the decision as pseudocode:

light = read_light_sensor()
If light is less than ___
  turn the LED ___
Otherwise
  turn the LED ___

Fill the blanks with a threshold value you choose. If you set the limit too high, the lamp turns on even in daylight; too low, and it never turns on. Finding the right number by testing is a normal part of an engineer's work.

Common mistakes

Thinking the sensor makes the decision

A sensor does not decide; it only measures and sends a number. The program's rules make the decision. A sensor is like a thermometer: it tells you the temperature, but it does not open the window.

Forgetting the threshold value

If you do not compare the sensor's number with a limit, the program cannot know when to react. You should set a sensible threshold for every analog sensor.

Choosing the wrong sensor

Using a light sensor when you want to measure distance will not work. First answer "what do I want to measure?", then choose the sensor.

Ignoring the environment

A light sensor may read "dark" even in daytime because of a shadow falling on it. When you test a sensor, think about the real place where it will be used.

Safety note

Lesson summary

Check questions

  1. What is a sensor's basic job?
  2. What physical information does a light sensor measure, and where is it used in everyday life?
  3. Give an example of a sensor that gives a digital (0/1) output.
  4. Why do we compare the number from a sensor with a threshold value?
  5. In the "sense–decide–act" loop, which step does the sensor belong to?

Answers

  1. To measure a physical piece of information from the environment (light, temperature, distance and so on) and turn it into an electrical signal a circuit can read.
  2. It measures the amount of light around it. Example: street lamps that switch on when it gets dark, or a phone's automatic screen-brightness setting.
  3. A button — it has only two states, pressed (1) or not pressed (0).
  4. So the program can decide when to react. The threshold lets us make a rule such as "when the number is below/above this, do that."
  5. The first step, the "sense" step. The sensor collects information; deciding and acting are the steps that follow.

Source and verification note

For “What Is a Sensor?”, verification focuses on whether the relationship between What exactly does a sensor do? and Turning physical information into a signal remains consistent across examples. Sensor readings can change with the model, supply voltage and environment. Thresholds in the lessons are therefore examples; a real project should use a measurement table and calibration.

Next lesson

What Is an Actuator? We will learn how a device moves in response to the information a sensor collects — that is, how LEDs, motors and sounds work.

Start QuizBack to Sensors and Actuators
QUESTION POOL

Reinforce this lesson with 10 questions

This lesson has a pool of 20 questions. Each attempt selects 10 and reshuffles the choices.