Introduction to IoT

Unit 5: Actuators & Motors

From DC motors to servos and relays โ€” master the output side of IoT. Make things move, spin, and switch using Arduino.

โฑ๏ธ Time to Complete: 6โ€“8 hours  |  ๐Ÿ’ฐ Build a DIY Robot Car for โ‚น500  |  ๐Ÿ“ 30 MCQs (Bloom's Mapped)

๐Ÿ’ผ Skills unlocked: Motor control, PWM speed regulation, Servo positioning, Relay switching, H-bridge driver circuits

Section 1

What are Actuators?

๐Ÿ”ง Sensors See, Actuators DO

In Unit 3 and 4, you learned how sensors let your Arduino "see" the world โ€” temperature, light, distance, motion. But what good is sensing if your system can't act on it? Actuators are the muscles of IoT. They convert electrical signals into physical motion, force, or action.

When your smart fan turns on because the temperature crossed 35ยฐC โ€” that's an actuator (motor). When your automatic door opens โ€” that's an actuator (servo). When Alexa turns on your tube light โ€” that's an actuator (relay). Without actuators, IoT would just be "I" โ€” the Internet of sensors staring at data, doing nothing.

Types of Actuators in IoT

โšก Actuator Classification

An actuator is a device that converts an electrical signal into a physical output โ€” motion, rotation, linear displacement, sound, or switching.

Actuator TypeWhat It DoesExampleIoT Use Case
DC MotorContinuous rotationFan, car wheelRobot car, conveyor belt
Servo MotorPrecise angular rotation (0ยฐโ€“180ยฐ)Robot arm, door lockAutomated gate, camera pan/tilt
Stepper MotorDiscrete step rotation (precise)3D printer, CNCPrecision positioning
SolenoidLinear push/pull motionDoor lock, valveAutomatic door lock
RelayElectrical switch (ON/OFF)Light switchHome automation (AC appliances)
Piezo BuzzerProduces soundAlarm beepAlert system, doorbell
LEDProduces lightIndicatorStatus display, smart lighting
Every IoT system follows the Sense โ†’ Process โ†’ Act loop. Sensors handle "Sense," the microcontroller handles "Process," and actuators handle "Act." Without actuators, your Arduino project is like a brain without hands โ€” it can think but can't do anything!
Indian startups like Stellapps use actuators in smart dairy farming. Temperature sensors detect when milk is getting warm, and a relay-controlled refrigeration compressor kicks in automatically. This IoT system prevents spoilage of 10,000+ litres of milk daily across Karnataka's dairy cooperatives โ€” saving lakhs of rupees.

In this unit, we'll focus on the three most important actuators for IoT beginners: DC Motors, Servo Motors, and Relay Modules. These three cover 90% of all student IoT projects.

Section 2

DC Motor Basics โ€” How It Works

The Science Inside a DC Motor

A DC motor converts electrical energy into mechanical rotational energy. Inside, it has a coil of wire (armature) sitting inside a magnetic field. When current flows through the coil, it creates a force (Lorentz force) that makes the coil spin. The direction of spin depends on the direction of current.

๐Ÿ”„ DC Motor Key Parameters

ParameterWhat It MeansTypical Value (Small Hobby Motor)
Operating VoltageVoltage needed to run the motor3V โ€“ 12V
Current DrawCurrent consumed when running100mA โ€“ 300mA (no load), up to 1A (stall)
RPMRotations Per Minute โ€” speed3000 โ€“ 15000 RPM
TorqueRotational forceLow (needs gearbox for heavy loads)
Stall CurrentCurrent when motor is blocked/stuck500mA โ€“ 2A (dangerous!)

Why You CANNOT Connect a DC Motor Directly to Arduino

This is the #1 mistake every beginner makes. Let's understand why:

Connecting a motor directly to Arduino digital pin will DAMAGE your Arduino!

Arduino digital pin can supply: Maximum 20mA (recommended), 40mA (absolute max).
DC motor needs: 100โ€“300mA minimum, up to 1A when starting or stalling.

That's 5โ€“50ร— more current than Arduino can provide. Doing this can burn out the ATmega328P chip permanently. Additionally, motors generate back-EMF (voltage spikes) when turning off, which can fry the microcontroller.

The Solution? Use a motor driver IC like the L293D. The motor driver acts as a middleman โ€” it takes the small control signal from Arduino and uses a separate power supply to drive the motor with the current it needs.

Analogy
Think of it like this:

Arduino Pin  =  TV Remote      (sends signal, tiny power)
Motor Driver =  AC Power Socket (provides actual power)
DC Motor     =  Television      (needs real power to work)

You use the remote to CONTROL what happens,
but the TV gets its POWER from the wall socket.
The motor driver is that wall socket for your motor.
Always use a separate power source for motors. Even with a motor driver, power the motor from a battery pack (4ร—AA = 6V works great), NOT from Arduino's 5V pin. Arduino's 5V regulator can only supply ~500mA total, and motors can spike well beyond that.
Section 3

L293D Motor Driver โ€” Dual H-Bridge IC

What is an H-Bridge?

An H-bridge is a circuit that allows you to control the direction of a DC motor. It uses 4 switches arranged in an "H" shape. By toggling different pairs of switches, current flows through the motor in either direction:

ASCII
         H-Bridge Circuit
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚                         โ”‚
    โ”‚   S1 โ”€โ”€โ”     โ”Œโ”€โ”€ S3    โ”‚
    โ”‚        โ”‚     โ”‚          โ”‚
  +V โ”โ”โ”โ”โ”โ”โ”โ”ซ     โ”ฃโ”โ”โ”โ”โ”โ”โ” +V
    โ”‚        โ”‚     โ”‚          โ”‚
    โ”‚     โ”Œโ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”       โ”‚
    โ”‚     โ”‚   MOTOR   โ”‚       โ”‚
    โ”‚     โ”‚  โŸฒ  or  โŸณ โ”‚       โ”‚
    โ”‚     โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”˜       โ”‚
    โ”‚        โ”‚     โ”‚          โ”‚
  GND โ”โ”โ”โ”โ”โ”โ”ซ     โ”ฃโ”โ”โ”โ”โ”โ” GND
    โ”‚        โ”‚     โ”‚          โ”‚
    โ”‚   S2 โ”€โ”€โ”˜     โ””โ”€โ”€ S4    โ”‚
    โ”‚                         โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

  FORWARD:  S1=ON, S4=ON, S2=OFF, S3=OFF  โ†’  Current: Left to Right
  REVERSE:  S3=ON, S2=ON, S1=OFF, S4=OFF  โ†’  Current: Right to Left
  BRAKE:    S1=ON, S3=ON (or S2+S4)       โ†’  Motor shorts, stops quickly
  COAST:    All OFF                        โ†’  Motor spins freely to stop

The L293D IC contains two complete H-bridges in a single 16-pin DIP package, meaning it can control 2 motors independently.

L293D Pin Diagram (16-Pin DIP)

ASCII
                    L293D โ€” Top View
              โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    Enable1 โ”€โ”€โ”ค 1    16 โ”œโ”€โ”€ Vss (+5V Logic)
     Input1 โ”€โ”€โ”ค 2    15 โ”œโ”€โ”€ Input4
    Output1 โ”€โ”€โ”ค 3    14 โ”œโ”€โ”€ Output4
        GND โ”€โ”€โ”ค 4    13 โ”œโ”€โ”€ GND
        GND โ”€โ”€โ”ค 5    12 โ”œโ”€โ”€ GND
    Output2 โ”€โ”€โ”ค 6    11 โ”œโ”€โ”€ Output3
     Input2 โ”€โ”€โ”ค 7    10 โ”œโ”€โ”€ Input3
  Vs (Motor) โ”€โ”ค 8     9 โ”œโ”€โ”€ Enable2
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    Pin 16 (Vss) = +5V (Logic supply from Arduino)
    Pin  8 (Vs)  = Motor supply voltage (6Vโ€“12V from battery)
    Pins 4,5,12,13 = GND (also act as heat sinks)

L293D Pin Functions

PinNameFunction
1Enable1Enables Motor A (HIGH=ON). Connect to PWM pin for speed control.
2Input1Control pin A1 โ€” direction control for Motor A
3Output1Motor A terminal 1 โ€” connect to motor wire
4, 5GNDGround (solder to copper ground plane for heat dissipation)
6Output2Motor A terminal 2 โ€” connect to other motor wire
7Input2Control pin A2 โ€” direction control for Motor A
8VsMotor power supply (6Vโ€“12V from battery pack)
9Enable2Enables Motor B (HIGH=ON). Connect to PWM pin for speed control.
10Input3Control pin B1 โ€” direction control for Motor B
11Output3Motor B terminal 1
12, 13GNDGround (heat sink)
14Output4Motor B terminal 2
15Input4Control pin B2 โ€” direction control for Motor B
16VssLogic supply voltage (+5V from Arduino)

L293D Truth Table โ€” Direction Control

EnableInput1Input2Motor Action
HIGHHIGHLOWโŸณ Forward (clockwise)
HIGHLOWHIGHโŸฒ Reverse (counter-clockwise)
HIGHHIGHHIGH๐Ÿ›‘ Brake (motor locked)
HIGHLOWLOWโธ Coast (motor free-spins to stop)
LOWXXโน Motor OFF (disabled)
Speed control via PWM: Instead of connecting Enable1 to constant HIGH, connect it to an Arduino PWM pin (~3, ~5, ~6, ~9, ~10, ~11). Use analogWrite(enablePin, speed) where speed is 0โ€“255. At 0, motor is off; at 127, motor runs at ~50% speed; at 255, full speed.
L293D costs just โ‚น25โ€“โ‚น40 on Robu.in, Amazon.in, or local SP Road (Bangalore) / Lamington Road (Mumbai) electronics markets. For a complete motor driver setup with IC + socket + 2 motors + battery holder, you're looking at under โ‚น150. Compare that to a pre-built motor shield at โ‚น350โ€“โ‚น500. Understanding the raw IC saves you money and teaches you more.
Section 4

Interfacing DC Motor with Arduino via L293D

Circuit Diagram

ASCII Circuit
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚              ARDUINO UNO                     โ”‚
    โ”‚                                              โ”‚
    โ”‚  Pin 9  (PWM) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Enable1 (Pin 1)   โ”‚
    โ”‚  Pin 2  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Input1  (Pin 2)   โ”‚
    โ”‚  Pin 3  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Input2  (Pin 7)   โ”‚
    โ”‚  5V     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Vss     (Pin 16)  โ”‚
    โ”‚  GND    โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ GND  (Pin 4,5,    โ”‚
    โ”‚           โ”‚                       12,13)     โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                โ”‚
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚  L293D    โ”‚                                   โ”‚
    โ”‚           โ”‚                                   โ”‚
    โ”‚  Output1 (Pin 3) โ”€โ”€โ”€โ”€โ”€โ”€ Motor Terminal A      โ”‚
    โ”‚  Output2 (Pin 6) โ”€โ”€โ”€โ”€โ”€โ”€ Motor Terminal B      โ”‚
    โ”‚                                               โ”‚
    โ”‚  Vs (Pin 8) โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Battery + (6Vโ€“9V)    โ”‚
    โ”‚  GND (Pin 4,5,12,13) โ”€โ”€ Battery GND โ”€โ”€ Ard GNDโ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    โšก Battery Pack: 4ร—AA (6V) or 9V battery
    โš ๏ธ Common GND between Arduino and Battery is CRITICAL!

Connection Table

Arduino PinL293D PinPurpose
Pin 9 (PWM ~)Pin 1 (Enable1)Speed control via PWM
Pin 2Pin 2 (Input1)Direction control A
Pin 3Pin 7 (Input2)Direction control B
5VPin 16 (Vss)Logic power supply
GNDPins 4, 5, 12, 13Common ground
โ€”Pin 8 (Vs)Battery positive (6Vโ€“9V)
โ€”Pins 3, 6 (Outputs)Motor terminals

Arduino Code: Forward, Reverse, Stop

Arduino
// DC Motor Control with L293D
// Forward โ†’ Reverse โ†’ Stop (repeat)

const int enablePin = 9;   // PWM pin for speed
const int in1 = 2;         // Input1 of L293D
const int in2 = 3;         // Input2 of L293D

void setup() {
  pinMode(enablePin, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
  analogWrite(enablePin, 200);  // ~78% speed
}

void loop() {
  // โ”€โ”€ FORWARD โ”€โ”€
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  delay(3000);  // Run forward for 3 seconds

  // โ”€โ”€ STOP โ”€โ”€
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(1000);  // Pause 1 second

  // โ”€โ”€ REVERSE โ”€โ”€
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  delay(3000);  // Run reverse for 3 seconds

  // โ”€โ”€ STOP โ”€โ”€
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(1000);
}

Speed Control with analogWrite

Arduino
// Gradually increase speed, then decrease

void loop() {
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);

  // Ramp UP: 0 โ†’ 255
  for (int speed = 0; speed <= 255; speed += 5) {
    analogWrite(enablePin, speed);
    delay(50);
  }

  // Ramp DOWN: 255 โ†’ 0
  for (int speed = 255; speed >= 0; speed -= 5) {
    analogWrite(enablePin, speed);
    delay(50);
  }

  delay(1000);
}
Motor doesn't spin? Check these in order: (1) Is Battery connected? L293D needs external motor power on Pin 8. (2) Is Enable pin HIGH or receiving PWM? If LOW, motor won't run regardless of Input pins. (3) Is GND common between Arduino and battery? (4) Are motor wires making solid contact with Output pins?
Section 5

Controlling Direction & Speed via Serial Monitor

Let's build an interactive motor controller. You type a command in the Serial Monitor, and the motor responds:

Arduino
// Interactive DC Motor Control via Serial
// Commands: F = Forward, B = Backward, S = Stop
// Speed: 0-9 (0=off, 9=max)

const int enablePin = 9;
const int in1 = 2;
const int in2 = 3;
int motorSpeed = 200;

void setup() {
  Serial.begin(9600);
  pinMode(enablePin, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);

  Serial.println("=== DC Motor Controller ===");
  Serial.println("Commands:");
  Serial.println("  F = Forward");
  Serial.println("  B = Backward");
  Serial.println("  S = Stop");
  Serial.println("  0-9 = Speed (0=off, 9=max)");
}

void loop() {
  if (Serial.available() > 0) {
    char cmd = Serial.read();

    switch (cmd) {
      case 'F':
      case 'f':
        digitalWrite(in1, HIGH);
        digitalWrite(in2, LOW);
        analogWrite(enablePin, motorSpeed);
        Serial.print("โ–ถ Forward at speed: ");
        Serial.println(motorSpeed);
        break;

      case 'B':
      case 'b':
        digitalWrite(in1, LOW);
        digitalWrite(in2, HIGH);
        analogWrite(enablePin, motorSpeed);
        Serial.print("โ—€ Backward at speed: ");
        Serial.println(motorSpeed);
        break;

      case 'S':
      case 's':
        digitalWrite(in1, LOW);
        digitalWrite(in2, LOW);
        analogWrite(enablePin, 0);
        Serial.println("โน Motor STOPPED");
        break;

      default:
        // Check if it's a speed digit 0-9
        if (cmd >= '0' && cmd <= '9') {
          motorSpeed = map(cmd - '0', 0, 9, 0, 255);
          analogWrite(enablePin, motorSpeed);
          Serial.print("๐Ÿ”ง Speed set to: ");
          Serial.println(motorSpeed);
        }
        break;
    }
  }
}
=== DC Motor Controller === Commands: F = Forward B = Backward S = Stop 0-9 = Speed (0=off, 9=max) โ–ถ Forward at speed: 200 ๐Ÿ”ง Speed set to: 141 โ—€ Backward at speed: 141 โน Motor STOPPED
Extend this project: Add commands "L" and "R" for left and right turns (useful when you connect 2 motors). Add a "+" and "โˆ’" command to increment/decrement speed by 25. This is the foundation of a Bluetooth-controlled robot car!
Section 6

Multiple DC Motors โ€” Robot Car Concept

The L293D can drive 2 DC motors simultaneously โ€” perfect for a 2-wheel drive (2WD) robot car. Motor A controls the left wheel, Motor B controls the right wheel.

Robot Car Movement Logic

MovementLeft Motor (A)Right Motor (B)
โฌ†๏ธ ForwardForwardForward
โฌ‡๏ธ BackwardReverseReverse
โฌ…๏ธ Turn LeftStop (or Reverse)Forward
โžก๏ธ Turn RightForwardStop (or Reverse)
๐Ÿ”„ Spin LeftReverseForward
๐Ÿ”„ Spin RightForwardReverse
โน StopStopStop
Arduino
// 2WD Robot Car โ€” Full Motor Control

// Motor A (Left)
const int enA = 9;
const int in1 = 2;
const int in2 = 3;

// Motor B (Right)
const int enB = 10;
const int in3 = 4;
const int in4 = 5;

int speed = 200;

void setup() {
  pinMode(enA, OUTPUT);  pinMode(enB, OUTPUT);
  pinMode(in1, OUTPUT);  pinMode(in2, OUTPUT);
  pinMode(in3, OUTPUT);  pinMode(in4, OUTPUT);
}

void moveForward() {
  analogWrite(enA, speed); analogWrite(enB, speed);
  digitalWrite(in1, HIGH); digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH); digitalWrite(in4, LOW);
}

void moveBackward() {
  analogWrite(enA, speed); analogWrite(enB, speed);
  digitalWrite(in1, LOW);  digitalWrite(in2, HIGH);
  digitalWrite(in3, LOW);  digitalWrite(in4, HIGH);
}

void turnLeft() {
  analogWrite(enA, 0);     analogWrite(enB, speed);
  digitalWrite(in1, LOW);  digitalWrite(in2, LOW);
  digitalWrite(in3, HIGH); digitalWrite(in4, LOW);
}

void turnRight() {
  analogWrite(enA, speed); analogWrite(enB, 0);
  digitalWrite(in1, HIGH); digitalWrite(in2, LOW);
  digitalWrite(in3, LOW);  digitalWrite(in4, LOW);
}

void stopMotors() {
  analogWrite(enA, 0); analogWrite(enB, 0);
  digitalWrite(in1, LOW); digitalWrite(in2, LOW);
  digitalWrite(in3, LOW); digitalWrite(in4, LOW);
}

void loop() {
  moveForward();   delay(2000);
  turnRight();     delay(800);
  moveForward();   delay(2000);
  turnLeft();      delay(800);
  moveBackward(); delay(1000);
  stopMotors();    delay(2000);
}
DIY Robot Car for โ‚น500 vs โ‚น5,000 Commercial Kit

You can build a fully functional 2WD robot car for under โ‚น500:
โ€ข Arduino Uno clone: โ‚น250 (Robu.in)
โ€ข L293D IC: โ‚น30
โ€ข 2ร— BO motors with wheels: โ‚น80
โ€ข Battery holder (4ร—AA): โ‚น20
โ€ข Chassis (cardboard/acrylic cut): โ‚น30
โ€ข Jumper wires: โ‚น40
โ€ข Castor wheel: โ‚น25
Total: โ‚น475

Compare this to commercial robot car kits on Amazon.in that cost โ‚น3,000โ€“โ‚น5,000 โ€” and you'll learn 10ร— more building it yourself. Add an HC-05 Bluetooth module (โ‚น180) and control it from your phone!
Section 7

Servo Motor โ€” Precise Angle Control

How a Servo Motor Works

A servo motor is NOT like a DC motor. It doesn't just spin continuously. Instead, it moves to a specific angle and holds that position. It contains:

๐ŸŽฏ Inside a Servo Motor โ€” The Feedback Loop

 โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
 โ”‚                SERVO MOTOR                     โ”‚
 โ”‚                                                โ”‚
 โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
 โ”‚  โ”‚ CONTROL  โ”‚โ”€โ”€โ”€โ–ถโ”‚   DC     โ”‚โ”€โ”€โ”€โ–ถโ”‚  GEAR    โ”‚ โ”‚
 โ”‚  โ”‚ CIRCUIT  โ”‚    โ”‚  MOTOR   โ”‚    โ”‚  TRAIN   โ”‚โ”€โ”€โ”€โ”€ OUTPUT
 โ”‚  โ”‚          โ”‚    โ”‚          โ”‚    โ”‚          โ”‚ โ”‚   SHAFT
 โ”‚  โ””โ”€โ”€โ”€โ”€โ–ฒโ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
 โ”‚       โ”‚                               โ”‚       โ”‚
 โ”‚       โ”‚         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”          โ”‚       โ”‚
 โ”‚       โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚ POSITION โ”‚โ—€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
 โ”‚                 โ”‚ SENSOR   โ”‚  (Potentiometer)  โ”‚
 โ”‚                 โ”‚ (Feedback)โ”‚                   โ”‚
 โ”‚                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ”‚
 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

 1. Arduino sends PWM signal (pulse width = desired angle)
 2. Control circuit compares desired angle vs actual angle
 3. If there's a difference, motor rotates to correct it
 4. Potentiometer on shaft reports actual position
 5. When desired = actual โ†’ motor stops โ†’ holds position
 THIS IS A CLOSED-LOOP FEEDBACK SYSTEM!

Types of Servo Motors

FeatureStandard Servo (180ยฐ)Continuous Rotation Servo
Rotation Range0ยฐ to 180ยฐ (half circle)Full 360ยฐ continuous
Controlservo.write(angle) โ€” sets positionservo.write(speed) โ€” 90=stop, 0=full CW, 180=full CCW
Use CaseRobot arm, gate, camera panWheels, winch, continuous rotation
Has Feedback?Yes โ€” holds exact angleNo position feedback (just speed control)

SG90 Micro Servo โ€” The IoT Workhorse

SpecificationValue
Operating Voltage4.8V โ€“ 6V
Torque1.8 kgยทcm (at 4.8V)
Speed0.1 sec / 60ยฐ (at 4.8V)
Rotation Range0ยฐ โ€“ 180ยฐ
Weight9 grams
SignalPWM (50Hz, 1โ€“2ms pulse width)
Price (India)โ‚น60 โ€“ โ‚น100
ASCII
  Servo PWM Signal (50Hz = 20ms period)

  0ยฐ  (1.0ms pulse):  โ”ƒโ–ˆโ–ˆโ–ˆโ–ˆโ”ƒ                    โ”ƒโ–ˆโ–ˆโ–ˆโ–ˆโ”ƒ
  90ยฐ (1.5ms pulse):  โ”ƒโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ”ƒ                  โ”ƒโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ”ƒ
  180ยฐ(2.0ms pulse):  โ”ƒโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ”ƒ                โ”ƒโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ”ƒ
                      โ”œโ”€โ”€ 20ms (1 period) โ”€โ”€โ”€โ”€โ”€โ”€โ”ค

  Pulse Width  โ†’  Servo Position
  1.0 ms       โ†’  0ยฐ (full left)
  1.5 ms       โ†’  90ยฐ (centre)
  2.0 ms       โ†’  180ยฐ (full right)
The SG90 servo costs โ‚น60โ€“โ‚น100 and can lift about 1.8 kg at 1 cm distance. That's enough to move a small robot arm, open a lock mechanism, or control a camera angle. For heavier loads, use the MG996R servo (โ‚น250โ€“โ‚น350) which provides 10 kgยทcm torque โ€” enough to steer a RC car or move a real gate latch.
Section 8

Interfacing Servo Motor with Arduino

Circuit Diagram

ASCII Circuit
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚   ARDUINO UNO      โ”‚
    โ”‚                    โ”‚
    โ”‚   Pin 9  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€ Orange/Yellow (Signal)
    โ”‚   5V     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€ Red    (VCC)
    โ”‚   GND    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€ Brown  (GND)
    โ”‚                    โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                  โ”‚  SG90    โ”‚
         Signal โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  SERVO   โ”‚
         VCC    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚  MOTOR   โ”‚
         GND    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”‚          โ”‚
                                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    โš ๏ธ SG90 has 3 wires:
       ๐ŸŸค Brown  = GND
       ๐Ÿ”ด Red    = VCC (+5V)
       ๐ŸŸ  Orange = Signal (PWM)

    ๐Ÿ’ก For 1โ€“2 servos, Arduino 5V is fine.
    โšก For 3+ servos, use external 5V power supply!

Connection Table

Servo WireColorArduino PinPurpose
SignalOrange / Yellow / WhitePin 9 (PWM)Control angle via PWM
VCCRed5VPower supply
GNDBrown / BlackGNDGround reference

Arduino Code โ€” Servo Sweep

Arduino
// Servo Sweep: 0ยฐ โ†’ 180ยฐ โ†’ 0ยฐ continuously
// Uses the built-in Servo library

#include <Servo.h>

Servo myServo;  // Create servo object

void setup() {
  myServo.attach(9);  // Attach servo to Pin 9
  Serial.begin(9600);
}

void loop() {
  // Sweep from 0ยฐ to 180ยฐ
  for (int angle = 0; angle <= 180; angle++) {
    myServo.write(angle);
    Serial.print("Angle: ");
    Serial.println(angle);
    delay(15);  // 15ms for smooth motion
  }

  // Sweep from 180ยฐ to 0ยฐ
  for (int angle = 180; angle >= 0; angle--) {
    myServo.write(angle);
    Serial.print("Angle: ");
    Serial.println(angle);
    delay(15);
  }
}

Key Servo Library Functions

FunctionWhat It DoesExample
Servo myServo;Creates a servo objectCan create up to 12 on Uno
myServo.attach(pin)Connects servo to a pinmyServo.attach(9);
myServo.write(angle)Moves servo to angle (0โ€“180)myServo.write(90); โ†’ centre
myServo.read()Returns current angleint pos = myServo.read();
myServo.detach()Disconnects servo (saves power)myServo.detach();
Servo jitter fix: If your servo vibrates or jitters at a position, it's usually because of power supply noise. Add a 100ยตF electrolytic capacitor across the servo's VCC and GND pins. This smooths out voltage dips when the servo draws sudden current.
Don't use delay() for long periods when using servos. The Servo library generates PWM signals in the background. A long delay() is fine โ€” the servo holds position. BUT if you use delayMicroseconds() for very long periods or disable interrupts, the servo signal may glitch. Use millis()-based timing for complex projects.
Section 9

Potentiometer-Controlled Servo

This is one of the most satisfying IoT circuits to build โ€” turn a knob and watch the servo follow your hand in real-time!

Circuit Diagram

ASCII Circuit
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚              ARDUINO UNO                    โ”‚
    โ”‚                                             โ”‚
    โ”‚   A0 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Potentiometer WIPER       โ”‚
    โ”‚   Pin 9 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Servo Signal (Orange)     โ”‚
    โ”‚   5V โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Servo VCC (Red)           โ”‚
    โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Pot Pin 1 (VCC)           โ”‚
    โ”‚   GND โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Servo GND (Brown)         โ”‚
    โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Pot Pin 3 (GND)           โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    POTENTIOMETER (10Kฮฉ)
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚   1     2     3 โ”‚
    โ”‚  VCC  WIPER  GNDโ”‚
    โ”‚  (+5V) (A0)     โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    Turn the knob โ†’ Voltage at A0 changes (0Vโ€“5V)
    Arduino reads: 0โ€“1023 โ†’ maps to 0ยฐโ€“180ยฐ
    Servo follows the knob position!

Connection Table

ComponentPinArduino Pin
Potentiometer Pin 1VCC5V
Potentiometer Pin 2Wiper (output)A0
Potentiometer Pin 3GNDGND
Servo SignalOrangePin 9
Servo VCCRed5V
Servo GNDBrownGND

Arduino Code

Arduino
// Potentiometer-Controlled Servo Motor
// Turn the knob โ†’ servo follows

#include <Servo.h>

Servo myServo;
const int potPin = A0;  // Analog input

void setup() {
  myServo.attach(9);
  Serial.begin(9600);
}

void loop() {
  int potValue = analogRead(potPin);  // Read: 0โ€“1023
  int angle = map(potValue, 0, 1023, 0, 180);  // Map to 0ยฐโ€“180ยฐ

  myServo.write(angle);  // Move servo

  Serial.print("Pot: ");
  Serial.print(potValue);
  Serial.print(" โ†’ Angle: ");
  Serial.println(angle);

  delay(15);  // Small delay for stability
}
Pot: 0 โ†’ Angle: 0 Pot: 256 โ†’ Angle: 45 Pot: 512 โ†’ Angle: 90 Pot: 768 โ†’ Angle: 135 Pot: 1023 โ†’ Angle: 180
The map() function is your best friend in IoT. It linearly scales one range to another. Syntax: map(value, fromLow, fromHigh, toLow, toHigh). Use it everywhere: sensor readings to LED brightness, joystick values to motor speed, temperature to fan speed, etc.
Make it smarter: Replace the potentiometer with an ultrasonic sensor (HC-SR04). Map distance (2โ€“30cm) to servo angle (0ยฐโ€“180ยฐ). Now you have a radar-style scanner! Add an LED that turns red when an object is closer than 10cm.
Section 10

Relay Module โ€” Controlling AC Appliances

How a Relay Works

A relay is an electrically operated switch. It uses a small DC signal (from Arduino) to control a much larger AC circuit (like a tube light, fan, or water pump). Think of it as a tiny servant โ€” Arduino whispers "turn on," and the relay flips a heavy switch that your Arduino could never handle alone.

๐Ÿ”Œ Relay Internal Structure

      DC Control Side           AC Load Side
      (Arduino)                 (Appliance)
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚                                         โ”‚
    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”        โ”Œโ”€โ”€โ”€ COM (Common)  โ”‚
    โ”‚  โ”‚   COIL   โ”‚        โ”‚                  โ”‚
    โ”‚  โ”‚ (5V DC)  โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”คโ”€โ”€โ”€ NO (Normally  โ”‚
    โ”‚  โ”‚          โ”‚   โ”‚    โ”‚    Open)          โ”‚
    โ”‚  โ””โ”€โ”€โ”ฌโ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”˜   โ”‚    โ”‚                  โ”‚
    โ”‚     โ”‚   โ”‚    โ”Œโ”€โ”€โ”ดโ”€โ”€โ” โ””โ”€โ”€โ”€ NC (Normally  โ”‚
    โ”‚     โ”‚   โ”‚    โ”‚SWITCHโ”‚     Closed)        โ”‚
    โ”‚     โ”‚   โ”‚    โ”‚(Reed)โ”‚                    โ”‚
    โ”‚  Signal GND  โ””โ”€โ”€โ”€โ”€โ”€โ”˜                    โ”‚
    โ”‚                                         โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    When Arduino sends HIGH to Signal pin:
    โ†’ Coil energises โ†’ creates magnetic field
    โ†’ Switch moves from NC to NO
    โ†’ Circuit through COM-NO closes โ†’ Appliance turns ON

    When Arduino sends LOW:
    โ†’ Coil de-energises โ†’ spring pulls switch back
    โ†’ Switch returns to NC position
    โ†’ COM-NO opens โ†’ Appliance turns OFF

Three AC terminals explained:

TerminalFull NameMeaning
COMCommonAlways connected โ€” this goes to one wire of your appliance
NONormally OpenDisconnected by default. Connects to COM when relay is ON. Use this for most projects.
NCNormally ClosedConnected by default. Disconnects from COM when relay is ON. Use when you want "always ON, signal turns OFF."

Relay Module Circuit (DC Side โ€” Safe for Students)

ASCII Circuit
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚              ARDUINO UNO                    โ”‚
    โ”‚                                             โ”‚
    โ”‚   Pin 7  โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ IN  (Relay Signal)        โ”‚
    โ”‚   5V     โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ VCC (Relay Power)         โ”‚
    โ”‚   GND    โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ GND (Relay Ground)        โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚         RELAY MODULE (DC Side)              โ”‚
    โ”‚                                             โ”‚
    โ”‚   IN   โ† Signal from Arduino (Pin 7)       โ”‚
    โ”‚   VCC  โ† 5V from Arduino                   โ”‚
    โ”‚   GND  โ† GND from Arduino                  โ”‚
    โ”‚                                             โ”‚
    โ”‚   LED  โ† Indicates relay state (ON/OFF)     โ”‚
    โ”‚                                             โ”‚
    โ”‚   โ”€โ”€โ”€ AC Side (COM, NO, NC) โ”€โ”€โ”€             โ”‚
    โ”‚   โšก DO NOT TOUCH AC SIDE                    โ”‚
    โ”‚   โšก TEACHER SUPERVISION REQUIRED            โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Arduino Code โ€” Relay ON/OFF

Arduino
// Relay Module Control
// Toggle relay every 3 seconds

const int relayPin = 7;

void setup() {
  pinMode(relayPin, OUTPUT);
  digitalWrite(relayPin, LOW);  // Start with relay OFF
  Serial.begin(9600);
  Serial.println("Relay Controller Ready");
}

void loop() {
  // Turn relay ON
  digitalWrite(relayPin, HIGH);
  Serial.println("๐Ÿ’ก Relay ON  โ€” Appliance is running");
  delay(3000);

  // Turn relay OFF
  digitalWrite(relayPin, LOW);
  Serial.println("โšซ Relay OFF โ€” Appliance is stopped");
  delay(3000);
}
AC MAINS (230V in India) CAN KILL. Follow these rules STRICTLY:

๐Ÿ”ด NEVER touch the AC side of a relay module while it's connected to mains power.
๐Ÿ”ด NEVER work with AC wiring without supervision from a qualified teacher or electrician.
๐Ÿ”ด ALWAYS unplug the appliance from the wall socket before making any wiring changes.
๐Ÿ”ด ALWAYS use a relay module with optocoupler isolation (most modules sold in India have this).
๐Ÿ”ด Students should practice with DC loads only (LED strips, DC fans, DC bulbs) until they have proper training.
๐Ÿ”ด Use a 12V DC bulb or LED strip for testing instead of AC mains โ€” same concept, zero danger.

For your lab project: Connect the relay to control a 12V DC LED strip or a 5V USB fan. This demonstrates the relay concept safely without any AC mains involvement.
Home automation with relays is the most popular IoT project in India. Companies like Sonoff and local brands sell WiFi relay modules for โ‚น300โ€“โ‚น500 that turn any regular switchboard into a "smart" switchboard. Add an ESP8266 (โ‚น150) + 4-channel relay module (โ‚น180) and you can control 4 appliances from your phone. This is literally what โ‚น15,000 "smart home kits" from Philips/Wipro do โ€” but you can build it for โ‚น500!
Active LOW vs Active HIGH relay modules: Many relay modules in India (blue ones from Robu/Amazon) are Active LOW โ€” meaning the relay turns ON when you send LOW (0V) and turns OFF when you send HIGH (5V). This is counterintuitive! Check your module's documentation. If the LED lights up when you write LOW, it's Active LOW. Adjust your code accordingly.
Section 11

MCQ Assessment Bank โ€” 30 Questions (Bloom's Mapped)

Remember / Identify (Q1โ€“Q8)

Q1

An actuator converts:

  1. Physical motion into electrical signal
  2. Electrical signal into physical action
  3. Analog signal into digital signal
  4. AC into DC
Remember
โœ… Answer: (B) โ€” An actuator converts an electrical signal into physical action (motion, force, switching). Sensors do the opposite โ€” they convert physical phenomena into electrical signals.
Q2

Which of the following is NOT an actuator?

  1. DC Motor
  2. LDR (Light Dependent Resistor)
  3. Servo Motor
  4. Relay
Remember
โœ… Answer: (B) โ€” LDR is a sensor (detects light intensity), not an actuator. Motors, relays, and servos are all actuators that produce physical output.
Q3

The L293D IC contains how many H-bridges?

  1. 1
  2. 2
  3. 4
  4. 8
Remember
โœ… Answer: (B) โ€” L293D is a Dual H-Bridge IC. It has 2 independent H-bridges, allowing control of 2 DC motors or 1 stepper motor.
Q4

What is the maximum current an Arduino digital pin can safely supply?

  1. 5mA
  2. 20mA
  3. 500mA
  4. 1A
Remember
โœ… Answer: (B) โ€” Arduino UNO digital pins can safely supply up to 20mA (absolute max 40mA). DC motors need 100โ€“300mA, which is why you need a motor driver.
Q5

Pin 8 (Vs) of L293D is used for:

  1. Logic supply voltage (5V)
  2. Motor supply voltage (6Vโ€“12V from battery)
  3. Ground connection
  4. PWM signal input
Remember
โœ… Answer: (B) โ€” Pin 8 (Vs) supplies power to the motors from an external battery (6Vโ€“12V). Pin 16 (Vss) is for logic power (5V from Arduino).
Q6

SG90 servo motor has a rotation range of:

  1. 0ยฐ to 90ยฐ
  2. 0ยฐ to 180ยฐ
  3. 0ยฐ to 270ยฐ
  4. 0ยฐ to 360ยฐ
Remember
โœ… Answer: (B) โ€” The SG90 is a standard servo with 0ยฐ to 180ยฐ range. Continuous rotation servos can do 360ยฐ but lose position feedback.
Q7

Which Arduino library is used to control servo motors?

  1. Motor.h
  2. Servo.h
  3. Stepper.h
  4. Wire.h
Remember
โœ… Answer: (B) โ€” The built-in Servo.h library provides simple functions like attach(), write(), and read() for servo control.
Q8

"NO" on a relay module stands for:

  1. Not Operating
  2. Normally Open
  3. Negative Output
  4. No Output
Remember
โœ… Answer: (B) โ€” NO = Normally Open. The circuit through COM-NO is open (disconnected) by default and closes when the relay is activated.

Understand / Explain (Q9โ€“Q15)

Q9

Why can't you connect a DC motor directly to an Arduino digital pin?

  1. Arduino doesn't support DC motors
  2. The motor requires more current than the pin can supply, risking damage to the microcontroller
  3. DC motors only work with analog pins
  4. The motor needs AC power, not DC
Understand
โœ… Answer: (B) โ€” Arduino pins supply max 20mA; DC motors need 100mAโ€“1A. Exceeding the pin's current limit can burn the ATmega328P. Also, back-EMF from motors can damage the chip.
Q10

In the L293D truth table, when Enable=HIGH, Input1=LOW, Input2=LOW, the motor will:

  1. Spin forward
  2. Spin backward
  3. Brake (locked stop)
  4. Coast (free spin to stop)
Understand
โœ… Answer: (D) โ€” When both inputs are LOW, both output sides go LOW. No current flows, so the motor coasts to a stop under its own inertia (not locked).
Q11

What happens inside a servo motor when the desired angle doesn't match the actual angle?

  1. The servo turns off
  2. The control circuit drives the motor until the position sensor matches the desired angle
  3. The servo makes a buzzing sound and stops
  4. The Arduino automatically adjusts the PWM signal
Understand
โœ… Answer: (B) โ€” Servo uses a closed-loop feedback system. The control circuit compares desired angle (from PWM signal) with actual angle (from internal potentiometer) and drives the motor until they match.
Q12

What is the purpose of the Enable pin on the L293D?

  1. It sets the motor direction
  2. It controls whether the motor driver is active and can be used for PWM speed control
  3. It provides power to the logic circuit
  4. It connects to the motor terminals
Understand
โœ… Answer: (B) โ€” The Enable pin acts as an on/off switch for the H-bridge. When connected to a PWM pin, it controls motor speed via duty cycle modulation.
Q13

Why do relay modules need optocoupler isolation?

  1. To increase the relay switching speed
  2. To electrically isolate the Arduino (low-voltage DC) from the relay coil and AC mains
  3. To convert AC to DC
  4. To amplify the signal
Understand
โœ… Answer: (B) โ€” Optocouplers use light to transmit signals between two electrically isolated circuits. This protects the Arduino from voltage spikes and electrical noise from the relay coil and AC loads.
Q14

The map() function in Arduino is used to:

  1. Draw maps on an LCD screen
  2. Re-map a number from one range to another range proportionally
  3. Create arrays of sensor data
  4. Map GPS coordinates
Understand
โœ… Answer: (B) โ€” map(value, fromLow, fromHigh, toLow, toHigh) linearly scales a value from one range to another. Example: map(512, 0, 1023, 0, 180) returns 90.
Q15

What is "back-EMF" in the context of DC motors?

  1. Excess current drawn by the motor
  2. A voltage spike generated by the motor coil when power is suddenly cut off
  3. The power consumed by the L293D IC
  4. The voltage drop across the motor terminals
Understand
โœ… Answer: (B) โ€” When a motor's power is cut, its spinning coil acts as a generator and produces a reverse voltage spike (back-EMF). This can damage the Arduino. The L293D has built-in protection diodes to handle this.

Apply / Implement (Q16โ€“Q21)

Q16

To run a DC motor at approximately 50% speed using L293D, the correct analogWrite() value for the Enable pin is:

  1. 50
  2. 127
  3. 200
  4. 255
Apply
โœ… Answer: (B) โ€” PWM range is 0โ€“255. 50% of 255 โ‰ˆ 127. analogWrite(enablePin, 127) gives roughly half speed.
Q17

To move a servo to 90ยฐ (centre position), the correct code is:

  1. myServo.write(90);
  2. analogWrite(9, 90);
  3. digitalWrite(9, 90);
  4. myServo.attach(90);
Apply
โœ… Answer: (A) โ€” servo.write(angle) is the correct Servo library function. analogWrite() sends raw PWM which won't work correctly for servos. attach() is for connecting to a pin, not setting angle.
Q18

A potentiometer gives analogRead() value of 768. Using map(768, 0, 1023, 0, 180), the servo angle will be approximately:

  1. 90ยฐ
  2. 120ยฐ
  3. 135ยฐ
  4. 150ยฐ
Apply
โœ… Answer: (C) โ€” map(768, 0, 1023, 0, 180) = (768/1023) ร— 180 โ‰ˆ 135ยฐ. The map function linearly interpolates between the ranges.
Q19

To make a 2WD robot car turn LEFT, you should:

  1. Stop both motors
  2. Run left motor forward, stop right motor
  3. Stop left motor, run right motor forward
  4. Reverse both motors
Apply
โœ… Answer: (C) โ€” To turn left, stop (or reverse) the left motor and run the right motor forward. The right wheel pushes forward while the left stays still, causing the car to pivot left.
Q20

Which pin configuration makes L293D Motor A spin in REVERSE?

  1. Enable1=HIGH, Input1=HIGH, Input2=LOW
  2. Enable1=HIGH, Input1=LOW, Input2=HIGH
  3. Enable1=LOW, Input1=HIGH, Input2=HIGH
  4. Enable1=HIGH, Input1=HIGH, Input2=HIGH
Apply
โœ… Answer: (B) โ€” Enable=HIGH activates the driver. Input1=LOW, Input2=HIGH reverses the current direction through the motor, spinning it in reverse.
Q21

To use a relay to control a 12V DC LED strip, you should connect the LED strip between:

  1. VCC and IN pins of relay module
  2. COM and NO terminals of relay
  3. Signal and GND pins of Arduino
  4. Enable and Output pins of L293D
Apply
โœ… Answer: (B) โ€” The load (LED strip + its power supply) connects between COM and NO terminals. When relay activates, COM-NO circuit closes and the strip turns on.

Analyze / Compare (Q22โ€“Q25)

Q22

A student's DC motor runs in only one direction regardless of Input1/Input2 values. The most likely cause is:

  1. The motor is broken
  2. The Enable pin is not connected (floating)
  3. One of the Input pins is not connected to Arduino (floating HIGH/LOW randomly)
  4. The battery is inserted backwards
Analyze
โœ… Answer: (C) โ€” A floating (unconnected) input pin picks up random noise, effectively behaving unpredictably. If Input2 is floating, the motor may always spin one way. Always ensure all control pins are properly connected.
Q23

Comparing DC motor and servo motor: which statement is TRUE?

  1. Both use open-loop control
  2. DC motors provide precise angle control; servos provide continuous rotation
  3. Servos use closed-loop feedback for precise positioning; DC motors use open-loop continuous rotation
  4. Both require the Servo.h library
Analyze
โœ… Answer: (C) โ€” Servos have internal feedback (potentiometer + control circuit) for precise angle control. DC motors spin continuously without knowing their position โ€” open-loop.
Q24

A relay module's LED turns ON when digitalWrite(relayPin, LOW) is called. This means the module is:

  1. Broken
  2. Active HIGH
  3. Active LOW
  4. Short-circuited
Analyze
โœ… Answer: (C) โ€” Active LOW relay modules activate (LED ON, coil energised) when the signal pin receives LOW (0V). Many Indian relay modules are Active LOW by default. This is normal.
Q25

Why does the L293D have 4 GND pins (pins 4, 5, 12, 13) instead of just one?

  1. Manufacturing defect โ€” only one GND is needed
  2. They serve as heat sinks โ€” spreading heat from the IC to the PCB copper
  3. Each GND controls a different motor
  4. Two are for DC ground and two for AC ground
Analyze
โœ… Answer: (B) โ€” The four GND pins are positioned in the centre of the IC to dissipate heat. When soldered to large copper ground planes on a PCB, they act as heat sinks for the power transistors inside.

Evaluate / Justify (Q26โ€“Q28)

Q26

For an automated greenhouse watering system, the best actuator choice is:

  1. DC motor โ€” to spin the water
  2. Servo motor โ€” to open/close a water valve
  3. Stepper motor โ€” for precise water droplet counting
  4. Piezo buzzer โ€” to alert the plants
Evaluate
โœ… Answer: (B) โ€” A servo can precisely open/close a valve to control water flow. DC motors aren't precise enough, steppers are overkill, and buzzers obviously can't water plants! A relay-controlled solenoid valve is also acceptable.
Q27

A student uses analogWrite() directly on a servo signal pin instead of Servo.write(). What will happen?

  1. The servo will work perfectly
  2. The servo will jitter erratically because analogWrite's PWM frequency (~490Hz) doesn't match servo's required 50Hz
  3. The servo will move to 0ยฐ and stay there
  4. The Arduino will crash
Evaluate
โœ… Answer: (B) โ€” Servos need 50Hz PWM with specific pulse widths (1โ€“2ms). Arduino's analogWrite() runs at ~490Hz. The servo receives incorrect signals and jitters unpredictably. Always use the Servo library.
Q28

For controlling a 230V AC ceiling fan from an Arduino-based IoT system, the safest approach is:

  1. Connect fan wires directly to Arduino pins
  2. Use L293D motor driver
  3. Use an optocoupler-isolated relay module rated for AC 230V/10A
  4. Use a servo motor to physically push the fan switch
Evaluate
โœ… Answer: (C) โ€” An optocoupler-isolated relay module provides electrical isolation between Arduino (5V DC) and mains AC (230V). L293D cannot handle AC. Direct connection is fatal. Servo on switch is creative but impractical.

Create / Design (Q29โ€“Q30)

Q29

You're designing an automatic pet feeder that dispenses food at 8 AM and 6 PM. The best actuator combination is:

  1. 2 DC motors and 1 relay
  2. 1 servo motor (to open/close food gate) + 1 relay (to control a small vibrating motor for dispensing)
  3. 3 stepper motors
  4. 1 piezo buzzer and 1 LED
Create
โœ… Answer: (B) โ€” A servo precisely controls the food gate (open 90ยฐ to dispense, close to 0ยฐ to seal). A relay can power a small vibrating motor to shake food through. Add an RTC module for time-keeping. This is a practical, buildable design.
Q30

You're designing a smart parking barrier. The barrier arm should lift to 90ยฐ when a car is detected (ultrasonic sensor) and lower after 10 seconds. Which code logic is correct?

  1. Read sensor โ†’ if distance < 30cm โ†’ servo.write(90) โ†’ delay(10000) โ†’ servo.write(0)
  2. Read sensor โ†’ if distance > 100cm โ†’ relay ON โ†’ delay(10000) โ†’ relay OFF
  3. Read sensor โ†’ DC motor forward โ†’ delay(5000) โ†’ DC motor reverse
  4. Read sensor โ†’ analogWrite(90) โ†’ delay(10000) โ†’ analogWrite(0)
Create
โœ… Answer: (A) โ€” Ultrasonic detects car (distance < 30cm) โ†’ servo lifts barrier to 90ยฐ โ†’ waits 10 seconds โ†’ lowers to 0ยฐ. This uses the correct sensor-to-actuator logic with proper servo control.
Section 12

Short Answer & Long Answer Questions

Short Answer Questions (2โ€“3 marks each)

Q1. Define an actuator and give three examples used in IoT systems. (2 marks)

Answer: An actuator is a device that converts an electrical signal into a physical output such as motion, force, or switching action. It is the "output" component in the Sense โ†’ Process โ†’ Act IoT loop.

Three examples:

  1. DC Motor โ€” provides continuous rotation for robot wheels, fans, conveyor belts
  2. Servo Motor โ€” provides precise angular positioning (0ยฐโ€“180ยฐ) for robot arms, gate barriers, camera mounts
  3. Relay Module โ€” acts as an electrically controlled switch to turn ON/OFF AC appliances like lights, pumps, and fans from a microcontroller

Q2. Why is a motor driver IC (like L293D) necessary when interfacing a DC motor with Arduino? (2 marks)

Answer: A motor driver IC is necessary for two critical reasons:

  1. Current limitation: Arduino digital pins can supply only 20mA (max 40mA), while DC motors require 100mAโ€“1A or more. Connecting a motor directly can burn the ATmega328P microcontroller chip.
  2. Back-EMF protection: When a motor stops, its coil generates a reverse voltage spike (back-EMF) that can damage the Arduino. The L293D has built-in protection diodes to safely absorb these spikes.

The motor driver acts as a middleman โ€” it takes small control signals from Arduino and switches a separate, higher-current power supply to drive the motor.

Q3. Write the L293D truth table for Motor A direction control. (2 marks)

Enable1Input1Input2Motor A Action
HIGHHIGHLOWForward (clockwise)
HIGHLOWHIGHReverse (counter-clockwise)
HIGHLOWLOWCoast (free spin stop)
HIGHHIGHHIGHBrake (locked stop)
LOWXXMotor disabled (OFF)

Key insight: Enable pin must be HIGH for any motor operation. Connecting it to a PWM pin allows speed control via analogWrite().

Q4. Explain the difference between a standard servo (180ยฐ) and a continuous rotation servo. (2 marks)

FeatureStandard Servo (180ยฐ)Continuous Rotation Servo
Rotation0ยฐ to 180ยฐ onlyFull 360ยฐ continuous
servo.write(90)Moves to 90ยฐ position and holdsStops rotating
servo.write(0)Moves to 0ยฐ positionFull speed clockwise
servo.write(180)Moves to 180ยฐ positionFull speed counter-clockwise
FeedbackHas position feedback (holds angle)No position feedback
Use caseRobot arm, gate, camera mountWheels, winch, rotating platform

The standard servo is most common in IoT projects because precise angle control is usually needed.

Q5. What do COM, NO, and NC mean on a relay module? Which should you use for turning an appliance ON/OFF? (2 marks)

COM (Common): The common terminal that is always connected to one wire of the load (appliance).

NO (Normally Open): This terminal is disconnected from COM by default. When the relay is activated (coil energised), it connects to COM, completing the circuit. Use COM-NO for most ON/OFF applications โ€” appliance is OFF by default, turns ON when Arduino activates the relay.

NC (Normally Closed): This terminal is connected to COM by default. When the relay activates, it disconnects from COM. Use COM-NC when you want the appliance to be ON by default and turn OFF when signalled.

Q6. What is PWM and how is it used for motor speed control? (3 marks)

PWM (Pulse Width Modulation) is a technique where a digital pin rapidly switches between HIGH and LOW to simulate an analog voltage level. The ratio of ON time to total period is called the duty cycle.

How it controls speed:

  • analogWrite(pin, 0) โ†’ 0% duty cycle โ†’ Motor OFF
  • analogWrite(pin, 127) โ†’ ~50% duty cycle โ†’ Motor at half speed
  • analogWrite(pin, 255) โ†’ 100% duty cycle โ†’ Motor at full speed

The motor doesn't actually turn on/off rapidly โ€” its inertia smooths the pulses into a continuous rotation at reduced speed. The L293D Enable pin accepts PWM, making it the perfect speed control input.

Arduino PWM frequency: ~490Hz on most pins, ~980Hz on pins 5 and 6. This frequency is fast enough that the motor runs smoothly without visible stuttering.

Q7. Explain the closed-loop feedback mechanism inside a servo motor. (3 marks)

A servo motor uses a closed-loop feedback system with four components:

  1. Control Signal (Input): Arduino sends a PWM signal where the pulse width encodes the desired angle (1ms = 0ยฐ, 1.5ms = 90ยฐ, 2ms = 180ยฐ).
  2. Control Circuit: An internal IC compares the desired angle (from PWM) with the actual angle (from the potentiometer). If they don't match, it drives the DC motor in the correct direction.
  3. DC Motor + Gear Train: The motor turns through a gear reduction to increase torque and reduce speed. The gears move the output shaft.
  4. Position Sensor (Potentiometer): A potentiometer attached to the output shaft continuously reports the actual angular position back to the control circuit.

The loop: Control circuit detects error (desired โ‰  actual) โ†’ drives motor โ†’ shaft rotates โ†’ potentiometer updates actual position โ†’ when actual = desired โ†’ motor stops โ†’ servo holds position.

This is why a servo can hold a position under load โ€” it continuously corrects any deviation.

Q8. What is the function of map() in Arduino? Give an example with potentiometer and servo. (2 marks)

The map() function re-maps (linearly scales) a number from one range to another:

Syntax: map(value, fromLow, fromHigh, toLow, toHigh)

Example: A potentiometer connected to analog pin A0 gives values 0โ€“1023. A servo needs angles 0โ€“180.

int potValue = analogRead(A0);          // Read: 0โ€“1023
int angle = map(potValue, 0, 1023, 0, 180);  // Convert to 0โ€“180
myServo.write(angle);                   // Move servo

If potValue = 512 (knob at centre), map returns: (512/1023) ร— 180 โ‰ˆ 90ยฐ โ€” servo moves to centre position.

Long Answer Questions (5โ€“8 marks each)

Q1. Explain the complete process of interfacing a DC motor with Arduino using L293D. Include pin diagram, connection table, truth table, and Arduino code for forward, reverse, and speed control. (8 marks)

Answer:

1. L293D Pin Configuration (16-pin DIP)

The L293D is a dual H-bridge motor driver IC with 16 pins:

  • Pin 1 (Enable1): Enables Motor A โ€” connect to Arduino PWM pin for speed control
  • Pins 2, 7 (Input1, Input2): Direction control for Motor A
  • Pins 3, 6 (Output1, Output2): Connect to Motor A terminals
  • Pin 8 (Vs): Motor power supply from battery (6Vโ€“12V)
  • Pin 16 (Vss): Logic power supply from Arduino (+5V)
  • Pins 4, 5, 12, 13 (GND): Ground connections (also serve as heat sinks)
  • Pin 9 (Enable2), Pins 10, 15 (Input3, Input4), Pins 11, 14 (Output3, Output4): Same as above but for Motor B

2. Connection Table

Arduino PinL293D PinPurpose
Pin 9 (PWM)Pin 1 (Enable1)Speed control via PWM
Pin 2Pin 2 (Input1)Direction control
Pin 3Pin 7 (Input2)Direction control
5VPin 16 (Vss)Logic supply
GNDPins 4,5,12,13Common ground
โ€”Pin 8 (Vs)Battery + (6Vโ€“9V)

Motor wires connect to Pin 3 (Output1) and Pin 6 (Output2). Battery GND must connect to Arduino GND (common ground).

3. Truth Table

Enable1Input1Input2Motor Action
HIGH/PWMHIGHLOWForward
HIGH/PWMLOWHIGHReverse
HIGHLOWLOWCoast stop
LOWXXMotor OFF

4. Arduino Code

const int enablePin = 9;  // PWM for speed
const int in1 = 2;        // Direction
const int in2 = 3;        // Direction

void setup() {
  pinMode(enablePin, OUTPUT);
  pinMode(in1, OUTPUT);
  pinMode(in2, OUTPUT);
}

void loop() {
  // Forward at 75% speed
  analogWrite(enablePin, 191);
  digitalWrite(in1, HIGH);
  digitalWrite(in2, LOW);
  delay(3000);

  // Stop
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(1000);

  // Reverse at 50% speed
  analogWrite(enablePin, 127);
  digitalWrite(in1, LOW);
  digitalWrite(in2, HIGH);
  delay(3000);

  // Stop
  digitalWrite(in1, LOW);
  digitalWrite(in2, LOW);
  delay(1000);
}

Key points: Always use external battery for motor power. Enable pin controls speed (PWM 0โ€“255). Input pins control direction. Common ground is essential between Arduino and battery.

Q2. Design a complete IoT-based smart door lock system using a servo motor and an ultrasonic sensor. Include circuit diagram, connection table, working principle, and full Arduino code. (8 marks)

Answer:

1. System Design

The smart door lock uses an HC-SR04 ultrasonic sensor to detect a person (distance < 20cm) and a servo motor to unlock (rotate to 90ยฐ) the door. After 5 seconds, it automatically locks back (return to 0ยฐ).

2. Components Required

  • Arduino Uno
  • SG90 Servo Motor
  • HC-SR04 Ultrasonic Sensor
  • Jumper wires, Breadboard

3. Connection Table

ComponentPinArduino Pin
HC-SR04 VCCVCC5V
HC-SR04 TrigTrigPin 6
HC-SR04 EchoEchoPin 7
HC-SR04 GNDGNDGND
Servo SignalOrangePin 9
Servo VCCRed5V
Servo GNDBrownGND

4. Working Principle

  1. Ultrasonic sensor continuously measures distance
  2. If distance < 20cm โ†’ person detected
  3. Servo rotates from 0ยฐ (locked) to 90ยฐ (unlocked)
  4. Serial monitor displays "DOOR UNLOCKED"
  5. After 5 second delay, servo returns to 0ยฐ
  6. Serial monitor displays "DOOR LOCKED"

5. Arduino Code

#include <Servo.h>

Servo lockServo;
const int trigPin = 6;
const int echoPin = 7;
bool isLocked = true;

void setup() {
  lockServo.attach(9);
  lockServo.write(0);    // Start locked
  pinMode(trigPin, OUTPUT);
  pinMode(echoPin, INPUT);
  Serial.begin(9600);
  Serial.println("Smart Door Lock Ready");
}

float getDistance() {
  digitalWrite(trigPin, LOW);
  delayMicroseconds(2);
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);
  long duration = pulseIn(echoPin, HIGH);
  return duration * 0.034 / 2;  // cm
}

void loop() {
  float distance = getDistance();
  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");

  if (distance < 20 && isLocked) {
    // Unlock
    lockServo.write(90);
    isLocked = false;
    Serial.println("๐Ÿ”“ DOOR UNLOCKED");
    delay(5000);  // Keep open 5 seconds

    // Lock again
    lockServo.write(0);
    isLocked = true;
    Serial.println("๐Ÿ”’ DOOR LOCKED");
  }

  delay(100);
}

Enhancements: Add a keypad for PIN entry, Bluetooth module for phone control, buzzer for alert sounds, or an OLED display to show lock status.

Q3. Compare DC Motor, Servo Motor, and Relay as actuators. Discuss their working principles, advantages, limitations, and suggest appropriate IoT application scenarios for each. (8 marks)

Answer:

1. Comparison Table

FeatureDC MotorServo MotorRelay
TypeRotational (continuous)Rotational (precise angle)Electrical switch
WorkingCurrent through coil in magnetic field โ†’ rotationDC motor + gears + feedback potentiometer โ†’ closed-loop positioningElectromagnetic coil pulls switch contacts โ†’ opens/closes circuit
ControlOpen-loop (no position feedback)Closed-loop (internal feedback)Binary ON/OFF
OutputContinuous rotation at variable speedAngular position (0ยฐโ€“180ยฐ)Circuit switching (ON or OFF)
Driver NeededYes โ€” L293D or similar H-bridgeNo โ€” direct to Arduino + Servo.h libraryRelay module with optocoupler (recommended)
PowerExternal battery (6Vโ€“12V, 100mAโ€“1A)Arduino 5V (for 1โ€“2 servos), external for moreArduino 5V for coil; separate supply for load
PrecisionLow โ€” speed only, no positionHigh โ€” 1ยฐ resolutionN/A (binary switching)
Cost (India)โ‚น15โ€“โ‚น40 (hobby motor)โ‚น60โ€“โ‚น100 (SG90)โ‚น50โ€“โ‚น100 (1-channel module)

2. Advantages & Limitations

DC Motor:

  • Advantages: Simple, cheap, high RPM, continuous rotation, variable speed via PWM
  • Limitations: No position feedback, needs external driver, draws high current, generates electrical noise

Servo Motor:

  • Advantages: Precise angle control, built-in feedback, easy to program (Servo.h), low power for small servos, holds position under load
  • Limitations: Limited rotation range (180ยฐ), cannot do continuous rotation (standard type), can jitter with noisy power supply, limited torque (small servos)

Relay:

  • Advantages: Can switch high-voltage AC (230V), complete electrical isolation with optocoupler, simple ON/OFF control, can control any appliance
  • Limitations: Binary only (no speed/position control), mechanical wear over time, audible click, slower switching speed compared to solid-state alternatives, AC wiring requires safety expertise

3. IoT Application Scenarios

ActuatorBest IoT ApplicationWhy This Actuator?
DC MotorRobot car, conveyor belt, fan, water pumpNeeds continuous rotation and variable speed
Servo MotorDoor lock, gate barrier, camera pan/tilt, robot armNeeds precise angular positioning and holding
RelaySmart home (lights, fans, pumps), industrial automationNeeds to switch ON/OFF high-power AC appliances from low-power microcontroller

Conclusion: The choice of actuator depends on the required output: continuous motion โ†’ DC motor, precise positioning โ†’ servo, high-power switching โ†’ relay. Many real-world IoT systems use a combination of all three.

Section 13

Chapter Summary & Earning Checkpoint

๐Ÿ“‹ Unit 5 Summary โ€” Key Takeaways

  • Actuators are the output side of IoT โ€” they convert electrical signals into physical action (motion, switching, sound).
  • DC Motors provide continuous rotation but CANNOT be connected directly to Arduino due to current limitations (20mA vs 100mA+).
  • L293D is a dual H-bridge motor driver IC that controls 2 motors โ€” direction via Input pins, speed via Enable pin (PWM), power from external battery.
  • Truth table: Enable=HIGH + Input1=HIGH + Input2=LOW โ†’ Forward. Swap inputs โ†’ Reverse. Both LOW โ†’ Coast. Both HIGH โ†’ Brake.
  • Servo motors use closed-loop feedback (potentiometer inside) for precise angular positioning (0ยฐโ€“180ยฐ). Use Servo.h library with attach(), write(angle).
  • SG90 is the standard IoT servo: 0ยฐโ€“180ยฐ, 1.8 kgยทcm torque, 4.8โ€“6V, costs โ‚น60โ€“โ‚น100.
  • Potentiometer + Servo is a classic IoT combo: analogRead() โ†’ map(0,1023,0,180) โ†’ servo.write().
  • Relay modules switch high-power loads (AC appliances) using low-power signals. COM-NO for default OFF, COM-NC for default ON.
  • Safety first: AC mains (230V India) is lethal โ€” always use optocoupler isolation and never touch AC wires without supervision.
  • A DIY robot car costs โ‚น475 vs โ‚น3,000โ€“โ‚น5,000 for a commercial kit โ€” and you learn 10ร— more building from scratch.

Earning Checkpoint โ€” What Can You Build & Earn?

Skill LearnedTool/ComponentPortfolio PieceEarning Ready?
DC Motor ControlL293D + ArduinoRobot car with direction/speed controlโœ… Yes โ€” โ‚น500โ€“โ‚น1,500 workshop kits
Servo ControlSG90 + Servo.hAutomated door lock / parking barrierโœ… Yes โ€” IoT project demos
Relay SwitchingRelay module + ArduinoSmart home light controllerโœ… Yes โ€” โ‚น500โ€“โ‚น2,000 installations
PWM Speed ControlanalogWrite + L293DVariable-speed fan controllerโœ… Yes โ€” add to any project
Sensor + Actuator IntegrationPot/Ultrasonic + ServoSmart parking systemโœ… Yes โ€” college project / hackathon
Minimum Viable Earning Setup after this unit: Build a Bluetooth-controlled robot car (add HC-05 module for โ‚น180) and conduct a weekend robotics workshop for school students. Charge โ‚น200โ€“โ‚น500 per student. 20 students ร— โ‚น300 = โ‚น6,000 in one day. Your total material cost: โ‚น475 per kit. That's your first IoT side hustle!
Robotics workshops for school students are booming in India. Companies like SP Robotics, Avishkaar, and STEMRobo charge โ‚น5,000โ€“โ‚น15,000 per student for similar content. As a college student, you can offer neighbourhood workshops at โ‚น500โ€“โ‚น1,000 per student, undercutting the big players while giving personalized attention. Many engineering students across Bangalore, Pune, and Hyderabad earn โ‚น10,000โ€“โ‚น20,000/month through weekend robotics and IoT workshops.

โœ… Unit 5 complete. Ready for Unit 6: IoT Communication Protocols!

[QR: Link to EduArtha video tutorial โ€” Actuators & Motors]