Skip to the content
PCBKitNew board
2 layers72.9 × 57.1 mmAlaafia PCB local, the printed circuit board in 3D

Alaafia PCB local

BigSmartt01/Fall_Sensor

Use of PlatformIO

Size
72.9 × 57.1 mm
Copper layers
2
Thickness
1.6 mm
Parts
12
Nets
27
Pads
58
Tracks, vias
101, 0
Pours
1
Routed
Yes
KiCad
KiCad 10.0 (file 20260206)
Created
1 May 2026
Updated
30 Jul 2026

Overview

Alaafia PCB local is an open-source printed circuit board by BigSmartt01, from the BigSmartt01/Fall_Sensor repository on GitHub. It is a 2-layer board of 72.9 × 57.1 mm with 12 parts on 27 nets, routed with 101 tracks and 0 vias.

It is built around the MT3608, BMI160 and TP4056. Its parts include 3 ICs, 3 connectors, 1 resistor and 1 inductor. It belongs with the ESP32 and RISC-V boards of this library.

Main components

3

README

README.md

Fall Sensor - ESP32-C3 Wearable Fall Detection System

Overview


3D render of the Fall Sensor carrier PCB (v1, single-layer)

An intelligent wearable fall detection system built on the ESP32-C3 Super Mini with BMI160 IMU, targeting elderly users with waist/lower-back placement. The system combines a 4-stage rule-based state machine with an on-device CNN (TFLite Micro, int8 QAT) for high-confidence detection. A persistent alerted state holds the alert active until the person's posture changes or they self-dismiss, preventing the common problem of fall alerts clearing while the person is still on the floor.

Real-time data streams over WiFi TCP to a PyQtGraph dashboard and InfluxDB/Grafana stack for threshold tuning and post-event analysis. A dual-purpose button handles both "I'm okay" dismissal and manual "I need help" alerts.

Hardware

ComponentPartNotes
MCUESP32-C3 Super MiniUSB-CDC, BLE, WiFi
IMUBMI160I2C 0x68, ODR 200Hz
ChargerTP4056LiPo, 4.2V cutoff
Boost converterMT3608Battery -> 5V rail
BuzzerPassive buzzerActive LOW driver
ButtonTactile switchDual-purpose: dismiss/SOS
Board5x7cm perfboardPower/signal zone separated

| Board | 5x7cm perfboard | Power/signal zone separated |


Hand-soldered perfboard build, ESP32-C3 Super Mini + BMI160

Pin assignments (ESP32-C3 Super Mini):

PinFunction
GPIO8SDA (BMI160)
GPIO9SCL (BMI160)
GPIO2Buzzer
GPIO3Button (INPUT_PULLUP, active LOW)
GPIO4BMI160 INT1 (reserved)
GPIO5BMI160 INT2 (reserved)

Power path: LiPo -> TP4056 (charge management) -> MT3608 (boost to 5V) -> ESP32-C3 5V pin -> onboard LDO -> 3.3V rail -> BMI160 VCC

Project Structure

text
Fall_Sensor/
├── firmware_idf/                    # ESP-IDF project (active)
│   ├── CMakeLists.txt
│   ├── partitions.csv               # custom 3MB app partition for ESP32-C3 4MB flash
│   ├── sdkconfig.defaults
│   ├── main/
│   │   ├── CMakeLists.txt
│   │   ├── fall_sensor.cpp          # app_main() entry point
│   │   ├── main.cpp                 # state machine + BMI160 + tasks
│   │   ├── inference.cpp            # TFLite Micro wrapper + consecutive filter
│   │   ├── inference.h
│   │   ├── wifi_stream.cpp          # WiFi TCP server for dashboard streaming
│   │   ├── wifi_stream.h
│   │   └── fall_model.h             # auto-generated model C header
│   └── components/
│       ├── esp-tflite-micro/        # git submodule (espressif official)
│       ├── DFRobot_BMI160/          # git submodule (unmodified)
│       └── DFRobot_BMI160_wrapper/  # local CMakeLists.txt wrapper (tracked)
├── firmware/                        # legacy PlatformIO attempt - kept for reference
├── docs/
│   ├── ERRORS_AND_FIXES.md
│   └── ML_README.md
├── hardware/                        # KiCad schematics, BOM, perfboard layout
├── visualization/

Cloning

This project uses git submodules. Clone with:

bash
git clone --recurse-submodules <repo-url>

If already cloned:

bash
git submodule update --init --recursive

Building and Flashing

Open ESP-IDF terminal in VS Code (Ctrl+Shift+P -> ESP-IDF: Open ESP-IDF Terminal):

bash
cd firmware_idf
idf.py set-target esp32c3
idf.py build
idf.py -p COM7 flash monitor

Exit monitor: Ctrl+]

On first build after a clean or target change, delete sdkconfig (not sdkconfig.defaults) before running set-target to avoid stale target conflicts.

How It Works

State Machine

text
STATE_NORMAL
  accelMag < 3.0 m/s²  ->  STATE_FREEFALL  (timeout 400ms)
  
STATE_FREEFALL
  accelMag > 20.0 m/s² ->  STATE_IMPACT    (window 500ms)
  
STATE_IMPACT
  gyroMag < 25 deg/s   ->  STATE_POST_IMPACT_STILLNESS
  
STATE_POST_IMPACT_STILLNESS
  stillness 2.5s + orientation change + NN confirms  ->  STATE_FALL_CONFIRMED
  
STATE_FALL_CONFIRMED
  captures fall orientation, triggers buzzer, fires FALL event
  ->  STATE_FALL_ALERTED  (persistent - does not auto-clear)
  
STATE_FALL_ALERTED
  re-buzzes every 10s
  posture change > 2.0 m/s² delta  ->  STATE_NORMAL
  button press ("I'm okay")        ->  STATE_NORMAL

Any state: button press outside STATE_FALL_ALERTED -> manual "I need help" alert

ML Inference

  • Model: lightweight 1D CNN, int8 QAT, 16.9KB flash, 47.1KB RAM
  • Input: 512-sample sliding window of accel Y (in g) at 200Hz = 2.56 second window
  • Consecutive filter: 3 consecutive runs >= 80% probability required before confirming
  • Falls back to rule-based alone if window not yet full

Sensor Configuration

BMI160 ODR set to 200Hz via direct register write after I2cInit():

cpp
Wire.beginTransmission(0x68);
Wire.write(0x40); Wire.write(0x09);  // ACC_CONF: 200Hz
Wire.endTransmission();

Wire.beginTransmission(0x68);
Wire.write(0x42); Wire.write(0x09);  // GYR_CONF: 200Hz
Wire.endTransmission();

BMI160 init order matters: softReset() must be called before I2cInit(). Reversed order causes silent all-zero readings.

Serial/WiFi Output Format

text
DATA,<timestamp_ms>,<accelMag>,<gyroMag>,<state>
FALL,<timestamp_ms>

State values: 0=NORMAL, 1=FREEFALL, 2=IMPACT, 3=POST-IMPACT STILLNESS, 4=FALL CONFIRMED, 5=FALL ALERTED

Output goes to both USB Serial (printf) and WiFi TCP simultaneously.

Visualization

Dashboard (PyQtGraph)

bash
cd visualization
python dashboard.py

Switch between serial and WiFi at the top of the file:

python
CONNECTION_MODE = "serial"   # or "wifi"
WIFI_HOST       = "192.168.x.x"   # ESP32-C3 IP printed on boot
WIFI_PORT       = 3333

The ESP32-C3 IP is printed on boot: [WiFi] Connect dashboard with: TCP <IP>:3333


Live dashboard showing a detected fall event: freefall, impact, then post-impact stillness

InfluxDB + Grafana

bash
cd visualization
docker compose up -d

ML Pipeline

See docs/ML_README.md for full training and quantization details.

Quick retrain after any model or dataset change:

bash
cd tests/three_classes
venv_compat\Scripts\activate    # Python 3.10 required - TF not yet on 3.13+
python train_qat.py
python convert_to_header.py     # outputs firmware_idf/main/fall_model.h
cd ../../firmware_idf
idf.py build
idf.py -p COM7 flash monitor

Current Model Performance

MetricValue
Overall accuracy95.21%
Fall recall97.38%
ADL recall95.16%
Flash16.9 KB
Inference RAM47.1 KB
Window512 samples at 200Hz = 2.56s

Python Dependencies

bash
pip install -r requirements.txt

ML training scripts require Python 3.10 in a separate venv (venv_compat) - TensorFlow does not support Python 3.13+.

Future Work

  • PCB design: 2-layer board, BMI160 and ESP32-C3 Super Mini as soldered modules on carrier, discrete power section
  • Enclosure: TPU 3D printed, waist/belt-clip form factor
  • BLE alert path for phone app connectivity
  • SIM/GPS module on existing 5V rail for cellular fallback
  • BMI160 INT1/INT2 for hardware step detection and low-power motion-wake
  • Collect real elderly fall simulation data for model fine-tuning

Troubleshooting

See docs/ERRORS_AND_FIXES.md

Author

Smart Ayodele ayosmart129@gmail.com

Parts

12
QtyValueFootprintReferences
2NetTie_2PCM_SL_Jumpers:JUP_P5.08mmNT1, NT3
110KResistor_THT:R_Axial_DIN0411_L9.9mm_D3.6mm_P15.24mm_HorizontalR1
1BATTERYConnector_JST:JST_EH_B2B-EH-A_1x02_P2.50mm_VerticalJ1
1BMI160Alaafia_Footprint:BMI160U2
1BUTTONConnector_JST:JST_EH_B2B-EH-A_1x02_P2.50mm_VerticalJ2
1Buzzer_5VBuzzer_Beeper:MagneticBuzzer_ProSignal_ABT-410-RCBZ1
1ESP32-C3_SUPERMINI_THfootprint:MODULE_ESP32-C3_SUPERMINI_THU1
1GSMConnector_JST:JST_EH_B6B-EH-A_1x06_P2.50mm_VerticalJ3
1MT3608Alaafia_Footprint:MT3608U3
1NetTie_2PCM_SL_Jumpers:JUP_P14mmNT2
1TP4056Alaafia_Footprint:TP4056L1

Questions

How big is the Alaafia PCB local PCB?

It measures 72.9 × 57.1 mm and has 2 copper layers, 1.6 mm thick.

What parts does the Alaafia PCB local use?

12 parts, built around the MT3608, BMI160 and TP4056. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.

Where can I download the Alaafia PCB local KiCad files?

From the BigSmartt01/Fall_Sensor repository on GitHub, at the commit this page was made from: the board is hardware/One-Layer/Alaafia_PCB_local.kicad_pcb and its schematic hardware/One-Layer/Alaafia_PCB_local.kicad_sch. PCBKit opens the board in the browser, with nothing to install.

Can I use the Alaafia PCB local design in my own project?

Its repository states no licence, so its author keeps all rights: ask BigSmartt01 before reusing the design.

Similar boards

  • 2 layers308.7 × 241.8 mmOTTOtact, the printed circuit board in 3D

    OTTOtact

    cester-ino/OTTO-hardware

    those specs refer to the tactile buttons version, but a led backlight button version is in the works too.

    229 parts49GPL-3.0
  • 2 layers60 × 40 mmForcegauge, the printed circuit board in 3D

    Forcegauge

    szbeni/forcegauge

    Traning for climbing. Load cell with HX711 and real time plotting,

    77 parts18GPL-3.0
  • 2 layers83.2 × 42.1 mmIT8951-HAT, the printed circuit board in 3D

    IT8951-HAT

    martinberlin/H-cinread-it8951

    CINWRITE pcb is the Hardware repository for the HAT that provides GoodDisplay DEXA-C097 controller a fast way to talk SPI and 5V boost converter.

    65 parts12
  • 4 layers108.6 × 87.7 mmBlinky badge light, the printed circuit board in 3D

    Blinky badge light

    rowr111/blinky-badge-light

    lighting badge with unique patterns and sound reactivity

    123 parts9MIT
  • 2 layers79.8 × 89.3 mmKicad sailframes b1, the printed circuit board in 3D

    Kicad sailframes b1

    sailframes/core

    Open-source sailboat racing data logger and analytics platform.

    72 parts8
  • 2 layers82.5 × 136.7 mmGameboy dmg, the printed circuit board in 3D

    Gameboy dmg

    alxhoff/gameboy-dmg-pcb

    PCB for Gameboy DMG with audio and GPIO expander to provide I2C interface to push buttons

    95 parts4GPL-3.0
  • 2 layers65 × 56.5 mmPiSupply, the printed circuit board in 3D

    PiSupply

    enwi/PiSupply

    Uninterruptable power supply for Raspberry Pi's, which can also power external HDDs

    80 parts4LGPL-3.0
  • 2 layers80 × 25 mmLedGateController, the printed circuit board in 3D

    LedGateController

    Knifa/ws28xx-led-driver

    A straightforward DIY WS28xx LED driver.

    73 parts3