Smart devices and smart environments
Notes on smart devices and smart environments: definitions, architecture, power and communication trade-offs, context handling, and design concerns engineers must know for building pervasive systems.
Drafted with Aria, reviewed by the AiCanCode.org team · Updated . How we write and check our notes. Spotted an error? Use Give Feedback at the bottom of the page.
Why it matters
Smart devices and smart environments are the building blocks of pervasive computing systems used in homes, industry and cities. An engineer uses this topic when designing device hardware, choosing sensors/communication, estimating battery life, and making the environment correctly sense, decide and act while meeting latency, privacy and interoperability requirements.
Key ideas
Ambient intelligence — the property of an environment to perceive people and events, reason about them, and proactively provide services. It depends on context (any information that can be used to characterize the situation of an entity) and context-awareness (systems that use context to adapt behaviour).
Context — defined as: any information (e.g., location, time, activity, nearby devices, light level) that can be used to characterize the situation of an entity. Context must be sensed, represented and used by algorithms.
Sensing chain — the steps from physical phenomenon -> transducer -> signal conditioning -> ADC -> processing. When asked for a diagram, draw a left-to-right chain with blocks: Physical quantity (label example: temperature) -> Sensor/transducer -> Signal conditioning (filter/amplifier) -> ADC -> Microcontroller -> Network interface -> Gateway/Cloud.
System architecture (layered) — draw and label vertically: Devices (sensors & actuators) at bottom, Local network (PAN/WLAN), Edge gateway (protocol translation, local processing), Middleware (context aggregation, storage), Cloud services (heavy analytics), Applications/Users at top. Show arrows up/down for data flow and dashed control arrows down.
Edge vs Cloud trade-off — edge processing reduces latency and preserves privacy but has limited compute and power; cloud gives large compute and storage but increases latency and network usage. State the assumption: latency-sensitive tasks should prefer edge; heavy ML and long-term storage prefer cloud.
Interoperability & middleware — middleware is software that provides common services (discovery, data formats, pub/sub) so heterogeneous devices can work together. Common protocols: MQTT (publish/subscribe lightweight broker), CoAP (Constrained Application Protocol for RESTful interaction). Define MQTT as a broker-based pub/sub protocol typically used in low-power IoT; CoAP as UDP-based REST for constrained devices.
Power management principles — battery lifetime and duty cycling are central. Define duty cycle as the fraction of time a device spends active vs sleeping. Designers must compute average current and energy budgets from active/sleep currents and durations.
Security and privacy basics — smart environments must ensure confidentiality, integrity, availability, and privacy of users. Authentication, authorization, secure boot, and secure update mechanisms are required. Note the assumption: constrained devices may use lightweight crypto but still need key management and secure channels.
Quality attributes — latency, reliability, scalability, privacy, energy efficiency. These often conflict and require trade-offs (e.g., lower latency can increase energy use).
Context inference — converting raw sensor readings into high-level states (e.g., "user present", "cooking") using rule-based systems, probabilistic models (Bayes), or machine learning. Define rule-based: uses logical rules (IF condition THEN action); probabilistic: models uncertainty (e.g., Naive Bayes, HMMs). For exams, be ready to present a small rule set and show inference steps.
Formulas
I_avg = I_active·D + I_sleep·(1 - D) — I_avg is average current (A), I_active is current when active (A), I_sleep is current in sleep (A), D is duty cycle (unitless, 0..1). Applies when activity repeats periodically and currents are approximately constant during active/sleep states.
Battery life (hours) = Capacity (Ah) / I_avg (A) — Capacity in ampere-hours (Ah), I_avg in amperes (A). Applies for rough battery-life estimates, ignoring discharge curve, temperature effects and converter inefficiencies.
E = V · Q = V · I · t — Energy E in joules (J), V voltage (V), Q charge in coulombs (C), I current (A), t time (s). Use to convert battery capacity (Ah) to joules: 1 Ah = 3600 C, so E (J) = V · Ah · 3600.
P = V · I — Power P in watts (W), voltage V in volts (V), current I in amperes (A).
Pr = Pt·Gt·Gr·(λ/(4πd))^2 — Friis free-space equation for received power Pr (W) at distance d (m) from transmitter radiating Pt (W) with antenna gains Gt, Gr (unitless), wavelength λ (m). Assumes free-space LOS, far-field, matched polarisation.
Path loss (dB) = 20·log10(4πd/λ) — free-space path loss in decibels. d in metres, λ in metres. Also, λ = c/f with c ≈ 3.00×10^8 m/s. dBm conversions: P(dBm) = 10·log10(P(mW)) and P(mW) = 10^(P(dBm)/10). Link budget in dB: Pr(dBm) = Pt(dBm) + Gt(dBi) + Gr(dBi) − FSPL(dB) − L_misc(dB). Alternative FSPL form: FSPL(dB) = 32.44 + 20·log10(d_km) + 20·log10(f_MHz).
Worked examples
Example 1 — Battery-life calculation (numerical, full steps)
Given: device battery 2000 mAh at 3.3 V, device active current 30 mA for 1 s every 60 s, sleep current 0.05 mA. Compute battery life in days.
- Convert capacity: 2000 mAh = 2 Ah.
- Duty cycle D = active_time / period = 1 s / 60 s = 1/60 ≈ 0.0166667.
- Compute average current using formula: I_avg = I_active·D + I_sleep·(1 - D)
- I_active = 30 mA = 0.03 A
- I_sleep = 0.05 mA = 0.00005 A
- I_avg = 0.03·(1/60) + 0.00005·(59/60)
- I_avg = 0.0005 + 0.0000491667 = 0.0005491667 A
- Battery life (hours) = Capacity / I_avg = 2 Ah / 0.0005491667 A = 3641.9 h (≈ 3642 h)
- Convert to days: 3641.9 h / 24 ≈ 151.7 days
Final answer: ≈ 151.7 days.
Example 2 — Simple context inference (rule-based trace)
Problem: Sensors provide boolean outputs: Motion = true/false; LightLevel = "low"/"high". Rules: R1: IF Motion == true AND LightLevel == "low" THEN Action = "turn_on_light". R2: IF Motion == false THEN Action = "turn_off_light".
Trace with inputs: Motion = true, LightLevel = low. Step 1: Evaluate R1: Motion true AND LightLevel low -> true, so Action = "turn_on_light" selected. Step 2: R2 evaluation not applied or overridden because Motion != false.
Final action: turn_on_light.
Example 3 — Architecture diagram description (model answer to draw in exam)
Draw 5 vertically stacked boxes labelled bottom-to-top: "Sensors & Actuators (Devices)" -> "Local Network (BLE/Zigbee/Wi‑Fi)" -> "Edge Gateway (protocol translation, local processing)" -> "Middleware / Context Broker (MQTT/CoAP)" -> "Cloud Services / Applications". Draw arrows from devices to gateway (data), from gateway to middleware, and back down for control messages. Annotate an arrow from gateway to cloud labelled "secure TLS / MQTT". Also show a side box labelled "User App" connected to cloud.
Common mistakes
- Applying Friis equation indoors or in multipath-rich environments without stating assumptions (Friis requires free-space LOS).
- Confusing sensor accuracy (systematic error) with precision (random error).
- Ignoring protocol overhead (headers, retransmissions) when estimating network energy or latency.
- Treating context signals as ground truth — exam answers should mention uncertainty and possible inference errors.
For your exam
Question types you will see:
- Definitions and short notes: define smart device, smart environment, middleware, context-awareness.
- Diagrams: layered architecture, sensing chain, gateway functions. A full-marks answer draws blocks, labels arrows, and briefly notes the role of each block.
- Derivations: compute battery life with duty cycle, show energy conversion between Ah and joules, derive average power.
- Numericals: battery life, RSSI/received power using Friis under stated assumptions, duty-cycle optimization.
- Small algorithm traces: rule-based context inference, MQTT publish/subscribe sequence.
What a full-marks answer includes:
- Clear definitions with bolded key terms, stated assumptions (e.g., "assume periodic operation, constant currents"), units, and step-by-step calculations. For diagrams, include labels and short annotations about data flow and responsibilities.
Quick check
- Define "duty cycle" in one line.
- Give the formula to compute average current when a device alternates active and sleep states.
- State one advantage and one disadvantage of processing at the edge versus the cloud.
Answers: 1) Duty cycle is the fraction of time a device spends in its active (awake) state. 2) I_avg = I_active·D + I_sleep·(1 - D). 3) Advantage of edge: lower latency and better privacy; Disadvantage: limited compute and energy resources.
Finished this topic? Mark it so your progress, study plan and readiness keep up.
Stuck on something here?