Skip to main content
Version: FILS English

Lie Detector

A portable lie detector that uses heart rate signals to detect stress or deception.

info

Author: Macesanu Miruna-Andreea \ GitHub Project Link: (https://github.com/UPB-PMRust-Students/project-mmirudeea.git)

Description​

This project is a portable lie detector that analyzes heart rate variability (HRV) to detect signs of stress or deception. It uses a pulse sensor to capture heart rate signals, processes the data using a Raspberry Pi Pico 2 running Rust, and displays the result in real time.

The device provides feedback in three ways:

  • Displays the result on an LCD screen
  • Lights up an LED:
    • πŸŸ₯ Red = Lie
    • 🟨 Yellow = Unsure
    • 🟩 Green = Truth
  • Sends session data over USB serial for logging or analysis

A push button starts each detection session manually, making the device interactive and easy to use.


Motivation​

I chose this project because I’ve always been interested in how technology can interpret signals from the human body. The idea of detecting stress or deception by analyzing heart rate variability felt like a meaningful challenge that connects both biology and technology β€” two areas I find fascinating.

At the same time, this project gave me the opportunity to deepen my skills in embedded Rust programming, work with real-time signal processing, and design an interactive system that gives immediate feedback. It’s rewarding to build something that not only works technically but also helps visualize how small changes in the body can reflect emotional states. I see this as a step toward future projects where technology can be used to better understand or respond to human behavior.


Architecture​

Schematic Diagram​

Architecture Diagram

Main Architecture Components​

  • Sensor Interface Layer
    Captures analog signals from the pulse sensor via the Pico’s ADC.

  • Signal Processing & Detection Logic

    • Filters and processes the heart rate signal.
    • Uses algorithms (e.g., HRV analysis) to detect stress or deception.
    • Decides the result: "Lie", "Unsure", or "Truth".
  • User Interface Layer

    • Displays the detection result on the OLED screen.
    • Controls the LEDs to give visual feedback (Red, Yellow, Green).
    • Monitors the push button to start sessions.
  • Communication Layer
    Sends processed data and session results over USB serial using usbd-serial.


Connections Between Components​

  • Sensor Interface Layer β†’ Signal Processing & Detection Logic
    (Heart rate data is read and processed.)

  • Signal Processing & Detection Logic β†’ User Interface Layer
    (Detection result is displayed on OLED and indicated with LEDs.)

  • Signal Processing & Detection Logic β†’ Communication Layer
    (Session data is transmitted over USB serial.)

  • User Input (Start Button) β†’ Signal Processing & Detection Logic
    (Triggers the start of a new detection session.)


Log​

Week 5 - 11 May​

Week 12 - 18 May​

Week 19 - 25 May​

Hardware​

The device is built around the Raspberry Pi Pico 2W microcontroller, which serves as the brain of the system. It reads physiological signals from a Pulse Sensor XD-58C for heart rate monitoring. The detection results are shown in real-time on an LCD ecru display and indicated visually through three LEDs (Red for lie, Yellow for unsure, Green for truth).

A tactile push button allows the user to manually start each detection session. All components are connected using a breadboard, jumper wires, and pin headers for prototyping. Basic electronic components like resistors are used for signal conditioning and LED current limiting.

Schematics​

Bill of Materials​

DeviceUsagePrice
Raspberry Pi Pico 2W (x2)Microcontroller + debug79.32 RON
Pulse Sensor XD-58CMeasures heart rate15.17 RON
LCDDisplay readings 16 RON
Red LEDLie indicator~1 RON
Yellow LEDUncertain indicator~1 RON
Green LEDTruth indicator~1 RON
Resistors (220–330Ξ©, assorted)Current limiting14.99 RON
Pull-down resistor (10kΞ©)Stabilize button inputIncluded
Breadboard (830 points)Prototyping9.98 RON
Header de pini (40p x4)Connect components3.96 RON
Tactile Push Button (x3)User input1.08 RON
Jumper WiresConnections~7 RON

Software​

LibraryDescriptionUsage
embassy-rsAsync embedded frameworkFor async tasks and timing
embedded-halHardware abstraction layerStandard traits for sensors, LEDs
ssd1306Display driverDisplaying text and graphics
usbd-serialUSB serial communicationFor debugging and data logging
gpioGeneral-purpose I/OLED and button control
panic-haltPanic handlerFor halting on panic
cortex-mCortex-M support crateLow-level ARM operations