You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/versioned_docs/version-fils_en/project/2026/leyla_kubra.sahin/index.md
+49-18Lines changed: 49 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ A biometric analyzer powered by an STM32 that correlates real-time heart rate an
9
9
10
10
## Description
11
11
12
-
The Lie Detector is an asynchronous embedded system designed to monitor physiological stress indicators often associated with deception. Using an STM32 Nucleo-U545RE-Q microcontroller, the device establishes a physiological baseline for a subject's heart rate and skin conductivity (GSR). During active questioning, the system uses its ADC to monitor real-time sensor data, triggering visual PWM-controlled RGB LED transitions and audible buzzer alarms if simultaneous spikes above the baseline thresholds are detected.
12
+
The Lie Detector is an asynchronous embedded system designed to monitor physiological stress indicators often associated with deception. Using an STM32 Nucleo-U545RE-Q microcontroller, the device establishes a physiological baseline for a subject's heart rate and skin conductivity (GSR). During active questioning, the system uses its ADC to monitor real-time sensor data, triggering visual PWM-controlled RGB LED transitions and audible buzzer alarms if simultaneous spikes above the baseline thresholds are detected. The system also features a dynamic baseline engine, sensor stabilization logic, and two physical push buttons for start and reset control.
13
13
14
14
## Motivation
15
15
@@ -19,14 +19,15 @@ I was inspired by the modern criminal investigation tool, the "Polygraph", as I
19
19
20
20
Main software and system components:
21
21
22
-
***Physiological Data Acquisition Module**: Reads skin conductance from the Grove GSR sensor and heart rate from the Pulse sensor via ADC channels.
23
-
***Stress Analysis Module**: Processes the physiological baseline and current readings using an asynchronous logic brain to detect deception spikes.
24
-
***Shared State Module**: Manages safe data access between concurrent tasks using an `embassy-sync` Mutex.
25
-
***Visual Feedback Module**: Controls the RGB LED via PWM to transition colors from Green to Red based on stress intensity.
26
-
***Audible Alert Module**: Drives the passive buzzer using PWM to emit alarms that vary in pitch as deception scores rise.
27
-
***Logging and Debug Module**: Sends real-time sensor data and system status to a PC via USB for graphing and monitoring.
22
+
***Physiological Data Acquisition Module**: Reads skin conductance from the Grove GSR sensor and heart rate from the Pulse sensor via ADC channels. Includes sensor attachment detection and a stabilization countdown before calibration begins.
23
+
***Stress Analysis Module**: Processes the physiological baseline and current readings using an asynchronous logic brain to detect deception spikes. Uses a dynamic rolling baseline and a sustained-count mechanism to avoid false positives.
24
+
***Shared State Module**: Manages safe data access between all concurrent tasks using an `embassy-sync` Mutex protecting a central `BaselineData` struct.
25
+
***Visual Feedback Module**: Controls the RGB LED via PWM to smoothly transition colors from green to red based on the current deception score.
26
+
***Audible Alert Module**: Drives the passive buzzer to emit rapid pulses when the deception score exceeds a set threshold.
27
+
***Button Handler Module**: Monitors two physical push buttons — one to start the session (triggering the stabilization phase) and one to fully reset the system back to its idle state.
28
+
***Logging and Debug Module**: Sends real-time sensor data and system status to a PC via UART/USB for graphing and monitoring using the companion Python script.
@@ -37,44 +38,74 @@ Main software and system components:
37
38
38
39
### Week 8
39
40
* Focused on sourcing the specific hardware required for the project.
40
-
* Obtained the necessary components like the Pulse sensor, RGB LEDs, and an active buzzer.
41
+
* Obtained the necessary components like the GSR sensor, Pulse sensor, RGB LEDs, and an active buzzer.
41
42
42
43
### Week 9
43
44
* Completed the gathering of all secondary hardware, including the USB debugging cables and safety resistors.
44
45
* Completed the project documentation milestone.
45
46
47
+
### Week 10
48
+
* Tested the Grove GSR sensor in multiple different ways to make sure it's actually reading properly and gives consistent values.
49
+
* Started working on the KiCad schematic for the project.
50
+
* Also started writing the project code to get a feel for the structure before flashing anything onto the actual hardware.
51
+
52
+
### Week 11
53
+
* Finished the KiCad schematic and added it to the documentation.
54
+
* Soldered the analog pulse sensor and ran some tests to confirm it's fully functional and reading as expected.
55
+
56
+
### Week 12
57
+
* Started properly working on the full codebase and added several new features including sensor stabilization, dynamic rolling baseline, and sustained-count deception scoring.
58
+
* Flashed the code onto the hardware and did initial testing but couldn't get the buzzer to behave correctly, so that's still a work in progress.
59
+
60
+
### Week 13-14
61
+
* Finally got everything working, I completed the code and all the bugs that were piling up are now fixed.
62
+
* The full project is functional on the hardware.
63
+
* Added the two physical push buttons (start and reset) to the breadboard setup and integrated them into the system logic.
64
+
46
65
## Hardware
47
66
48
-
The project uses a mix of analog physiological sensors and asynchronous digital processing to achieve real-time deception detection. The hardware setup is centered around the STM32 Nucleo-U545RE-Q, which acts as the high-speed data aggregator.
67
+
The project uses a mix of analog physiological sensors and asynchronous digital processing to achieve real time deception detection. The hardware setup is centered around the STM32 Nucleo-U545RE-Q, which acts as the high-speed data aggregator and main controller.
68
+
69
+
The Grove GSR sensor is connected to ADC channel PA0 and measures skin conductance by detecting changes in electrical resistance across the fingertips. The Analog Pulse Sensor is connected to ADC channel PA1 and captures heart rate fluctuations. Both sensors feed into the ADC and are sampled every 500ms during the monitoring phase.
70
+
71
+
An RGB LED is driven via three PWM channels (PA6, PA7, PB0 on TIM3) to visually represent the deception score, transitioning from green at baseline to red as stress indicators rise. A passive buzzer on PB6 emits rapid pulses when the score exceeds 50. Two tactile push buttons (connected to PB5 and PB4 with internal pull-ups) allow the user to start a session or reset the system at any point.
|[fixed](https://github.com/tomhoule/fixed)| Fixed-point math | Calculates percentage spikes without floating-point overhead. |
74
-
|[defmt](https://github.com/knurling-rs/defmt)| Efficient logging | Sends real-time sensor data to the PC via RTT. |
96
+
|[embassy-stm32](https://github.com/embassy-rs/embassy)| STM32 Hardware Abstraction Layer | Controls ADC for sensor sampling, PWM for the RGB LED, GPIO for buttons and buzzer, and USART for serial output. |
97
+
|[embassy-executor](https://github.com/embassy-rs/embassy)| Async task manager | Spawns and runs all concurrent tasks (acquisition, analysis, feedback, button handler). |
|[embassy-sync](https://github.com/embassy-rs/embassy)| Synchronization primitives | Provides the `Mutex` used to safely share `BaselineData` between all async tasks. |
100
+
|[embedded-hal](https://github.com/rust-embedded/embedded-hal)| Hardware abstraction traits | Used for the `Pwm` trait to set duty cycles on the RGB LED PWM channels. |
101
+
|[heapless](https://github.com/japaric/heapless)|`no_std` data structures | Provides a stack-allocated `String` for formatting UART serial output without heap allocation. |
102
+
|[defmt](https://github.com/knurling-rs/defmt)| Efficient logging | Sends real-time sensor data and state transitions to the PC via RTT for debugging. |
103
+
|[panic-probe](https://github.com/knurling-rs/panic-probe)| Panic handler | Handles panics in the embedded environment and reports them via `defmt`. |
0 commit comments