Skip to content
Tutorials Center
My learning

Topics

Lesson 16 of 55 ยท Inside the Machine

Smartphones, Tablets and the Internet of Things

See what is inside a smartphone, how sensors turn the physical world into numbers, how IoT devices connect and report, and simulate a step counter in Python.

The most-used computer in the world is not a laptop; it is the smartphone. A phone is a complete computer with a processor, memory, storage, a network connection and a screen, squeezed into something that fits in your hand and runs all day on a small battery. Beyond phones and tablets, a growing family of small connected gadgets, from fitness bands to thermostats and door locks, forms what is called the Internet of Things (IoT).

This lesson opens up a phone to see what it contains, explains how sensors turn the physical world into numbers a program can use, and shows how IoT devices connect and what that means for safety. It builds on The CPU and Types of Computers.

Inside a smartphone

System on a chip CPU, GPU and more on one chip.
Memory and storage RAM for now, flash for keeps.
Radios Cellular, Wi-Fi, Bluetooth, GPS.
Battery The limit behind every design choice.

Everything is soldered or stacked tightly to keep the device thin.

1 / 2

What is inside a smartphone

A phone's main chip is a system on a chip (SoC). Instead of separate parts on a motherboard as in a desktop (see Motherboard, Buses and the GPU), the SoC puts several processor cores, a graphics unit, a neural engine for AI tasks, an image processor for the camera and the connections between them on one piece of silicon. This saves space and, most importantly, power. Many phones use processor designs from Arm, which are built for efficiency, and they combine fast cores for heavy work with slow, frugal cores for background tasks so the battery lasts.

Around the SoC sit:

  • RAM, usually 4 to 16 GB, which holds apps that are running (see Memory: RAM, Cache and the Memory Hierarchy).
  • Flash storage, a solid-state memory (see Storage Devices) that keeps your apps and photos when the power is off.
  • Radios for cellular networks (4G and 5G), Wi-Fi, Bluetooth, near-field communication (NFC) for contactless payments, and GPS for location.
  • A touch screen, which is both the main output device and the main input device (see Input and Output Devices).
  • Cameras, microphones and speakers, plus a collection of sensors.
  • A battery, charged through a cable or wirelessly. The battery size and the heat the thin body can shed limit how fast the chip may run, so phone chips constantly slow down or speed up to balance performance and battery life.

A tablet is the same idea with a bigger screen. Most phones and tablets run Android or iOS, the mobile operating systems described in Types of Operating Systems. Apps are installed from an app store, run in a sandbox, and must ask permission before reading your location, contacts or camera.

Sensors: from the physical world to numbers

A computer only understands numbers, so a sensor is a small device that measures something physical and reports a number. Your phone has many:

Sensor What it measures What it enables
Accelerometer Acceleration, including gravity Screen rotation, step counting, shake gestures
Gyroscope Rotation speed Steady camera video, motion-controlled games
Magnetometer Magnetic field Compass
Light sensor Brightness Automatic screen brightness
Proximity sensor Whether something is close Turning the screen off during a call
GPS receiver Distance to satellites Maps and navigation
Fingerprint or face sensor Biometric patterns Unlocking the phone

Raw sensor data is noisy: it jumps around even when nothing happens. Software filters it by averaging or looking for patterns. A step counter is a good example. When you walk, the accelerometer's reading rises and falls in a rhythm, once per step. The program below fakes one second of accelerometer readings and counts steps by counting each time the reading rises above a threshold. A reading of about 1.0 g is plain gravity.

Python A step counter from accelerometer readings

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The threshold and the minimum gap are exactly the kind of tuning phone makers do, with far more data. Too low a threshold counts a bump in the road as a step; too high misses a slow stroll.

The Internet of Things

The Internet of Things is the idea of putting a small computer, a few sensors and a network connection into everyday objects. A smart thermostat reads the room temperature and lets you set it from your phone. A fitness band reports your heart rate. A smart doorbell streams video. A farm field sensor reports soil moisture so water is used only where needed. Factories and cities use thousands of such devices to watch machines, traffic and air quality.

Most IoT devices share a simple pattern:

flowchart LR
  S["Sensors<br/>measure"] --> D["Small device<br/>decides"]
  D -->|"Wi-Fi, Bluetooth,<br/>cellular, Zigbee"| G["Gateway or<br/>router"]
  G -->|"internet"| C["Cloud service<br/>stores and analyzes"]
  C --> A["Your phone app<br/>and alerts"]
  C -.->|"commands"| D
  D --> X["Actuators<br/>act: lock, heat, switch"]

Sensors measure, the device reports to a cloud service, and commands flow back to actuators.

The parts that do something in the physical world (a lock, a heater, a valve, a light) are called actuators. Because these devices are small and cheap, they use low-power radios such as Bluetooth Low Energy, Zigbee or low-power Wi-Fi, and often send only tiny messages. Many run a small embedded OS (see Types of Operating Systems) and a battery that should last months or years. The simulation below models a thermostat that reads a sensor and switches a heater, with a small gap (hysteresis) so it does not flip on and off constantly.

Python A smart thermostat loop

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the heater stays on until the room passes the top of the band (21.5), then switches off and the room drifts down; it will come back on only below 20.5. Without the margin the heater would switch every cycle and wear out quickly.

Safety and privacy

Every connected device is a small computer that can have bugs, and many have weak security. Common problems are default passwords never changed, updates that are never delivered, and cameras or microphones that send data to servers without clear consent. Some simple habits help (see also Malware, Phishing and Safe Habits):

  • Change default passwords as soon as you install a device.
  • Install updates, or choose products with a clear update policy.
  • Put smart devices on a separate guest Wi-Fi network if your router allows it.
  • Review app permissions and switch off sensors you do not need.
  • Ask what data is collected and where it goes before you buy.

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. What is a system on a chip (SoC)?

    An SoC integrates several processing units on one chip, which saves space and power.
  2. 2. Which sensor makes a phone's screen rotate when you tilt it?

    The accelerometer measures acceleration including gravity, so the phone can tell which way is down.
  3. 3. In an IoT system, what is an actuator?

    Sensors measure; actuators act on the physical world.
  4. 4. Why do thermostats use a margin (hysteresis) around the target temperature?

    The gap lets the temperature move inside a band before the heater changes state, reducing wear.
  5. 5. Which habit best improves the security of a new smart camera?

    Default passwords and missing updates are the most common ways IoT devices are compromised.

Summary

  • A smartphone is a full computer built around a system on a chip, with RAM, flash storage, radios, sensors, a touch screen and a battery that limits every design choice.
  • Sensors turn physical quantities into numbers; software filters the noisy data, as in a step counter.
  • The Internet of Things connects small sensor-and-actuator devices through gateways to cloud services.
  • Connected devices need strong passwords, updates and sensible permissions.

Continue with Boolean Logic and Logic Gates.