MustafaMulla29/bluetooth-connected-pedometer
It defines a PCB footprint and schematic symbol for a row of solder pads used as wire connection points, featuring customizable spacing and label annotations.
- Version
- 0.3.0
- License
- unset
- Stars
- 0
Use with the tscircuit CLI
tsci is the tscircuit CLI. Install it with npm install -g tscircuit.
tsci clone MustafaMulla29/bluetooth-connected-pedometer # download the package files into ./bluetooth-connected-pedometer
tsci add MustafaMulla29/bluetooth-connected-pedometer # add it to your project as @tsci/MustafaMulla29.bluetooth-connected-pedometerIn a cloned or new (tsci init) project: tsci dev starts a local preview, tsci build outputs Circuit JSON, and tsci push publishes to tscircuit.com.
README.md
# Stride — Bluetooth pedometer, Rev E development
A 46 × 36 mm, two-layer tscircuit PCB using an **RF-BM-2340B1 module containing CC2340R52E0RKPR**, **BQ25186DLHR**, **BQ27427YZFR** and **BMA400**. It supports a protected 100 mAh Li-ion cell, an external 0.91-inch 128×32 OLED, a charging dock, two buttons and SWD.
**Routing and fabrication geometry pass.** The source uses tscircuit's default router with `minViaHoleDiameter="0.3mm"`, `minViaPadDiameter="0.45mm"`, `minTraceToPadEdgeClearance="0.13mm"`, and 0.10 mm nominal traces. The clean build has zero native circuit errors and the independent geometry audit has zero violations. JLCPCB upload files are in `fabrication/`; inspect all component rotations in JLCPCB's assembly viewer before payment. See `docs/validation.md` for the recorded results.
## Open and build
```sh
bun install
python3 -m pip install -r requirements-fabrication.txt
bun run check
bun run build
bun run fabrication
bun run dev
```
The build generates previews and fails if any tscircuit error remains. The separate fabrication check validates physical copper connectivity and JLCPCB clearance/drill constraints.
The entry point is `index.circuit.tsx`: explicit component JSX and `<trace>` connections in a default-exported component. `imports/` contains the supplier component footprints; `WirePads.tsx` contains only the reusable solder-land footprint. There are no router props, custom router files, routing phases, or routing-disable flags. The board uses the installed default tscircuit router.
The CLI may label its default routing pass “phase 1” in diagnostics. No routing-phase elements or phase settings are defined in this project. The repository includes board pin definitions and bring-up notes; it does not yet include a complete, flashable pedometer firmware application.
`dist/index/` contains the generated circuit JSON, PCB preview and schematic. Use the SVG for detailed inspection; the overview PNG reduces a large schematic to a single image. `docs/bom-and-placement.csv` is the generated sourcing/assembly review table. `firmware/board_config.h` and `docs/interfaces.md` define the physical and firmware interface contract.
## System architecture
```mermaid
flowchart LR
Dock[Regulated 5 V dock] --> Charger[BQ25186 charger / power path]
Battery[Protected 1S 100 mAh cell] --> Gauge[BQ27427 BAT → internal shunt → SRX]
Gauge <--> Charger
Charger -->|VSYS| LDO[TPS7A02 3.3 V logic regulator]
LDO --> MCU[CC2340R5 module + integrated RF / clock]
LDO --> Accel[BMA400 step counter]
LDO --> Switch[TPS22917 display switch]
Switch --> OLED[External 128×32 OLED]
MCU -->|OLED_EN| Switch
Accel -->|I²C + interrupt| MCU
Gauge <-->|Main I²C| MCU
Charger <-->|Main I²C| MCU
MCU -->|Separate software I²C| OLED
MCU --> Antenna[Module PCB antenna]
```
The accelerometer counts steps while the MCU sleeps. The MCU wakes for a button, a batched sensor event, BLE event, or scheduled housekeeping. The display is powered only when requested. There is no continuously illuminated power LED.
## Key design decisions
- **Battery voltage:** the 4.2 V cell and 5 V charging supply never feed MCU VDDS directly. TPS7A02 supplies nominal 3.3 V from VSYS and the CC2340 module contains the chip-side power and clock circuitry. The external LDO can enter dropout as the cell empties; logic remains usable below 3.3 V but the OLED must be disabled before its minimum supply is violated.
- **Charger package:** BQ25186 replaces the recommended BQ25150 because its perimeter-pin WSON package can be escaped with the requested vias. The 0.4 mm-pitch inner balls of BQ25150 cannot use repeated 0.45 mm via pads. This is a circuit redesign with a new pinout and register map.
- **Charger startup:** BQ25186 defaults to 10 mA charging. Firmware configures 25 mA, 4.20 V and 10% termination. This part has no external IMAX resistor; bound all charge-current writes to the selected cell rating. TPS22917 independently switches the OLED from the 3.3 V logic rail, with R1 holding it off at reset and C18 slowing startup.
- **Temperature sensing:** J2 expects a 10 kΩ NTC physically attached to the cell, returning to GND. TS/MR shares this input with SW2. The old BQ25150 parallel resistor is removed; cell temperature monitoring remains enabled.
- **Fuel-gauge topology:** J2 positive goes only to the gauge's BAT side and its decoupling capacitor. The gauge's SRX feeds charger BAT pins and their capacitor. All useful charge/discharge current crosses the internal high-side shunt. No second sense resistor is required. Both VSS balls are grounded, BIN has a 10 kΩ pulldown and VDD has a dedicated 2.2 µF capacitor.
- **Display isolation:** the selected module is [Adafruit 4440](https://www.adafruit.com/product/4440), 128×32 I²C at `0x3C`. J3 is a four-wire solder connection. Its bus is separate from the main I²C bus so powering down the display does not back-power it from always-on pull-ups. Firmware must park the two display GPIOs low before turning off OLED_VCC. The OLED's own PCB mounts above this board on insulating spacers; it is not a bare OLED glass footprint.
- **Radio:** RF-BM-2340B1 contains CC2340R5, its 48 MHz clock, RF matching and PCB antenna. The host board has an all-layer copper keepout under the antenna and along the adjacent board edge. Keep battery, OLED, metal fasteners and enclosure metal away from this region. Validate range and RF performance in the final enclosure. Configure the module's internal LF RC oscillator; a 32.768 kHz crystal is not fitted in its standard assembly.
- **Programming:** J5 is a five-pad SWD fixture connection. VREF reports the board supply; avoid back-powering it. SWDIO and SWCLK connect directly to the module with no external bias resistors. The module must be flashed with a custom pedometer application; its stock serial firmware does not implement this design. See the module-pad cross-reference in `docs/interfaces.md`.
## Expected battery life
The included `scripts/power_budget.py` uses a deliberately conservative **50 µA gauge allowance**, rather than assuming the gauge always reaches its 9 µA sleep specification. The display uses a 20 mA allowance from its manufacturer page. Radio/CPU workload and leakage are explicit engineering assumptions.
| Assumption | Value |
|---|---:|
| Nominal cell | 100 mAh |
| Usable capacity allowance | 80% |
| Display use | 30 views/day × 5 seconds |
| OLED current while on | 20 mA |
| Estimated average total | 124.9 µA |
| Estimated runtime | 26.7 days |
At 60 views per day, the same model gives roughly three weeks. A continuously lit OLED reduces runtime to hours. Capacity at the actual load and temperature, aging, BLE settings, regulator dropout, and real display content affect results. Measure the assembled system before claiming weeks of runtime.
```sh
python3 scripts/power_budget.py
python3 scripts/power_budget.py --capacity-mah 50 --views-per-day 60
```
## Assembly and sourcing
| Item | Exact selection / requirement |
|---|---|
| U1 | RF-BM-2340B1, 30 castellated pads at 1.27 mm pitch, JLC C7500868 |
| U2 | BQ25186DLHR, 10-pin WSON + thermal pad, JLC C44639442 |
| U3 | BQ27427YZFR, 9-ball 0.5 mm-pitch DSBGA, JLC C6075475 |
| U4 | TPS7A0233PDBVR, 3.3 V SOT-23-5, JLC C2887324 |
| U5 | BMA400, 2×2 mm LGA-12, JLC C437655 |
| U6 | TPS22917DBVR, SOT-23-6 display load switch, JLC C2681320 |
| SW1/SW2 | TS-1088-AR02016, JLC C720477 |
| OLED | Adafruit 4440, 128×32 I²C, external module and short four-wire harness |
| Battery | Protected 1S 3.7 V nominal / 4.20 V Li-ion, 100 mAh, rated for ≥50 mA charging; confirm cell dimensions and discharge rating |
| Thermistor | 10 kΩ NTC compatible with the charger's selected TS/JEITA thresholds; bonded to cell |
| Dock | Regulated 5.0 V, keyed/polarity-safe contacts, external current limiting and input ESD protection |
Passive footprints and values are in the source and generated BOM. **Procurement constraints matter:**
- C16: 4.7 µF, 0805, 25 V X5R/X7R; effective input capacitance must remain ≥1 µF under bias.
- C17: 10 µF, 0805, 25 V X5R/X7R; nominal SYS capacitance is 10 µF and effective capacitance must remain ≥1 µF under bias.
- C18: 1 nF C0G, 0402, from TPS22917 CT to VIN. C20: 4.7 µF, 0603, at the display switch input. Measure display startup against the 200 mA logic-regulator rating.
- C21: 2.2 µF local display-switch output decoupling; C29 adds 2.2 µF at the display harness. Check stability/startup with the module's additional capacitance.
- C5: 10 µF, 0603, ≥6.3 V module supply decoupling; verify effective capacitance under bias.
- Other µF/nF capacitors: X5R/X7R, ≥6.3 V on battery/logic rails; ≥10 V on VSYS. Consult the relevant regulator's minimum effective capacitance.
- Resistors: 0402, 1%, ≥50 mW; R1 is a 100 kΩ display-enable pulldown.
The fuel gauge remains a 0.5 mm-pitch DSBGA and needs precision assembly and inspection. The released files use 0.30 mm via drills, 0.45 mm via pads and 0.10 mm traces. Native DRC and the independent copper/drill audit pass. The host has no controlled-impedance RF feed; RF routing is inside the module. Select a standard 1.6 mm, two-layer stackup in the JLCPCB order form.
Use two 2 mm mounting holes with insulating hardware. Keep antenna elements outside the PCB/battery/display metal shadow. Fix the accelerometer board rigidly in the enclosure and characterize step counting in its final wearing position.
## Prototype order and bring-up
1. Upload `fabrication/stride-reve-gerbers.zip`, `fabrication/BOM.csv`, and `fabrication/CPL.csv`. Select a two-layer, 1.6 mm board and confirm stock, the U1 module origin, and every component rotation in JLCPCB's assembly viewer before payment.
2. Order a small prototype batch. The external cell, NTC, OLED and fixture are separate items.
3. Integrate/build the TI SDK application and follow `firmware/README.md` for power, charge, I²C, clock, step-counter and RF bring-up.
4. Measure daily-use current, check module RF performance, and validate step counting in the final enclosure before producing a larger batch.
No boards have been ordered. This is an unassembled first-prototype PCB revision and the repository still lacks a complete flashable application, so it is not yet a tested finished pedometer.
## Primary references
- [TI CC2340R family data sheet](https://www.ti.com/lit/ds/symlink/cc2340r5.pdf): RKP package, supply limits, pin mux and clock requirements.
- [TI CC23xx/CC27xx hardware and PCB design guide, SWRA834A](https://www.ti.com/lit/pdf/SWRA834): RF filtering, clock tuning, grounding and bring-up.
- [TI BQ25186 data sheet](https://www.ti.com/lit/ds/symlink/bq25186.pdf): power path, TS/MR, current settings and WSON pinout.
- [TI TPS22917 data sheet](https://www.ti.com/lit/ds/symlink/tps22917.pdf): display switching, CT connection and discharge.
- [TI BQ27427 data sheet](https://www.ti.com/lit/ds/symlink/bq27427.pdf): BAT/SRX topology, decoupling and current consumption.
- [TI TPS7A02 data sheet](https://www.ti.com/lit/ds/symlink/tps7a02.pdf): supply range, dropout and output capacitor requirements.
- [Bosch BMA400 data sheet](https://www.bosch-sensortec.com/media/boschsensortec/downloads/datasheets/bst-bma400-ds000.pdf) and [official SensorAPI](https://github.com/boschsensortec/BMA400_SensorAPI).
- [Adafruit 4440 OLED specification](https://www.adafruit.com/product/4440): I²C address, module interface and current allowance.
- [RF-star module hardware data sheet](https://www.rfstariot.com/uploadfile/downloads/RF-BM-2340B1%20RF-BM-2340B1I%20Hardware%20Datasheet%20V1.1%2020240823.pdf): module pad mapping, antenna clearance and LF oscillator configuration.