Back to homeTechnology and Digitalisation · 3rd ESO · Change subject
Start for free
ESO Y3 · Technology and Digitalisation
Programming and robotics · Control and robotics

Microcontrollers and robots

The board you have in the classroom is not a toy: it is a complete computer, only tiny and dedicated to a single task. With it you are going to build traffic lights, barriers and robots that really sense what is going on around them.

Before you start, make sure you know: The electric circuit (1st ESO)
Before you start, make sure you know: Robots and controller boards (2nd ESO)

The microcontroller: a tiny computer

Comparison between a desktop computer, large, with a screen, keyboard and plug, and a microcontroller, a small chip with input and output pins that runs on batteries desktop computer many tasks at once microcontroller one fixed task internet plug expensive, large input output input and output pins batteries cheap, small
Practice★☆☆Not started
Explain what a microcontroller is (a complete but small computer inside a board) and two differences from a desktop computer: what each can do and what each is used for.

Explain what a microcontroller is (a complete but small computer inside a board) and two differences from a desktop computer: what each can do and what each is used for.

Solve
Practice★☆☆Not started
Explain how a program reaches the board: where it is written, what happens when it is "uploaded" via the cable, and why the board then works independently without a…

Explain how a program reaches the board: where it is written, what happens when it is "uploaded" via the cable, and why the board then works independently without a computer, running the program in a loop.

Solve
Practice★★★Not started
Your team must select the hardware platform to build a home automation prototype that controls blinds using servomotors, detects gas leaks and presence in three…

Your team must select the hardware platform to build a home automation prototype that controls blinds using servomotors, detects gas leaks and presence in three different rooms, and displays the status on an LCD screen.

  1. a) Compare the suitability of using a compact "all-in-one" board (with sensors and LED display integrated on the printed circuit board itself) versus a modular development board with expansion pins and a breadboard. Analyze aspects such as the spatial distribution of the sensors throughout the home and the wiring of power actuators.
  2. b) If during assembly a student makes a mistake and burns out the temperature sensor due to overvoltage or reverse polarity, analyze the technical and cost impact on the integrated board versus the modular board.
  3. c) Justify with reasoned arguments which of the two platforms you would choose for this final home automation robotics project and for which of them you would reserve an initial two-hour introductory programming session.
Solve

Input and output pins: where everything is connected

Layout diagram of the digital pins, analogue pins and power connections on a controller board board ⏺ push button digital input ☀ LDR analogue input LED digital output ⚙ servo output (angle)
Practice★☆☆Not started
The figure shows a microcontroller board with its groups of pins labeled, except for one. The covered pin is the common reference that all the circuits you connect to…

The figure shows a microcontroller board with its groups of pins labeled, except for one.

Microcontroller board with digital pins, analog pins and power pins; one of them is covered with a question mark digital pins D2–D13 USB microcontroller analog pins A0–A5 5 V 3,3 V ?

The covered pin is the common reference that all the circuits you connect to the board return to. Name it and explain what it is for, what the difference is between digital pins (all or nothing) and analog pins (they read continuous values), and what the USB connector is used for.

Solve
Practice★☆☆Not started
Classify these items according to whether they connect to an input pin or an output pin on the board, and justify one of each type: a push button, an LED, an LDR, a…

Classify these items according to whether they connect to an input pin or an output pin on the board, and justify one of each type: a push button, an LED, an LDR, a buzzer, and a potentiometer.

Solve
Practice★☆☆Not started
State whether these statements are true or false and justify each answer: (a) the board executes the program exactly as written, without translating it first; (b) the…

State whether these statements are true or false and justify each answer: (a) the board executes the program exactly as written, without translating it first; (b) the board pins can handle any current, so the LED can be connected without a resistor; (c) a servo motor can be set to a specific angle commanded by the program; (d) the board remembers the last program even if it is disconnected from the power supply.

Solve

The robot's sensors and actuators

Block diagram: the ultrasonic and infrared sensors send input signals to the board, and the board sends output instructions to the servo, the motor and the buzzer INPUTS CONTROL OUTPUTS board ultrasonic infrared servo motor buzzer
Practice★☆☆Not started
The figure shows a mobile robot seen from above, with its elements labeled and its "brain" covered with a question mark. Name the covered part, explain what information…

The figure shows a mobile robot seen from above, with its elements labeled and its "brain" covered with a question mark.

Mobile robot seen from above with labeled motor wheels, LED, buzzer, ultrasonic sensor and battery, and a central part covered with a question mark ? battery motor wheels ultrasonic sensor buzzer LED

Name the covered part, explain what information it receives from the sensors and what commands it sends to the actuators, and classify the labeled elements (motor wheels, ultrasonic sensor, buzzer, LED, battery) as input, output or power source.

Solve
Practice★☆☆Not started
State what each sensor that can be connected to the board measures and a project in which you would use it: ultrasonic sensor (distance), LDR (light), temperature…

State what each sensor that can be connected to the board measures and a project in which you would use it: ultrasonic sensor (distance), LDR (light), temperature sensor, and infrared line sensor (distinguishes light from dark on the ground).

Solve
Practice★☆☆Not started
State what each connectable actuator to the board does and a key difference between them: an LED, a buzzer, a servo motor (turns to the exact position commanded), and a…

State what each connectable actuator to the board does and a key difference between them: an LED, a buzzer, a servo motor (turns to the exact position commanded), and a DC motor (rotates continuously at higher or lower speed).

Solve
Practice★★☆Not started
A robot's motors are not powered directly from a board pin, but from the battery via a "motor driver board". Explain why (the pins provide very little current and the…

A robot's motors are not powered directly from a board pin, but from the battery via a "motor driver board". Explain why (the pins provide very little current and the motor requires much more), what role the driver board plays, and how this relates to a relay in electronic circuits.

Solve

Programming with conditions: read, compare, act

Practice★★☆Not started
You want an LED to light up when the room light falls below a certain level. Explain which pin you use to read the LDR (an analogue one), what setting a "threshold" in…

You want an LED to light up when the room light falls below a certain level. Explain which pin you use to read the LDR (an analogue one), what setting a "threshold" in the program means, and write the three key lines in pseudocode: read, compare, and act.

Solve
Practice★★☆Not started
The figure shows the flowchart for controlling a car park barrier using an ultrasonic sensor, but the decision box is covered. Write the condition that the board must…

The figure shows the flowchart for controlling a car park barrier using an ultrasonic sensor, but the decision box is covered.

start ? no yes raise the barrier wait 5 s lower the barrier the ultrasonic sensor measures the distance to the approaching car

Write the condition that the board must check (if the measured distance is less than a certain value, a car is present), explain what the loop does while no one arrives, and what would happen if the barrier lowered without waiting a few seconds.

Solve
Practice★★☆Not started
Design a traffic light using the board: decide how many output pins you need and for what, write the sequence of states with their timings (green $4\ \text{s}$, amber…

Design a traffic light using the board: decide how many output pins you need and for what, write the sequence of states with their timings (green $4\ \text{s}$, amber $1\ \text{s}$, red $4\ \text{s}$), and explain why the program is written as an infinite loop.

Solve

The ultrasonic sensor and the line follower

Animation of the ultrasonic sensor: a pulse leaves the sensor along the outgoing curve, reaches the obstacle and the echo returns along the return curve with the same duration, showing that the round-trip time measures the distance. sensor pulse (out) echo (back) obstacle
Practice★★☆Not started
An ultrasonic sensor measures distance like a bat. Explain the principle (it emits a sound pulse and measures how long the echo takes to return), why it has two "eyes"…

An ultrasonic sensor measures distance like a bat. Explain the principle (it emits a sound pulse and measures how long the echo takes to return), why it has two "eyes" (one transmitter and one receiver), and two situations in which it might fail: soft objects that absorb sound and inclined surfaces that deflect the echo.

Solve
Practice★★☆Not started
Describe the high-level behaviour of an obstacle-avoiding robot: what the front sensor measures, what the robot does when the path is clear, and what sequence it…

Describe the high-level behaviour of an obstacle-avoiding robot: what the front sensor measures, what the robot does when the path is clear, and what sequence it executes when it detects something close (stop, turn, check again). What would happen if it only had a forward-facing sensor?

Solve
Practice★★★Not started
You are designing the calibration and assembly of a line-following robot that travels along a white circuit with a 2 cm wide black line. The robot has two infrared…

You are designing the calibration and assembly of a line-following robot that travels along a white circuit with a 2 cm wide black line. The robot has two infrared reflectance sensors ($S_I$ and $S_D$) mounted on the front and differential drive with two independent motors.

  1. a) Predict what erroneous behaviour the robot will have if you mount the sensors separated by only 1 cm from each other (a distance smaller than the line width). What if you separate them by 6 cm? Justify what the optimal geometric separation should be.
  2. b) Design the robot's decision table indicating the state of each motor (forward, stop, or reverse) for each of the 4 possible reading combinations (White/Black).
  3. c) Upon reaching a sharp left turn, if the robot only turns off the left motor and keeps the right motor forward, it tends to leave the line due to inertia. Justify what change you must make in the motor control to achieve a much tighter turn on its own axis.
Solve
Practice★★★Not started
To control an access barrier with an emergency stop push button, a student programs the following sequence: During testing, when the emergency stop button is pressed…

To control an access barrier with an emergency stop push button, a student programs the following sequence:

open_barrier();

wait(5000); // fixed 5 s pause with delay

close_barrier();

During testing, when the emergency stop button is pressed during the 5 s pause or while the barrier is descending, the system does not respond and continues its cycle, causing an impact.

  1. a) Explain at the microcontroller execution level why the fixed wait instruction (delay) blocks responsiveness to the emergency.
  2. b) Design the algorithmic structure (in pseudocode or flowchart) that allows keeping the barrier open for 5 s while continuously checking the stop push button to stop the motor instantaneously.
  3. c) If you also need a buzzer to emit intermittent 0,5 s beeps while the barrier is moving, justify why this requirement is unfeasible with blocking pauses and how it is solved.
Solve

Designing and troubleshooting a real robot

Cyclic control flow in three stages for a mobile robot follow line detect marker signal the main loop repeats the three stages non-stop
Practice★★☆Not started
To move a car park barrier, you can use a servo motor or a DC motor. Compare both: which reaches an exact position and stays still, which rotates continuously, which…

To move a car park barrier, you can use a servo motor or a DC motor. Compare both: which reaches an exact position and stays still, which rotates continuously, which requires less extra electronics in this project, and why.

Solve
Practice★★☆Not started
Your program should turn on an LED when a button is pressed, but the opposite occurs: it is on and turns off when pressed. Explain two possible causes (the program logic…

Your program should turn on an LED when a button is pressed, but the opposite occurs: it is on and turns off when pressed. Explain two possible causes (the program logic is inverted or the push button is wired in reverse, "active-low") and how you would test each one.

Solve
Practice★★★Not started
A group of students has programmed a pedestrian traffic light with a push-button using the following logic: as soon as the pedestrian presses the button, the vehicular…

A group of students has programmed a pedestrian traffic light with a push-button using the following logic: as soon as the pedestrian presses the button, the vehicular light turns instantly from green to red and the pedestrian light turns green for 15 s. After testing it on a road model, they observe sharp braking by vehicles and continuous traffic jams if several pedestrians repeatedly press the button.

  1. a) Justify two road safety and traffic flow flaws present in this initial program.
  2. b) Design the flowchart or the corrected timing sequence (indicating inputs, outputs, and recommended times) to resolve both problems, incorporating a transition phase (amber) and guaranteeing a minimum time of continuous green for cars before serving another pedestrian call.
  3. c) If you want to add an intermittent acoustic buzzer for visually impaired individuals during the last 3 s of the pedestrian green, how should you modify the timing of that output?
Solve
Practice★★★Not started
In a 10-space car park controlled by a barrier, a student proposes this algorithm: «The entry sensor adds 1 to the cars inside upon detecting a vehicle and opens the…

In a 10-space car park controlled by a barrier, a student proposes this algorithm: «The entry sensor adds 1 to the cars inside upon detecting a vehicle and opens the barrier; the exit sensor subtracts 1 when leaving; if the cars inside reach 10, the FULL light turns on and the barrier does not open». During the first week of testing, the system indicates FULL even though there are empty spaces, and sometimes the barrier hits the roof of the cars.

  1. a) Analyse and identify two real-world physical situations that cause the counter to become desynchronised over the hours (hints: vehicles that turn back after stepping on the sensor, pedestrians passing through, false detections).
  2. b) Design the complete control logic (specifying conditions with the entry, barrier, and exit sensors) so that the count is reliable and does not depend on a single instantaneous reading.
  3. c) What safety condition must have absolute priority in the programming to guarantee that the barrier never lowers while an obstacle or vehicle is crossing?
Solve
Practice★★★Not started
You are tasked with designing the control and logging system for an environmental station in a school greenhouse using a programmable board. a) Select three suitable…

You are tasked with designing the control and logging system for an environmental station in a school greenhouse using a programmable board.

  1. a) Select three suitable sensors to monitor plant conditions, classify them as analog or digital, and justify the ideal sampling rate for each (argue why measuring temperature every 10 ms would be a technical error and why measuring it once a day would be insufficient).
  2. b) Write the Boolean logic condition that simultaneously activates ventilation and automatic irrigation if the temperature exceeds 32 °C and soil moisture falls below 30 %.
  3. c) Reviewing the daily graphical log data, you observe that at 13:00 the light reading is at its maximum, but the temperature probe suddenly reads 0 °C for 15 minutes before returning to 28 °C. Interpret this anomaly, justifying whether it is due to a meteorological phenomenon or an instrumental fault (wiring/sensor).
Solve
Practice★★★Not started
A mobile robot programmed with Arduino works perfectly while connected to the computer via the USB cable (the wheels spin in the air and the program executes the entire…

A mobile robot programmed with Arduino works perfectly while connected to the computer via the USB cable (the wheels spin in the air and the program executes the entire sequence). However, when disconnecting the USB, powering it with a 4 AA battery holder (6 V) connected to both the board and the motors, and placing it on the ground, the following occurs: at the exact moment the motors try to start to overcome friction, the board's power LED flickers slightly, the robot gives a small jolt, and the program restarts from the first line in a continuous loop.

  1. a) Interpret and justify the physical-electrical cause of this failure: what happens to the motors' current demand at the moment of starting and how does it affect the voltage received by the microcontroller?
  2. b) Why did this problem not manifest itself while the robot was being tested connected via USB with the wheels off the ground?
  3. c) Propose and justify two technical modifications to the power supply circuit to definitively solve this problem and ensure the stability of the microcontroller.
Solve
Practice★★★Not started
You must design the autonomous control system for a library messenger robot that transports books between two stations (Table 1 and Table 2) following a line on the…

You must design the autonomous control system for a library messenger robot that transports books between two stations (Table 1 and Table 2) following a line on the floor. The complete cycle consists of: waiting for the start command via a push button, following the line until finding a transverse stop mark, stopping and alerting with a buzzer for 3 s, waiting for the user to remove the book (detected by a presence or weight sensor), and returning to Table 1 by performing a 180° turn to be ready for the next service.

  1. a) Identify the required sensors and actuators, classifying each as an input or an output.
  2. b) Design the system's state machine or flowchart, accurately indicating the robot's different states and what condition triggers the transition to the next state.
  3. c) Add a reactive safety protocol to the design: what sensor must you incorporate and how should the main loop act if a student crosses less than 20 cm in front of the moving robot?
Solve

Summary

See all the exercises in this section