📘 CodingMarble Learn

Imagining and Designing a Smart Scene

A smart scene is a small place, like a room or a street, that senses what is happening and reacts by itself. To design one, name a problem, add sensors, send their data over a network to a hub, write simple if-then rules, and connect devices that act (lamp, fan, door). Then test it, check for mistakes, and protect people's privacy.

🎬 Step-by-step story

  1. Here is a room with a problem. It is dark and hot, and a person sits in it. The lamp and fan are off, and someone must switch them by hand.
  2. First step: add sensors. A sensor is a small device that measures something. We add three blue ones: for light, for heat and for movement of a person.
  3. Second step: the sensors send their numbers over a network to the hub. The yellow dots are the data travelling. The hub is the brain of the room.
  4. Third step: we give the hub rules. IF it is dark AND a person is here, THEN lamp on. IF it is hot AND a person is here, THEN fan on.
  5. Fourth step: the lamp and fan now switch themselves on. The things that act are called actuators. If the person leaves, both go off to save power.
  6. Your turn. Move the person in or out. Slide the daylight and the temperature. Read the line below the picture to see what the rules decide.

Tip: drag the 3D scene to turn it. Use two fingers to zoom.

🤔 Common doubts, cleared

Why do we need a problem first?

Without a real problem we add gadgets that nobody needs. Look at step 1: the room has a clear problem, dark and hot.

Can one sensor measure everything?

No. Each sensor measures one kind of thing. See the three different blue sensors.

How does the data reach the hub?

Over a network such as Wi-Fi or wires. The yellow dots show it moving from every sensor to the hub.

What does AND mean in a rule?

Both parts must be true. The rule label shows two rules, each with AND.

Why should the lamp go off when nobody is there?

To save electricity. In step 5 the person leaves and everything switches off.

What if I want the fan to start at a lower temperature?

Change the number in the rule. Slide the temperature and watch where the fan turns on. Rules can be tuned.

What is a smart scene?

A scene is a small place or situation: a room, a classroom, a bus stop, a farm. It becomes smart when devices in it can sense, decide and act without you pressing every switch.

A good smart scene does not use gadgets for fun. It starts from a real problem that people have, such as wasted power or a missed bus.

Step by step: how to design it

  1. Problem. Write one sentence: who has the problem and what is wrong.
  2. Sensors. What must be measured? Light, heat, motion, water, sound, distance.
  3. Network and hub. The sensors send data (by Wi-Fi, Bluetooth or wires) to a hub, which can be a small computer or a phone app.
  4. Rules. Write if-then rules the hub follows, like IF dark AND person THEN lamp on.
  5. Actuators. Devices that act: lamp, fan, door lock, buzzer, water pump.
  6. Test and improve. Try odd cases, such as a person who stays very still.

If-then rules: the thinking part

A rule has a condition and an action. AND means both things must be true. OR means any one is enough.

Rules should be simple enough that a child can read them. If you cannot explain a rule in one line, it is too tangled.

Making a smart scene safe, fair and kind

Smart scenes collect facts about people. Think before you design.

Key formulas and definitions

Worked examples

1. Design a smart bus stop. Write the problem, two sensors, one rule and one actuator.

Problem: people wait without knowing when the bus will come. Sensors: a GPS tracker on the bus and a motion sensor at the stop. Rule: IF the bus is less than 5 minutes away AND someone is waiting, THEN show the time on the screen. Actuator: the display board.

2. Rule: IF dark AND person THEN lamp ON. It is dark and nobody is in the room. Is the lamp on? Why?

No. AND needs both parts to be true. It is dark (true) but a person is here is false, so the lamp stays off and saves power.

3. A smart classroom has 12 sensors. Each sends 5 readings a minute. How many readings reach the hub in 1 hour?

Per minute: 12 × 5 = 60 readings. Per hour: 60 × 60 = 3,600 readings.

Common mistakes

Practice quiz

1. What does a sensor do?
2. In a smart scene, the hub is like the:
3. Which part acts, for example by switching on a fan?
4. IF dark AND person THEN lamp ON. When does the lamp turn on?
5. Which design choice protects privacy best?

Practice: answer these yourself

Type or choose your answer, then press Check. Use a hint if you are stuck; the full solution appears after you answer.

Frequently asked questions

How do I design a smart scene?

Name a real problem, add sensors, send data to a hub, write simple if-then rules, connect actuators, then test and fix mistakes.

What is the difference between a sensor and an actuator?

A sensor measures the world (light, heat, motion). An actuator changes the world (lamp, fan, door lock).

Does a smart scene always need the internet?

No. Small scenes can work on a local network or even wires. The internet is only needed to control it from far away.

Where this is taught

China九年级(初三)Cross-disciplinary theme

Learn first

Learn next

Related lessons

All Computer Science lessons