Skip to content

Latest commit

 

History

History
171 lines (131 loc) · 8.4 KB

File metadata and controls

171 lines (131 loc) · 8.4 KB

System Architecture

Documentation Arduino Embedded

Complete system architecture documentation for the WireLessText Terminal project


Overview

The WireLessText Terminal is a distributed embedded system consisting of two Arduino-based nodes that communicate wirelessly to enable bidirectional text messaging. The system has been implemented in two versions:

  • v1 (IR): Uses infrared LEDs and receivers with NEC protocol
  • v2 (HC-12): Uses HC-12 433 MHz RF transceiver modules

Both versions share the same core functionality: multi-tap text input, message buffering, LCD display, and character-by-character wireless transmission.

📸 Diagram Placeholder: High-resolution system architecture diagram showing both nodes and wireless link

System Block Diagram

Single Node Architecture

┌─────────────────────────────────────────────────┐
│           Arduino Node (Single Unit)            │
│                                                 │
│  ┌──────────┐         ┌─────────────┐          │
│  │ 4×3      │         │   16×2      │          │
│  │ Keypad   │────────▶│   LCD       │          │
│  │          │         │  Display    │          │
│  └──────────┘         └─────────────┘          │
│        │                      ▲                 │
│        │                      │                 │
│        ▼                      │                 │
│  ┌──────────────────────────────────┐           │
│  │     Core UI Logic                │           │
│  │  - Keypad scanning               │           │
│  │  - Multi-tap input               │           │
│  │  - Message buffer (32 chars)     │           │
│  │  - LCD rendering                 │           │
│  │  - Status line management        │           │
│  └──────────────────────────────────┘           │
│        │                      │                 │
│        ▼                      ▼                 │
│  ┌──────────────────────────────────┐           │
│  │     Transport Abstraction        │           │
│  │  - sendChar()                    │           │
│  │  - receiveChar()                 │           │
│  └──────────────────────────────────┘           │
│        │                      │                 │
│        ▼                      ▼                 │
│  ┌──────────┐         ┌─────────────┐          │
│  │ IR/RF    │         │ IR/RF       │          │
│  │ Transmit │         │ Receive     │          │
│  └──────────┘         └─────────────┘          │
│        │                      │                 │
└────────┼──────────────────────┼─────────────────┘
         │                      │
         │                      │
    ┌────▼────┐            ┌────▼────┐
    │  IR LED │            │ IR Rx   │  (v1)
    │  /HC-12 │            │ /HC-12  │  (v2)
    └─────────┘            └─────────┘

Full System Architecture (Two Nodes)

         Node A                              Node B
    ┌──────────────┐                  ┌──────────────┐
    │   Arduino    │                  │   Arduino    │
    │   + Keypad   │                  │   + Keypad   │
    │   + LCD      │                  │   + LCD      │
    └──────┬───────┘                  └──────┬───────┘
           │                                  │
           │                                  │
    ┌──────▼──────┐                    ┌──────▼──────┐
    │   IR/RF     │◄──────────────────►│   IR/RF     │
    │  Transport  │   Wireless Link    │  Transport  │
    └─────────────┘                    └─────────────┘

Note: In v1 (IR), communication is unidirectional (sender → receiver). In v2 (HC-12), communication is fully bidirectional (either node can send/receive).

📸 Diagram Placeholder: Professional CAD or schematic diagram showing physical node layout and interconnections

Design Principles

1. Separation of Concerns

The firmware is organized into distinct layers:

  • Hardware I/O Layer: Direct pin manipulation for keypad, LCD, and transport hardware
  • UI Logic Layer: Multi-tap input, message buffer management, status updates
  • Transport Layer: Protocol-specific send/receive functions (IR NEC or HC-12 serial)

This separation allows transport layers to be swapped without modifying UI logic.

2. Shared Core Logic

Both v1 and v2 share identical:

  • Keypad scanning algorithm
  • Multi-tap text input state machine
  • Message buffer management (32-character limit)
  • LCD rendering and status line formatting
  • Character commit logic (timeout-based)

3. Protocol Validation

Receivers strictly validate incoming data:

  • v1 (IR): Protocol == NEC, Address == 0xEF00, Command in valid set (32-126 or 0x08)
  • v2 (HC-12): Byte in valid set (32-126 or 0x08)

Invalid frames/bytes are silently ignored, preventing message corruption from noise.

Message Flow

Sending a Character

  1. User presses keypad key
  2. Multi-tap state machine updates currentChar preview
  3. If timeout expires or different key pressed: commitCurrentChar()
  4. Character appended to message buffer
  5. Status updated: "TX:'<char>'"
  6. LCD redrawn
  7. Transport layer sends character (IR NEC frame or HC-12 byte)

Receiving a Character

  1. Transport layer receives frame/byte
  2. Protocol validation (v1 only: NEC + address check)
  3. Command validation (printable ASCII 32-126 or 0x08)
  4. If valid: append to message buffer or handle backspace
  5. Status updated: "RX:'<char>' Len:XX" or "RX:BKSP"
  6. LCD redrawn

Transport Implementations

v1: IR (NEC Protocol)

  • Hardware: IR LED (pin 9) and IR receiver (pin 9)
  • Protocol: NEC with fixed address 0xEF00
  • Frame Format: Address (16-bit) + Command (8-bit char) + Repeat (8-bit, unused)
  • Timing: ~40 ms delay between frames
  • Direction: Unidirectional (separate sender/receiver sketches)

v2: HC-12 (Serial)

  • Hardware: HC-12 module on SoftwareSerial (RX=2, TX=3)
  • Protocol: Raw bytes, no framing
  • Baud Rate: 9600
  • Character Encoding: Direct ASCII (32-126) or 0x08 (backspace)
  • Direction: Bidirectional (single symmetric sketch)
  • Note: Voltage divider required on HC-12 RX line (5V → 3.3V)

Future Extension Points

  1. Multi-character framing: Wrap characters in packets with length headers, checksums
  2. Message acknowledgment: Add ACK/NACK protocol for reliable delivery
  3. Message history: Scrollable buffer with arrow keys
  4. External interface: UART connection to separate CPU for higher-level processing
  5. Encryption: Add simple XOR cipher or more advanced encryption for security
  6. Multiple nodes: Network addressing for more than two nodes

Resource Constraints

  • RAM: Message buffer (32 bytes) + status line (16 bytes) + stack ≈ <200 bytes used
  • Flash: ~10-15 KB per sketch (well within Uno/Nano 32 KB limit)
  • Timing: Multi-tap timeout (800 ms) provides smooth user experience without blocking