Unit 2 of 3 · M.Sc IT Sem 4

Unit 2: Hardware and software components

IoT and Its Applications notes · PTU syllabus (PGCA1943)

3 min read4 topics9 exam questions
On this page
  1. Unit summary
  2. Computing platforms
  3. I/O interfaces
  4. Programming APIs
  5. Communication protocols
  6. Key terms
  7. Quick revision
  8. Important questions

Unit summary

IoT devices combine computing boards, sensors and communication modules programmed through APIs. This unit covers Arduino and Raspberry Pi, communication and I/O interfaces, programming with Python, Node.js and Arduino, and protocols — MQTT, ZigBee, Bluetooth, CoAP, UDP and TCP.

After this unit you can

  • Compare Arduino and Raspberry Pi
  • Explain I/O interfaces — GPIO, ADC, PWM, UART, I2C, SPI
  • Program devices in Arduino C and Python
  • Compare IoT communication protocols

PTU syllabus topics

  • Computing platforms (Arduino, Raspberry Pi)
  • communication
  • sensing and actuation
  • I/O interfaces
  • programming APIs using Python/Node.js/Arduino
  • communication protocols — MQTT
  • ZigBee
  • Bluetooth
  • CoAP
  • UDP
  • TCP
ComparisonIoT communication protocols
Type
Best for

MQTT

Publish-subscribe over TCP

Lightweight telemetry

CoAP

Request-response over UDP

Constrained devices

ZigBee

Low-power mesh radio

Home and industrial sensors

Bluetooth LE

Short-range, low power

Wearables, phones

1

Topic 1

Computing platforms

ComparisonArduino vs Raspberry Pi
Arduino Uno
Raspberry Pi 4

Type

Microcontroller (ATmega328P)

Single-board computer (ARM Cortex-A72)

OS

None — runs one sketch

Linux (Raspberry Pi OS)

Clock and memory

16 MHz, 2 KB RAM

1.5 GHz, 2–8 GB RAM

Analog input

Yes (6 ADC pins)

No (needs external ADC)

Best for

Real-time sensing and control, low power

Networking, cameras, databases, gateways

  • ESP8266 and ESP32 add built-in Wi-Fi (ESP32 also Bluetooth) at low cost.
2

Topic 2

I/O interfaces

Key termsInterfaces
GPIO
Digital input and output pins
ADC
Reads analog voltages
PWM
Simulated analog output — LED dimming, motor speed
UART
Serial, two wires (TX, RX)
I2C
Two-wire bus (SDA, SCL) with addresses — OLEDs, sensors
SPI
Fast four-wire bus — SD cards, displays
3

Topic 3

Programming APIs

cpp// Arduino: read DHT11 and blink LED if hot
#include <DHT.h>
DHT dht(2, DHT11);
void setup() { Serial.begin(9600); dht.begin(); pinMode(13, OUTPUT); }
void loop() {
  float t = dht.readTemperature();
  Serial.println(t);
  digitalWrite(13, t > 30 ? HIGH : LOW);
  delay(2000);
}
python# Raspberry Pi: LED on GPIO 17 with gpiozero
from gpiozero import LED, Button
from signal import pause
led, btn = LED(17), Button(2)
btn.when_pressed = led.toggle
pause()
  • Node.js (Johnny-Five, Node-RED) builds event-driven IoT apps and flows.
4

Topic 4

Communication protocols

ComparisonApplication protocols
MQTT
CoAP

Model

Publish–subscribe via a broker

Request–response like REST

Transport

TCP

UDP

Features

Topics, QoS 0/1/2, retained messages, last will

GET, PUT, POST, DELETE; observe; very light

Use

Telemetry to cloud

Constrained devices and networks

pythonimport paho.mqtt.publish as publish
publish.single("sbs/lab/temp", "28.5", hostname="test.mosquitto.org")
ComparisonWireless technologies
Range and rate
Use

Bluetooth and BLE

About 10–100 m; low power (BLE)

Wearables, phones

ZigBee (IEEE 802.15.4)

10–100 m; 250 kbps; mesh

Home and building automation

Wi-Fi

About 50 m; high rate

Cameras, home devices

LoRaWAN

Several km; very low rate

Agriculture, smart meters

NB-IoT and LTE-M

Cellular wide area

Utility meters, trackers

ComparisonTransport protocols
TCP
UDP

Connection

Connection-oriented, reliable, ordered

Connectionless, no guarantees

Overhead

Higher

Lower

IoT use

MQTT, HTTP

CoAP, DNS, streaming

Key terms

Microcontroller
Single chip with CPU, memory and I/O
PWM
Pulse-width modulation
I2C
Two-wire serial bus
MQTT
Lightweight publish–subscribe protocol
CoAP
Constrained Application Protocol over UDP

Quick revision

  • Arduino vs Raspberry Pi; ESP32.
  • GPIO, ADC, PWM, UART, I2C, SPI.
  • Arduino C, Python gpiozero, Node.js.
  • MQTT vs CoAP; Bluetooth, ZigBee, Wi-Fi, LoRaWAN, NB-IoT; TCP vs UDP.

Important exam questions

Practice questions written to the PTU exam pattern for this unit's syllabus: short answers (Section A style) and long answers (Sections B and C style).

Short-answer questions

  1. Q1.Distinguish Arduino and Raspberry Pi.
  2. Q2.What is PWM used for?
  3. Q3.What is I2C?
  4. Q4.Explain MQTT QoS levels.
  5. Q5.Why is CoAP suited to constrained devices?
  6. Q6.Distinguish TCP and UDP.

Long-answer questions

  1. Q1.Compare Arduino and Raspberry Pi as IoT platforms.
  2. Q2.Explain I/O interfaces and programming of IoT devices.
  3. Q3.Compare IoT communication protocols.

Stuck on this unit?

Message SBS on WhatsApp for help with IoT and Its Applications, or to ask about studying M.Sc IT at Synetic.

WhatsApp us