Add design document.md

This commit is contained in:
Ghassan Yusuf 2026-03-26 23:28:13 +03:00
commit cfd555324c

274
design document.md Normal file
View File

@ -0,0 +1,274 @@
# ESP32S3 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-powerbattery-charging-and-gauge)
- [4. USBC interface and firmware protection](#4-usb-c-interface-and-firmware-protection)
- [5. Powersupply architecture](#5-power-supply-architecture)
- [6. Motion sensing (IMU)](#6-motion-sensing-imu)
- [7. Realtime clock (RTC)](#7-real-time-clock-rtc)
- [8. Deepsleep and powergating](#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. Powerpin 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 **ESP32S3** (preferred) or **ESP32C3**. The board targets sports/impactsensing applications (fist/leg strikes) and must balance:
- Tiny size for wearable use.
- Longterm battery life via deepsleep and powergating.
- Highintegrity IMU and powermonitoring (gasgauge, RTC).
The designer must translate this into a **schematic and doublesided PCB layout** that meets all constraints listed below.
***
## 2. MCU and wireless
- **MCU:**
- Primary: **ESP32S3** (smallformfactor, integrated WiFi/BLE, USBUART, 45+ GPIOs).
- Alternative (only if size is critical and WiFi/BLE robustness is secondary): **ESP32C3**.
- **Connectivity:**
- 2.4 GHz **WiFi 802.11 b/g/n**.
- **Bluetooth 5.0 (BLE)**.
- **RF layout:**
- Use either an **onboard PCB antenna** or a small external antenna connector, following Espressifs ESP32S3 hardware design guidelines.
- Provide proper RFmatching network and keepout zones around the antenna.
***
## 3. Power battery, charging, and gauge
- **Battery:**
- Singlecell **LiPo / LiIon** (nominal 3.7 V).
- **Charging:**
- Include a **LiPo charge IC** (e.g., TP4056, BQ2409xstyle, or similar modern IC) that:
- Accepts **5 V from USBC** → charges the battery.
- Reports charge status via **GPIOvisible signals** (e.g., CHRG, DONE).
- Charging current: **100500 mA** typical (designers choice based on thermal and USB limits).
- **Battery gauge (SoC monitoring):**
- Use a **gasgauge IC** (e.g., **MAX170xx family**, or similar) to measure:
- Battery voltage.
- Current.
- StateofCharge (%).
- Interface: **I²C** (shared bus with IMU and RTC).
- This is **mandatory**; do not rely purely on ADCbased voltageonly estimation.
***
## 4. USBC interface and firmware protection
- **USBC role:**
- One **USBType C receptacle** serving:
- **Battery charging** (via LiPo charge IC).
- **ESP32S3 programming and serial communication** (via builtin USBUART/JTAG).
- **D / D+ SMD jumpers:**
- Bring **D** and **D+** from the USBC connector to **SMD jumper pads** (e.g., 0603/0402style pads).
- When the pads are **shorted by solder**, D/D+ are connected to the ESP32S3.
- When the shorts are **desoldered**, D/D+ are disconnected, preventing:
- Userinduced firmware reflash.
- Accidental corruption of the device in the field.
- **USB protection:**
- Include **ESD protection / 5V clamp** on USB lines.
- Limit current via USBcompliant resistor or ICbased currentlimiting.
***
## 5. Powersupply architecture
- **3.3 V main rail:**
- Provide a **3.3 V regulator** for the ESP32S3, IMU, OLED, and 3.3 V peripherals.
- Prefer a **buck (stepdown) converter** over an LDO for efficiency and higher current capability.
- Target: **3.3 V @ 300500 mA** continuous (or higher if justified by load).
- **Boost converter / 5 V booster:**
- A **boost converter** (e.g., 1.84.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 ESP32S3.
- When the MCU goes into **deepsleep**, 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 **6axis or 9axis IMU** for impact / strike detection, supporting:
- Highg capability (≥ 80 g) for punches/kicks.
- Lownoise gyro for angular motion.
- Do **not** use obsolete parts like MPU9250 or MPU6050 due to supply and counterfeit risks.
- **Preferred IMU:**
- **ST LSM6DSV80X** (or equivalent) is recommended because:
- 6axis IMU in a **2.5×3 mm** package.
- Dual accelerometer paths: **16 g lowg** and **80 g highg**.
- Gyroscope and embedded AIstyle 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 ESP32S3 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. Realtime clock (RTC)
- **Function:**
- Provide **accurate timekeeping** during longterm batterypowered operation and deepsleep.
- **Requirements:**
- I²Ccompatible RTC module (e.g., common 32kHz RTC chips).
- **Tiny coincell footpring** for a **3V rechargeable** cell or supercapbackup (e.g., CR1220style).
- Alarm / interrupt output to a **GPIO** to wake the MCU from deepsleep.
- **Power:**
- Main power from **3.3 V rail**.
- Backup power from coin cell / supercap.
***
## 8. Deepsleep and powergating
- **System behavior in deepsleep:**
- In deepsleep, the ESP32S3 must **disable all noncritical external peripherals** and **isolate power rails** to minimize current draw.
- Targets for shutdown:
- **5 V booster** (GPIOdriven enable → low).
- Any external modules powered by external 5 V or switchable rails.
- **Powergating strategy:**
- Use **MOSFETbased powergating** or **enablecontrolled 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 **pullup resistors** (e.g., 4.7 kΩ) sized for selected bus speed.
***
## 10. GPIO exposure and modularity
- **All GPIOs:**
- Every **ESP32S3 GPIO** must be accessible:
- As **throughhole pads**, **0.1" header pins**, or **edgemountable pads**.
- Labeled with: **GPIO number + function** (e.g., `GPIO21 I2C_SDA`).
- **Externalcontrol signals:**
- Any GPIO that controls:
- Booster enable.
- Other external modules / regulators.
- Must be connected via **SMD jumper pads** (two pads with a shortable 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. Powerpin 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:**
- Pinheader style: `[GPIO_X][GND][3V3][5V]` repeated.
- Solderpad 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 **boostconverter output**, enabled only when the booster is active.
- Size power traces and vias to handle **highcurrent 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 wearableside components.
- Target in the range of **~20×30 mm** or smaller, depending on antenna and battery constraints.
- **PCB stackup:**
- Use **singlesided PCB** where possible.
- If routing density or RF layout requires it, switch to **doublesided (2layer) PCB**.
- **Ground and RF:**
- Use a **solid ground plane** under RF and MCU sections.
- Follow Espressifs ESP32S3 hardware design guidelines for antenna keepout and RFmatching.
***
## 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 412 V, negotiable with the designer).
- Include:
- A **wideinput buck regulator** (or similar) that steps higher input down to:
- A safe bus voltage for the **LiPo charger** (e.g., 4.55.5 V), and/or
- Directly to **3.3 V** for the MCU and peripherals.
- **Overvoltage protection** (OVP) or a **TVS / ESD clamp** on the `VIN` line.
- **Behavior:**
- The board can be powered via:
- USBC.
- 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 | ESP32S3WROOM32 / ESP32S3MINI | WiFi/BLE, USBUART, 45+ GPIOs |
| CHG1 | LiPo charger | TP4056 or similar modern LiPo charge IC | 5 V input, CHRG/DONE outputs |
| GAGE1 | Battery gauge | MAX1704x / MAX170xx family | I²Cbased SoC estimation |
| IMU1 | Motion sensor | ST **LSM6DSV80X** | 6axis, 16 g + 80 g accel, 2.5×3 mm |
| RTC1 | RTC module | Generic I²C 32kHz RTC with coincell backup | Alarm / interrupt output |
| REG1 | 3.3 V main rail | 3.3 V buck converter (e.g., AP62x0xstyle) | 3.3 V @ 300500 mA+ |
| BOOST1 | 5 V booster | 5 V boost converter with enable pin | Must be GPIOcontrollable |
| USB1 | USBC receptacle | Standard USBType C SMD connector | Dualrole (charging + programming) |
| USB_PROT1 | USBline protection | USBESD array / 5V clamp | Protects D/D+ and VBUS |
| VIN_PROT1 | External input protection | Wideinput buck (e.g., LM2576style or similar) plus TVS | Steps 412 V down to safe rail |
| OLED1 | OLED display connector | 4pin header / footprint | 3.3 V, GND, SDA, SCL |
| CRYST1 | 40 MHz / 32 kHz crystals | 40 MHz + 32.768 kHz (if required) | As per ESP32S3 / 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.