================================================================================
Chapter 5: Wireless Communication
================================================================================

[Table of Contents]

Wireless data transmission from inside the body presents unique challenges
including signal attenuation, power constraints, and security requirements.

--------------------------------------------------------------------------------
5.1 In-Body Transmission Technologies
--------------------------------------------------------------------------------

Challenges:
  Signal Attenuation: 10-100+ dB loss through tissue (frequency dependent)
  Antenna Constraints: Capsule < 3 cm vs. ideal λ/4 = 18.75 cm @ 400 MHz
  Power Limits: < 1-10 mW (battery), regulatory EIRP (25 μW for MICS)
  Patient Movement: Rotation, translation → link variability

Wireless Technologies:
  MICS (Medical Implant Communication Service):
    - Frequency: 402-405 MHz, Bandwidth: 300 kHz
    - Advantages: Medical-dedicated, excellent tissue penetration, global approval
    - Data rate: 100-400 kbps (sufficient for sensors, not imaging)
    - EIRP limit: 25 μW

  ISM Bands:
    - 433 MHz: Good penetration (Europe)
    - 915 MHz: Smaller antenna (North America)
    - 2.4 GHz: Global, high data rate, but high attenuation (30-50 dB)

  Magnetic Induction (Near-Field):
    - Frequency: < 1 MHz
    - Advantages: Minimal tissue attenuation, water/blood penetration
    - Disadvantages: Very short range (< 10 cm), large coils, low data rate

  Acoustic Communication:
    - Principle: Ultrasound modulation
    - Advantages: Excellent tissue/fluid penetration, low power
    - Status: Research stage for underwater/in-body communication

Protocol Stacks:
  BLE (Bluetooth Low Energy):
    - Frequency: 2.4 GHz, Data rate: 125 kbps - 2 Mbps
    - Advantages: Universal smartphone support, low power
    - Challenges: 2.4 GHz attenuation, connection power

  Proprietary Protocols:
    - Example: PillCam at 430 MHz, 2.7 Mbps for video streaming
    - Optimization: Tailored to specific requirements
    - Tradeoff: Limited interoperability but optimal performance

Error Correction:
  - FEC (Forward Error Correction): Reed-Solomon, LDPC (10-50% overhead)
  - ARQ (Automatic Repeat Request): ACK/NACK feedback
  - HARQ (Hybrid ARQ): FEC + selective retransmission

--------------------------------------------------------------------------------
5.2 External Receiver Systems
--------------------------------------------------------------------------------

Body-Worn Receivers:
  Belt-Mounted: Multi-antenna array, stable position, good signal
  Skin Patch: Adhesive, comfortable, discrete, close proximity
  Pendant: Convenient but variable position, weaker signal

Smartphone-Based:
  - Direct BLE: Limited to near-surface capsules
  - External dongle: Custom frequency reception → smartphone
  - Gateway device: Optimized receiver → BLE → smartphone
  - Apps: Data collection, visualization, alerts, diary, cloud upload

Diversity Techniques:
  - Spatial diversity: 2-4 antennas, select strongest (3-10 dB gain)
  - Frequency diversity: Multiple channels, avoid selective fading
  - Time diversity: Repeated transmissions at intervals

--------------------------------------------------------------------------------
5.3 Data Encryption and Security
--------------------------------------------------------------------------------

Threats:
  - Eavesdropping: Wireless transmission interception
  - Tampering: Data modification
  - Device impersonation: Fake capsule/receiver
  - Denial of service: Jamming
  - Privacy violation: Patient identification

Encryption:
  Symmetric (AES-256):
    - Same key for encryption/decryption
    - Performance: Hardware acceleration, low overhead
    - Key management: Pre-shared or session keys

  Authentication (HMAC-SHA256):
    - Message authentication code for integrity
    - Protection: Detect tampering

  Lightweight Crypto:
    - PRESENT, Tiny-AES for resource-constrained devices
    - Tradeoff: Security vs. efficiency

Security Protocols:
  Pairing/Authentication:
    - Out-of-band: QR code scan, NFC tap, serial number entry
    - PIN: Code entry
    - Certificate: Factory-installed CA chain

  Data Encryption:
    - Packet: Header (plaintext routing) + encrypted payload + MAC
    - Overhead: +50-100% (tag, IV) - tradeoff for security

  Compliance:
    - HIPAA (US): Encryption in transit and at rest, access logs
    - GDPR (EU): Data minimization, purpose limitation, integrity/confidentiality
    - MDCG: Medical device cybersecurity guidance

--------------------------------------------------------------------------------
5.4 Signal Optimization
--------------------------------------------------------------------------------

Link Budget Analysis:
  Received Power (Pr) = Pt + Gt + Gr - Path Loss - Other Losses
  Example: Pr = 0 dBm - 20 dBi + 2 dBi - 60 dB = -78 dBm
  Required: -100 dBm sensitivity → 22 dB margin (adequate)

Optimization Strategies:
  - Increase Pt: Limited by regulation and battery (0-10 dBm practical)
  - Improve antennas: Gt gain 5-10 dB, Gr gain 5-10 dBi
  - Diversity: +5-10 dB spatial, +3-6 dB frequency

Adaptive Techniques:
  Power Control: Adjust Tx power based on RSSI feedback
  Rate Adaptation: High modulation (good channel) vs. robust (poor channel)
  Retransmission: ARQ for reliability vs. latency/power tradeoff
  Frequency Hopping: Interference avoidance, jamming resistance

Real-Time Processing:
  On-Capsule: Compression (2:1 - 10:1), buffering, prioritization
  On-Receiver: Decoding (< 100 ms), aggregation, display (1-10 Hz update)
  End-to-End Latency: < 2 seconds (acceptable for most applications)

Key Principle: Wireless communication is a major power consumer. Optimization
balances battery life and data reliability.

[Next: Chapter 6]
[Table of Contents]

================================================================================