
Final external pcb
petriiar2/Stress_device
Description of a device for measuring patient's stress and pain at a dentist's appointment

Description of a device for measuring patient's stress and pain at a dentist's appointment
Final internal pcb is an open-source printed circuit board by petriiar2, from the petriiar2/Stress_device repository on GitHub. It is a 2-layer board of 37 × 33 mm with 8 parts on 19 nets, routed with 35 tracks and 0 vias.
Its parts include 6 connectors, 1 resistor and 1 IC. It belongs with the nRF52 and nRF5x boards of this library.
PCC1 Project | KTH Royal Institute of Technology | MSc Medical Engineering | Stockholm, 2026
This repository covers only the hardware design, sensor selection, wiring, and embedded firmware — the physical core of the system. Other aspects of the project ( software component , website ) not considered in this repository
Dental patients cannot speak during procedures. The traditional workaround — raising a hand to signal pain — forces dentists to split their attention between precise work under magnifying loupes and watching for a hand signal outside their field of view. It is also binary: the signal says stop, but conveys nothing about intensity or rising discomfort.
BM-Dentist is a Bluetooth-enabled physiological monitoring system that gives patients a richer, low-effort communication channel while providing dentists with objective, real-time data about patient comfort:
The system is designed as a prototype towards clinical use — not yet a certified medical device.
The system consists of three interconnected subsystems:
┌──────────────────────────────┐ BLE 5.0 ┌──────────────────────────────────────┐
│ INTERNAL STATION │ ────────────────────► │ EXTERNAL STATION │
│ (Patient Side) │ │ (Dentist Side) │
│ │ │ │
│ Pressure Sensor │ │ nRF52840 #1 ──UART── nRF52840 #2 │
│ GSR Sensor │ XIAO nRF52840 │ LED Pain Ring OLED Display │
│ Moisture Sensor │ (BLE Peripheral) │ LED Stress Ring Buttons │
│ MAX30102 (PPG) │ │ (BLE Central) (BLE→USB) │
│ │ │ │
└──────────────────────────────┘ └──────────────┬───────────────────────┘
│ USB Serial
┌────────▼────────┐
│ WEB APP │
│ (HTML/JS) │
│ Real-time plot │
│ Post-proc stats│
└─────────────────┘Data flow summary:
The web/software layer (dashboard, statistical analysis, CSV export) was developed by other team members and is referenced here for context only.
The internal station is the patient-held device. It houses all sensors, the microcontroller, and the BLE radio inside a custom 3D-printed enclosure designed for comfortable grip. Sensors that must contact the patient's skin (electrodes, moisture pad) exit the enclosure via JST connectors and are attached externally.
pressure,gsr,moisture\nBefore a procedure, a 5-second calibration sequence is triggered from the dentist side:
| Phase | Patient action | What is recorded |
|---|---|---|
| Resting | Hold balloon without squeezing | P_min — baseline pressure |
| Max squeeze | Squeeze as hard as possible | P_max — individual squeeze ceiling |
| Resting (continuous) | Stay relaxed | GSR_baseline — calm-state conductance average |
Subsequent readings are normalised as:
pressure_norm = (P_current - P_min) / (P_max - P_min)
stress_norm = |GSR_current - GSR_baseline| / GSR_rangePatient gender and age category are also collected at calibration time (they affect pain thresholds), though in the current prototype the demographic adjustment coefficients are set to neutral (A=1.0, B=0.0) pending clinical data.
The dentist-side station receives data wirelessly and translates it into immediate visual feedback — no screen-watching required.
Two XIAO nRF52840 boards are connected by a UART link (TX/RX crossed: D6↔D7):
nRF52840 #1 — Signal processing & LED control
"SensorNode")nRF52840 #2 — Interface & data relay
CALIB,<gender>,<age> — start calibrationRESET_CALIB — wipe calibrationWORKCFG — start working mode with selected optionsWORK_END — stop working mode, return to sleep| Mode | Description |
|---|---|
| Sleep | BLE connection active, command exchange only — no data streaming or LED updates |
| Working | Full data streaming at 20 Hz, LED feedback active, data sent to computer |
| Property | Value |
|---|---|
| Type | Analog MEMS pressure sensor |
| Interface | Analog voltage → ADC pin D2 |
| Supply | 3.3 V |
| ADC resolution | 12-bit (0–4095) |
| Physical connection | Flexible tubing → squeeze balloon (water bottle) |
| Sampling rate | 20 Hz |
Purpose: The primary intentional pain-signalling channel. The patient squeezes a balloon; the pressure sensor sits inside the enclosure connected by tubing, so there is no direct electronic contact with the patient's hand. This improves hygiene and allows the balloon to be replaced/sterilised between patients.
What we get: An analogue voltage proportional to balloon pressure. After calibration, this maps linearly to a 0–100% pain scale. In pattern mode, rising edges are counted over a sliding window to detect discrete squeeze events.
Why this sensor: The specific sensor was supplied to the team and is well-matched to the use case — it captures a deliberate, high signal-to-noise signal that requires no inference to interpret.
| Property | Value |
|---|---|
| Type | Skin conductance, analog |
| Interface | Analog voltage → ADC pin D0 |
| Supply | 3.3 V |
| Electrode placement | Index finger + middle finger |
| Sampling rate | 20 Hz |
Purpose: Continuous, involuntary stress monitoring. Galvanic skin response measures changes in sweat gland activity driven by the sympathetic nervous system. It captures anticipatory anxiety — the patient may start showing stress before consciously deciding to squeeze.
What we get: A slow-varying analogue voltage that rises as skin conductance increases (higher stress → more perspiration → lower resistance → higher conductance). The deviation from the calibrated calm baseline is used as the stress metric.
Why this sensor: GSR is a well-established proxy for sympathetic arousal. Practical alternatives (e.g., dedicated EDA modules) had longer delivery times; the chosen module was available immediately and is straightforward to integrate with a single ADC pin.
Wiring: Two finger-clip electrodes connect to the sensor module via wires that exit the enclosure through a JST socket. The module output goes to pin D0.
| Property | Value |
|---|---|
| Type | Capacitive soil moisture sensor (repurposed) |
| Interface | Analog voltage → ADC pin D1 |
| Supply | 3.3 V |
| Placement | Palm contact (external, JST connector) |
| Sampling rate | 20 Hz |
Purpose: Secondary stress indicator via perspiration. Stress-induced sweating changes the dielectric properties of the skin surface, which the capacitive sensor detects as a change in output voltage.
What we get: An analogue voltage that varies with surface moisture. In our pilot validation, moisture features showed near-complete binary separation between no-stress and stress conditions (AUC ≈ 0.02–0.035, Cliff's δ ≈ −0.93 to −0.96 — moisture decreases in our sensor's output with higher sweat, reflecting sensor polarity).
Important caveat: This sensor is designed for soil, not human skin. Its readings are highly sensitive to contact area and the rigid structure makes consistent placement difficult. It is treated as an exploratory channel in the current prototype. A future iteration should replace it with a skin-validated conductance or hydration sensor.
Wiring: The sensor pad exits the enclosure via JST connector and is held against the patient's palm.
| Property | Value |
|---|---|
| Type | Photoplethysmographic (optical heart rate + SpO₂) |
| Interface | I²C → pins D4 (SDA) / D5 (SCL) |
| Supply | 3.3 V |
| Interrupt pin | D3 (INT, optional) |
Purpose: Heart rate and pulse-related metrics are strong indicators of physiological stress. HRV (heart rate variability) in particular is sensitive to autonomic nervous system state.
Current status: ⚠️ Not used in the current validated prototype. One of the two purchased modules was defective (internal short). The second produced unstable readings. The JST connector and I²C lines remain present on the PCB for future integration. Results in this report do not rely on PPG data.
Why this sensor: Selected primarily on cost, feature set, and community support under a limited budget. A future iteration should source a verified module or use an alternative such as the MAX86150.
Used for all three microcontroller roles (internal station + both external boards).
| Spec | Value |
|---|---|
| CPU | ARM Cortex-M4 @ 64 MHz |
| BLE | 5.0 integrated |
| ADC | 12-bit, 6 analog pins |
| Size | 20 × 17.5 mm |
| Supply | 3.3 V logic; powered via VBUS (5 V) |
| I²C | Hardware I²C on D4/D5 |
| UART | Hardware Serial1 on D6/D7 |
"SensorNode""SensorNode""pressure,gsr,moisture\n"analogReadResolution(12)D6(#1) → D7(#2), D7(#1) → D6(#2) (TX/RX crossed)Used on both internal and external stations.
| Output | Used for |
|---|---|
| 5 V | XIAO VBUS pin, LED rings (5 V NeoPixel-type) |
| 3.3 V | All sensors (pressure, GSR, moisture, PPG) |
Schematics and PCB layouts were designed in KiCad. Key design decisions:
KiCad project files are included in /internal/ or /external/ .
| Area | Current state | Planned improvement |
|---|---|---|
| PPG (heart rate) | Unstable — excluded from prototype | Source verified MAX30102 or MAX86150; repeat validation |
| Moisture sensor | Exploratory — not skin-specific | Replace with validated skin conductance/hydration sensor |
| Demographic calibration | Coefficients set to neutral (A=1, B=0) | Add clinically derived thresholds per gender/age group |
| Clinical validation | Simulated stress (video induction), 1 subject | Ethically approved trials with real dental patients |
| Enclosure | Internal box only printed | Print external box; ergonomic redesign for sterile grip |
| Accessibility | Hand squeeze only | Add foot-operated or capacitive-touch alternative inputs |
| Sterilisation | Not yet validated | Material selection and sterilisation protocol testing |
The hardware design presented in this repository — including sensor selection and wiring, PCB schematics, microcontroller configuration, BLE/UART communication architecture, and embedded firmware for data acquisition and LED control — was designed and implemented by Iaroslav Petrishchev.
The following parts of the system are the work of other team members and are therefore not covered in this repository:
Full project report available upon request.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 3 | Conn_01x03_Socket | Connector_JST:JST_XH_B3B-XH-A_1x03_P2.50mm_Vertical | J5, J8, J9 |
| 1 | 220 R | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P7.62mm_Horizontal | R4 |
| 1 | Conn_01x02_Socket | Connector_JST:JST_XH_B2B-XH-A_1x02_P2.50mm_Vertical | J6 |
| 1 | Conn_01x04_Socket | Connector_JST:JST_XH_B4B-XH-A_1x04_P2.50mm_Vertical | J7 |
| 1 | Conn_01x06 | Package_DIP:DIP-6_W7.62mm | J1 |
| 1 | XIAO-nRF52840-DIP | RF_Module:XIAO-nRF52840-DIP | U1 |

petriiar2/Stress_device
Description of a device for measuring patient's stress and pain at a dentist's appointment


joeycastillo/Sensor-Watch
A board replacement for the classic Casio F-91W wristwatch

rusefi/rusefi
rusefi - GPL internal combustion engine control unit

hoglet67/RGBtoHDMI
Bare-metal Raspberry Pi project that provides pixel-perfect sampling of Retro Computer RGB/YUV video and conversion to HDMI

shanteacontrols/OpenDeck
A platform for building interactive control and sensing devices using MIDI and OSC built with Zephyr RTOS.

hackclub/OnBoard
💡 Join 1,000 teenagers and make your first PCB with a $100 grant!

dangiu/PicoMemcard
Emulating PSX Memory Card (or controller) using a Raspberry Pi Pico

OLIMEX/DIY-LAPTOP
Do It Yourself Open Source Hardware and Software Modular Hacker's Friendly Laptop
It measures 37 × 33 mm and has 2 copper layers, 1.6 mm thick.
8 parts. 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.
From the petriiar2/Stress_device repository on GitHub, at the commit this page was made from: the board is Final internal pcb/Final internal pcb.kicad_pcb and its schematic Final external pcb/Final external pcb.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask petriiar2 before reusing the design.