IoT lab viva notes

Tavish Gupta, 23BCP064

Rapid-fire viva questions

Short questions an examiner can fire at you, across all eight experiments. Answer out loud first, then open the answer.

Numbers to know cold

ThingValueWhere
LED resistor, current220 Ω, about 13.6 mAExp 1, 2
Pull-down resistor10 kΩExp 1
Arduino ADC10-bit, 0 to 1023, about 4.9 mV per stepExp 2
ESP32 ADC12-bit, 0 to 4095Exp 3, 4
PWM range, frequency0 to 255, about 490 HzExp 2
HC-SR0440 kHz, 10 µs trigger, 2 to 400 cm, 0.0343 cm/µsExp 2
Servo signal50 Hz (20 ms), 544 to 2400 µs in ESP32ServoExp 3
DHT220 to 100 %RH, −40 to 80 °C, every 2 s, 40 bitsExp 4
Bluetooth Classic2.4 GHz, 79 channels, 1600 hops/s, 1 master + 7 slavesExp 5
HTTPport 80, 200 OK, blank line ends the headersExp 6
GSMCtrl+Z = byte 26, peaks about 2 A, +CREG: 0,1 = registeredExp 7
Baud rates9600 on Arduino sketches, 115200 on most ESP32 sketchesall

Mixed questions

Quick fire

Why is pin 13 special on the UNO?

It is wired to the on-board LED, LED_BUILTIN.

What does Serial.available() return?

The number of received bytes waiting in the buffer.

Active or passive buzzer for a melody?

Passive, driven with tone(). An active buzzer has one fixed pitch.

Which function measures the echo pulse?

pulseIn(echoPin, HIGH), in microseconds.

What does map(163, 0, 1023, 0, 255) return?

40 (40.6, with the fraction dropped).

What library drives a servo on ESP32?

ESP32Servo, which uses the LEDC PWM peripheral.

What are NO and NC?

Normally open and normally closed relay contacts.

What does isnan() protect against?

Using a failed DHT reading, returned as NaN.

What is DO on the LDR module?

The LM393 comparator’s digital output: bright or dark relative to the trimmer setting.

What profile does Bluetooth serial use?

SPP, the Serial Port Profile, over RFCOMM.

What does WL_CONNECTED mean?

The ESP32 has joined the Wi-Fi network.

How does the web server know the request ended?

An empty line after the headers.

AT command for SMS text mode?

AT+CMGF=1.

Why SoftwareSerial on the Uno?

The single hardware UART is used by USB for the PC.

What must loop() call in Arduino Cloud sketches?

ArduinoCloud.update().

What protocol does Arduino IoT Cloud use?

MQTT over TLS.

One step further

Name a blocking function in your code and its cost.

delay(). While it runs, nothing else happens: no sensor reading, no serial handling. pulseIn() also blocks until the echo ends or times out.

Where in your code is integer division a trap?

Ultrasonic: duration / 2 is integer division, and storing the result in int distance drops the decimals. map() also uses integer maths.

Which experiments would break on 5 V logic?

Anything wiring 5 V signals into the ESP32 (Exp 3 to 8) without a divider, since ESP32 pins are 3.3 V.

How do the four wireless methods compare for range?

Bluetooth about 10 m, Wi-Fi one building, GSM anywhere with 2G coverage, cloud anywhere with internet.

Compare and contrast

PairThe difference in one line
digitalWrite vs analogWritetwo levels vs PWM duty 0 to 255
digitalRead vs analogReadHIGH/LOW vs 0 to 1023 (ESP32: 0 to 4095)
pull-up vs pull-downidle HIGH, press pulls LOW vs idle LOW, press pulls HIGH
servo vs DC motorholds an angle with feedback vs just spins
relay vs transistorisolated mechanical switch, slow vs electronic switch, fast, not isolated
DHT22 vs DHT11wider range, ±0.5 °C, 2 s vs narrower, ±2 °C, 1 s
Bluetooth vs Wi-Fipaired point-to-point, short range vs networked, reachable by IP address
HTTP vs MQTTrequest-response, client asks vs publish-subscribe through a broker, pushed
Station vs access pointjoins a router vs is the network

How to answer well

  • Lead with the one-line answer, then one reason: “It’s a pull-down, so the pin reads LOW when the button is open.”
  • Point at your code, for example: on line 10, pinMode(buttonPin, INPUT) makes the button pin an input.
  • Use the numbers: 220 Ω, 13.6 mA, 1023, 255, 0.0343, 50 Hz, 2 s, port 80, byte 26.
  • Know your quirks before they are found: the LED that stays on after the button, the buzzer pin without pinMode in the ultrasonic code, the LDR LED lighting in bright light, the board in the GSM photo.
  • If you do not know, say what you would check: the datasheet, the Serial Monitor output, or a quick test.