Hackster is hosting Hackster Holidays, Finale: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Tuesday!Stream Hackster Holidays, Finale on Tuesday!
Parichoy Ghosal
Published © GPL3+

Cognitive Stress Detector

A portable device to detect and alert a person if he/she is experiencing mental stress.

IntermediateWork in progress6 hours1,739
Cognitive Stress Detector

Things used in this project

Hardware components

Raspberry Pi Pico
Raspberry Pi Pico
×1
SparkFun Single Lead Heart Rate Monitor - AD8232
SparkFun Single Lead Heart Rate Monitor - AD8232
×1
Buzzer
Buzzer
×1
Electrodes
×1

Software apps and online services

MicroPython
MicroPython
Visual Studio 2017
Microsoft Visual Studio 2017

Hand tools and fabrication machines

Tweezers, SMD Soldering/Desoldering
Tweezers, SMD Soldering/Desoldering
Solder Wire, Lead Free
Solder Wire, Lead Free
Solder Flux, Soldering
Solder Flux, Soldering

Story

Read more

Schematics

Cognitive Stress Detector Module

Code

Cognitive Stress Detection

MicroPython
This code is uploaded on the Raspberry Pi Pico running Micropython to control the stress detector module.
import machine
import utime

sensor = machine.ADC(28)
out = machine.Pin(25, machine.Pin.OUT)
buzzer = machine.Pin(14, machine.Pin.OUT)
while True:
    sensor_value = sensor.read_u16()/100
    if sensor_value >= 400:
        out.value(1)
        buzzer.value(1)
    else:
        out.value(0)
        buzzer.value(0)
    print(sensor_value)
    utime.sleep(2)

Credits

Parichoy Ghosal
3 projects • 3 followers

Comments