Things in IoT and IoT Security & Privacy - Basic

๐Ÿ”Œ Voltage Considerations for Sensors in IoT

⚙️ Why Voltage Matters:

  • Sensors require specific voltage and current to function correctly.

  • Supplying the wrong voltage can result in:

    • Incorrect readings

    • Permanent damage to the sensor

    • Microcontroller malfunction

⚡ Typical Voltage Levels:

Sensor TypeOperating Voltage
Digital Sensors3.3V or 5V
Analog SensorsOften 5V
Microcontrollers (ESP32, Arduino)3.3V or 5V

๐Ÿง  Logic Level Compatibility:

  • ESP8266 & ESP32 use 3.3V logic.

  • Arduino Uno operates at 5V logic.

  • If a sensor outputs 5V but the MCU takes only 3.3V, a logic level shifter or voltage divider is needed.

๐Ÿ”ง Example:

If you connect a 5V IR sensor to an ESP32 input pin directly, the 3.3V-only GPIO may be damaged unless a voltage divider is used.


๐Ÿ“ก Working of Common IoT Sensors

1. PIR Motion Sensor

  • PIR = Passive Infrared

  • Detects infrared radiation changes caused by movement of warm objects (e.g., humans).

  • Working:

    • Has 2 slots with IR-sensitive materials.

    • When both slots receive equal IR radiation → idle.

    • Movement causes imbalance → triggers signal (usually HIGH).

Use: Motion-activated lights, security alarms.


2. Sharp IR Distance Sensor

  • Uses Infrared light to measure distance by triangulation.

  • Emits a focused IR beam; measures angle of reflection to compute distance.

  • Analog output voltage varies with distance.

Use: Obstacle detection in robots, distance measurement.


3. LDR Sensor (Light Dependent Resistor)

  • Resistance decreases with increasing light.

  • Connected in a voltage divider circuit to convert resistance to voltage.

  • Output is analog.

Use: Auto-brightness control, day/night detection.


4. Gyro Sensor (Gyroscope)

  • Measures angular velocity (how fast it is rotating).

  • Works using the Coriolis effect:

    • When the sensor rotates, a vibrating structure inside gets displaced, and that displacement is measured.

Use: Drones, smartphones (screen orientation), gaming.


5. Ultrasonic Distance Sensor (HC-SR04)

  • Sends out ultrasonic pulse (40 kHz).

  • Measures time delay of reflected pulse (echo).

  • Uses the formula:

    Distance=Time×Speed of Sound2

Use: Robot obstacle detection, tank level measurement.


6. DHT Sensor (DHT11/DHT22)

  • Measures temperature and humidity.

  • Contains:

    • NTC Thermistor (for temperature)

    • Humidity sensor (capacitive)

  • Digital output on a single data line.

Use: Weather stations, smart home systems.


๐Ÿงช Why ADC is Required for Analog Sensors

๐Ÿงญ Analog vs. Digital:

  • Analog Sensors (like LDR, Sharp IR) output a variable voltage.

  • Microcontrollers only understand digital values.

๐Ÿ”„ Role of ADC (Analog to Digital Converter):

  • Converts analog voltage to digital value (e.g., 0–1023 for 10-bit ADC).

  • Allows precise measurement of analog phenomena (light, temperature, etc.).

๐Ÿงฐ External ADC Needed When:

  • Your microcontroller lacks ADC (e.g., Raspberry Pi).

  • You need higher resolution or multiple analog inputs.

Example ADC chips:

  • MCP3008 (10-bit, 8 channels)

  • ADS1115 (16-bit, 4 channels, I2C)


⚙️ Actuators in IoT (Detailed Working)

1. Servo Motor

  • Can rotate to a specific angle (0° to 180°).

  • Controlled using PWM (Pulse Width Modulation) signal.

  • Internally has a motor + gear + feedback system.

Use: Robotic arms, pan-tilt camera mounts.


2. Solenoid

  • A coil of wire generates a magnetic field when current flows.

  • Pulls a metallic plunger inward (linear motion).

Use: Door lock systems, vending machines.


3. Stepper Motor

  • Moves in precise steps (e.g., 1.8° per step).

  • Each pulse sent rotates the shaft by a fixed angle.

  • Controlled using drivers (ULN2003, A4988).

Use: 3D printers, CNC machines, robotic vehicles.


๐Ÿ”Œ Why Relay is Required with Actuators

๐Ÿ”‹ Problem:

  • Microcontroller GPIO pin can supply only a few mA current.

  • Heavy actuators, AC devices, or solenoids need more voltage and current (e.g., 12V, 220V AC).

๐Ÿ”Œ Relay (Solution):

  • Electrically operated switch.

  • Low-power signal from microcontroller triggers relay to switch high-power circuit.

๐Ÿงฐ Types of Relays:

  • Mechanical Relay

  • Solid State Relay (SSR) (faster, silent)

Example Use:
Turn ON a 220V AC fan or bulb using a 5V Arduino.


๐Ÿ” IoT Security & Privacy

๐Ÿ›ก️ Why It's Critical:

IoT devices collect sensitive data (e.g., cameras, sensors, GPS). A security breach can cause:

  • Data theft

  • Privacy invasion

  • Malicious control over devices

๐Ÿ”“ Common Vulnerabilities:

  • Weak/default passwords

  • No encryption in communication

  • Unpatched firmware

  • Insecure APIs

✅ Best Practices for Security:

LayerMeasures
NetworkUse TLS/SSL, VPN, firewall
DeviceStrong passwords, update firmware
CloudEncrypt stored data, access control
UserEducate about phishing and threats

๐Ÿ“Š Summary Table

ComponentNeeds Voltage?Needs ADC?Digital/AnalogControl
PIR SensorYes (5V)NoDigitalGPIO
Sharp IRYes (5V)YesAnalogADC
LDRYes (5V)YesAnalogADC
UltrasonicYes (5V)NoDigital (Trigger/Echo)Timing
Servo MotorYes (5V)NoDigital (PWM)PWM
Stepper MotorYes (12V)NoDigital pulsesDriver
SolenoidYes (12V/220V)NoRelay controlledRelay
DHT11Yes (3.3V/5V)NoDigitalGPIO

If you’d like, I can also:
  • Provide diagrams (block or circuit),

  • Share a ready-to-print PDF,

  • Help with IoT project ideas based on these sensors & actuators.

Comments

Popular posts from this blog

UNIT - 1 IOT

UNIT – 3: Programming with Arduino Uno