From cfd555324caf947ec664c5c79a1076f40ca8f049 Mon Sep 17 00:00:00 2001 From: Ghassan Yusuf Date: Thu, 26 Mar 2026 23:28:13 +0300 Subject: [PATCH] Add design document.md --- design document.md | 274 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 274 insertions(+) create mode 100644 design document.md diff --git a/design document.md b/design document.md new file mode 100644 index 0000000..19a37f2 --- /dev/null +++ b/design document.md @@ -0,0 +1,274 @@ +# ESP32‑S3 Wearable Sensor Board – Hardware Design Specification + +**Document Version:** 1.0 +**Target Audience:** PCB designer / hardware engineer +**Status:** Ready for implementation + +*** + +## Document index + +- [1. Overview](#1-overview) +- [2. MCU and wireless](#2-mcu-and-wireless) +- [3. Power – battery, charging, and gauge](#3-power––battery-charging-and-gauge) +- [4. USB‑C interface and firmware protection](#4-usb-c-interface-and-firmware-protection) +- [5. Power‑supply architecture](#5-power-supply-architecture) +- [6. Motion sensing (IMU)](#6-motion-sensing-imu) +- [7. Real‑time clock (RTC)](#7-real-time-clock-rtc) +- [8. Deep‑sleep and power‑gating](#8-deep-sleep-and-power-gating) +- [9. Display and I²C peripherals](#9-display-and-i2c-peripherals) +- [10. GPIO exposure and modularity](#10-gpio-exposure-and-modularity) +- [11. Power‑pin distribution per GPIO](#11-power-pin-distribution-per-gpio) +- [12. Size, PCB layers, and mechanical constraints](#12-size-pcb-layers-and-mechanical-constraints) +- [13. External power input and protection](#13-external-power-input-and-protection) +- [14. Bill of Materials (BOM) draft](#14-bill-of-materials-bom-draft) + +*** + +## 1. Overview + +This document defines the hardware design requirements for a **compact wearable sensor board** based on the **ESP32‑S3** (preferred) or **ESP32‑C3**. The board targets sports/impact‑sensing applications (fist/leg strikes) and must balance: + +- Tiny size for wearable use. +- Long‑term battery life via deep‑sleep and power‑gating. +- High‑integrity IMU and power‑monitoring (gas‑gauge, RTC). + +The designer must translate this into a **schematic and double‑sided PCB layout** that meets all constraints listed below. + +*** + +## 2. MCU and wireless + +- **MCU:** + - Primary: **ESP32‑S3** (small‑form‑factor, integrated Wi‑Fi/BLE, USB‑UART, 45+ GPIOs). + - Alternative (only if size is critical and Wi‑Fi/BLE robustness is secondary): **ESP32‑C3**. +- **Connectivity:** + - 2.4 GHz **Wi‑Fi 802.11 b/g/n**. + - **Bluetooth 5.0 (BLE)**. +- **RF layout:** + - Use either an **on‑board PCB antenna** or a small external antenna connector, following Espressif’s ESP32‑S3 hardware design guidelines. + - Provide proper RF‑matching network and keep‑out zones around the antenna. + +*** + +## 3. Power – battery, charging, and gauge + +- **Battery:** + - Single‑cell **Li‑Po / Li‑Ion** (nominal 3.7 V). +- **Charging:** + - Include a **Li‑Po charge IC** (e.g., TP4056, BQ2409x‑style, or similar modern IC) that: + - Accepts **5 V from USB‑C** → charges the battery. + - Reports charge status via **GPIO‑visible signals** (e.g., CHRG, DONE). + - Charging current: **100–500 mA** typical (designer’s choice based on thermal and USB limits). +- **Battery gauge (SoC monitoring):** + - Use a **gas‑gauge IC** (e.g., **MAX170xx family**, or similar) to measure: + - Battery voltage. + - Current. + - State‑of‑Charge (%). + - Interface: **I²C** (shared bus with IMU and RTC). + - This is **mandatory**; do not rely purely on ADC‑based voltage‑only estimation. + +*** + +## 4. USB‑C interface and firmware protection + +- **USB‑C role:** + - One **USB‑Type C receptacle** serving: + - **Battery charging** (via Li‑Po charge IC). + - **ESP32‑S3 programming and serial communication** (via built‑in USB‑UART/JTAG). +- **D‑ / D+ SMD jumpers:** + - Bring **D‑** and **D+** from the USB‑C connector to **SMD jumper pads** (e.g., 0603/0402‑style pads). + - When the pads are **shorted by solder**, D‑/D+ are connected to the ESP32‑S3. + - When the shorts are **desoldered**, D‑/D+ are disconnected, preventing: + - User‑induced firmware re‑flash. + - Accidental corruption of the device in the field. +- **USB protection:** + - Include **ESD protection / 5‑V clamp** on USB lines. + - Limit current via USB‑compliant resistor or IC‑based current‑limiting. + +*** + +## 5. Power‑supply architecture + +- **3.3 V main rail:** + - Provide a **3.3 V regulator** for the ESP32‑S3, IMU, OLED, and 3.3 V peripherals. + - Prefer a **buck (step‑down) converter** over an LDO for efficiency and higher current capability. + - Target: **3.3 V @ 300–500 mA** continuous (or higher if justified by load). +- **Boost converter / 5 V booster:** + - A **boost converter** (e.g., 1.8–4.2 V input → 5 V output) must power: + - LED strips. + - Other **5 V peripherals**. + - The **enable pin** of the booster must be driven by a **GPIO** of the ESP32‑S3. + - When the MCU goes into **deep‑sleep**, this GPIO must be **set to low** to disable the booster. +- **Isolation:** + - Ensure the **5 V rail** is isolated from 3.3 V logic (Schottky diodes or MOSFET isolation if needed). + +*** + +## 6. Motion sensing (IMU) + +- **General requirement:** + - Use a **6‑axis or 9‑axis IMU** for impact / strike detection, supporting: + - High‑g capability (≥ 80 g) for punches/kicks. + - Low‑noise gyro for angular motion. + - Do **not** use obsolete parts like MPU‑9250 or MPU‑6050 due to supply and counterfeit risks. +- **Preferred IMU:** + - **ST LSM6DSV80X** (or equivalent) is recommended because: + - 6‑axis IMU in a **2.5×3 mm** package. + - Dual accelerometer paths: **16 g low‑g** and **80 g high‑g**. + - Gyroscope and embedded AI‑style FSM/MLC for impact detection and motion states. + - Supports **I²C and SPI**. +- **Interface and power:** + - Run the IMU from the **3.3 V rail**. + - Connect to ESP32‑S3 via **I²C** (shared with battery gauge and RTC). + - Expose all configurable pins (interrupts, reset, etc.) on **solder pads** so they can be jumpered or disconnected. + +*** + +## 7. Real‑time clock (RTC) + +- **Function:** + - Provide **accurate timekeeping** during long‑term battery‑powered operation and deep‑sleep. +- **Requirements:** + - I²C‑compatible RTC module (e.g., common 32‑kHz RTC chips). + - **Tiny coin‑cell footpring** for a **3‑V rechargeable** cell or supercap‑backup (e.g., CR1220‑style). + - Alarm / interrupt output to a **GPIO** to wake the MCU from deep‑sleep. +- **Power:** + - Main power from **3.3 V rail**. + - Backup power from coin cell / supercap. + +*** + +## 8. Deep‑sleep and power‑gating + +- **System behavior in deep‑sleep:** + - In deep‑sleep, the ESP32‑S3 must **disable all non‑critical external peripherals** and **isolate power rails** to minimize current draw. + - Targets for shut‑down: + - **5 V booster** (GPIO‑driven enable → low). + - Any external modules powered by external 5 V or switchable rails. +- **Power‑gating strategy:** + - Use **MOSFET‑based power‑gating** or **enable‑controlled DC/DC converters** for: + - 5 V booster output. + - External I²C peripherals not needed during sleep. + - The MCU must control **enable signals** for these regulators/MOSFETs via GPIOs. + +*** + +## 9. Display and I²C peripherals + +- **OLED display:** + - Provide a **standard footprint / connector** for an **I²C OLED display** (e.g., 0.96" 128×64). + - Pins at connector: + - `VCC` (3.3 V). + - `GND`. + - `SDA` (I²C data). + - `SCL` (I²C clock). + - Power from the **3.3 V rail**. +- **General I²C:** + - Provide **exposed solder pads** for a **secondary I²C bus** or breakout of the main I²C bus for: + - Extra sensors. + - Expansion modules. + - Use appropriate **pull‑up resistors** (e.g., 4.7 kΩ) sized for selected bus speed. + +*** + +## 10. GPIO exposure and modularity + +- **All GPIOs:** + - Every **ESP32‑S3 GPIO** must be accessible: + - As **through‑hole pads**, **0.1" header pins**, or **edge‑mountable pads**. + - Labeled with: **GPIO number + function** (e.g., `GPIO21 – I2C_SDA`). +- **External‑control signals:** + - Any GPIO that controls: + - Booster enable. + - Other external modules / regulators. + - Must be connected via **SMD jumper pads** (two pads with a short‑able bridge). + - When the bridge is **soldered**, the MCU controls that function. + - When the bridge is **desoldered**, that function is disconnected, allowing modular removal of that side of the board. + +*** + +## 11. Power‑pin distribution per GPIO + +To ensure easy connection to external peripherals without extra wiring: + +- For **every GPIO pad / connector**, place neighboring pads for: + - `GND`. + - `3V3`. + - `5V`. +- **Preferred layout patterns:** + - Pin‑header style: `[GPIO_X][GND][3V3][5V]` repeated. + - Solder‑pad array: + - One row for `GND`. + - One row for `3V3`. + - One row for `5V`. + - One row for `GPIO_X` signals. +- **Electrical rules:** + - Connect all `GND` pads to the **main ground plane**. + - Connect `3V3` pads to the **main 3.3 V buck output**. + - Connect `5V` pads to the **boost‑converter output**, enabled only when the booster is active. + - Size power traces and vias to handle **high‑current loads** (e.g., LED strips, motors). + +*** + +## 12. Size, PCB layers, and mechanical constraints + +- **Target size:** + - As **small and tiny as possible** to maximize space for the **battery** and wearable‑side components. + - Target in the range of **~20×30 mm** or smaller, depending on antenna and battery constraints. +- **PCB stack‑up:** + - Use **single‑sided PCB** where possible. + - If routing density or RF layout requires it, switch to **double‑sided (2‑layer) PCB**. +- **Ground and RF:** + - Use a **solid ground plane** under RF and MCU sections. + - Follow Espressif’s ESP32‑S3 hardware design guidelines for antenna keep‑out and RF‑matching. + +*** + +## 13. External power input and protection + +- **External power input pads:** + - Provide **two dedicated solder pads** for **external input voltage**: + - `VIN` (or `VEXT`). + - Adjacent `GND` pad. +- **Voltage protection and regulation:** + - The external input must tolerate a **range above 3.3 V** (e.g., roughly 4–12 V, negotiable with the designer). + - Include: + - A **wide‑input buck regulator** (or similar) that steps higher input down to: + - A safe bus voltage for the **Li‑Po charger** (e.g., 4.5–5.5 V), and/or + - Directly to **3.3 V** for the MCU and peripherals. + - **Over‑voltage protection** (OVP) or a **TVS / ESD clamp** on the `VIN` line. +- **Behavior:** + - The board can be powered via: + - USB‑C. + - Or the external `VIN` pads. + - Only **one** power source should be active at a time. +- **Labeling:** + - Clearly mark the pads as: + - `VIN` + - `GND (VIN)` + +*** + +## 14. Bill of Materials (BOM) draft + +This is a **functional BOM**; the designer may substitute functionally equivalent parts (with your approval). + +| ID | Function | Suggested / Example Part | Notes | +|----|----------|--------------------------|-------| +| MCU1 | Main MCU | ESP32‑S3‑WROOM‑32 / ESP32‑S3‑MINI | Wi‑Fi/BLE, USB‑UART, 45+ GPIOs | +| CHG1 | Li‑Po charger | TP4056 or similar modern Li‑Po charge IC | 5 V input, CHRG/DONE outputs | +| GAGE1 | Battery gauge | MAX1704x / MAX170xx family | I²C‑based SoC estimation | +| IMU1 | Motion sensor | ST **LSM6DSV80X** | 6‑axis, 16 g + 80 g accel, 2.5×3 mm | +| RTC1 | RTC module | Generic I²C 32‑kHz RTC with coin‑cell backup | Alarm / interrupt output | +| REG1 | 3.3 V main rail | 3.3 V buck converter (e.g., AP62x0x‑style) | 3.3 V @ 300–500 mA+ | +| BOOST1 | 5 V booster | 5 V boost converter with enable pin | Must be GPIO‑controllable | +| USB1 | USB‑C receptacle | Standard USB‑Type C SMD connector | Dual‑role (charging + programming) | +| USB_PROT1 | USB‑line protection | USB‑ESD array / 5‑V clamp | Protects D‑/D+ and VBUS | +| VIN_PROT1 | External input protection | Wide‑input buck (e.g., LM2576‑style or similar) plus TVS | Steps 4–12 V down to safe rail | +| OLED1 | OLED display connector | 4‑pin header / footprint | 3.3 V, GND, SDA, SCL | +| CRYST1 | 40 MHz / 32 kHz crystals | 40 MHz + 32.768 kHz (if required) | As per ESP32‑S3 / RTC requirements | + +*** + +You can now save this as `wearable_esp32s3_spec.md` and hand it directly to your PCB designer; they can use the section headings and BOM table as a formal reference. \ No newline at end of file