Rustymind is a driver and parser for NeuroSky MindWave EEG headset written in pure Rust.

Overview

rustymind

crates.io api_doc

Rustymind is a driver and parser for NeuroSky MindWave EEG headset written in pure Rust. You can use it to connect, interact, and plot real time data from the headset.

The parser is based on the mindwave mindset communication protocols published by NeuroSky.

See below for a screenshot of real time mindwaves plotted by rustymind-plot CLI based on rustymind parser.

Real time plot screenshot

Getting Started

rustymind-plot takes two arguments to run:

  • MindWave device path. On Mac, the path would be in the format of /dev/tty.usbserial-10000
  • Headset ID (printed inside the battery case)
cargo run --bin rustymind-plot "/dev/tty.usbserial-10000" a05f

If you don't pass in the headset ID argument, the dongle will auto-connect to any headsets it can find.

To use rustymind as a library, you need to use connect_headset function and Parser struct. For example:

= vec![0; 2048]; let mut parser = Parser::new(); loop { let bytes_read = port.read(buffer.as_mut_slice()).unwrap(); for i in 0..bytes_read { if let Some(x) = parser.parse(buffer[i]) { for r in x { match r { PacketType::Attention(value) => { println!("Attention value = {}", value); } PacketType::Meditation(value) => { println!("Meditation value = {}", value); } PacketType::AsicEeg(value) => { println!("EEG power values = {:?}", value); } _ => (), } } } } } ">
use rustymind::{connect_headset, PacketType, Parser};

let mut port = connect_headset("/dev/tty.usbserial-10000", b"\xa0\x5f")?;
let mut buffer: Vec<u8> = vec![0; 2048];
let mut parser = Parser::new();

loop {
    let bytes_read = port.read(buffer.as_mut_slice()).unwrap();
    for i in 0..bytes_read {
        if let Some(x) = parser.parse(buffer[i]) {
            for r in x {
                match r {
                    PacketType::Attention(value) => {
                        println!("Attention value = {}", value);
                    }
                    PacketType::Meditation(value) => {
                        println!("Meditation value = {}", value);
                    }
                    PacketType::AsicEeg(value) => {
                        println!("EEG power values = {:?}", value);
                    }
                    _ => (),
                }
            }
        }
    }
}

This software is not intended to be used in medical diagnostics or medical treatment.

You might also like...
Pure rust implementation of jq

XQ JQ reimplemented purely in Rust. Caution This program is under development. You probably want to use the original implementation of jq, or pure Go

A pure Rust PLONK implementation using arkworks as a backend.

PLONK This is a pure Rust implementation of the PLONK zk proving system Usage use ark_plonk::prelude::*; use ark_ec::bls12::Bls12; use rand_core::OsRn

Program a Raspberry Pi Pico with pure Rust

pi-pico-rs Program a Raspberry Pi Pico with pure Rust. Get Started Install the latest version of Rust and the thumbv6m-none-eabi target. This is the p

Pure Rust library for Apache ZooKeeper built on tokio

zookeeper-async Async Zookeeper client written 100% in Rust, based on tokio. This library is intended to be equivalent with the official (low-level) Z

Pure rust implementation of python's random module with compatible generator behaviour.

pyrand Pure rust implementation of (parts of) python's random module with compatible PRNG behaviour: seeding with equivalent values will yield identic

Lightweight compile-time UUID parser.

compiled-uuid Anywhere you're building Uuids from a string literal, you should use uuid. Motivation If you want to use a fixed Uuid throughout your pr

Parser for UltraStar Deluxe song files

This is a rust parser for USDX song files. Files are written as a plaintext files that contain data about the song and notes/lyrics.

A Diablo II library for core and simple client functionality, written in Rust for performance, safety and re-usability

A Diablo II library for core and simple client functionality, written in Rust for performance, safety and re-usability

BSV stdlib written in Rust and runs in WASM environments

BSV.WASM A Rust/WASM Library to interact with Bitcoin SV Installation NodeJS: npm i bsv-wasm --save Web: npm i bsv-wasm-web --save Rust: https://crate

Owner
Junjun Dong
Junjun Dong
Rusty Rootkit: Windows Kernel Driver in Rust for Red Teamers

Windows Kernel Driver in Rust (Rusty Rootkit) for Red Teamers Features (Development in progress) Protect / unprotect process (Done) Elevate to NT AUTH

null 283 Jan 1, 2023
Rust port of the official Windows Driver Samples on Github. Leverages windows-drivers-rs

Rust Driver Samples This is a Rust port of the driver samples from the original Windows Driver Samples on Github. The repository provides examples and

Microsoft 80 Oct 10, 2023
An embedded-hal driver for the TT21100 multi-touch touchscreen controller

tt21100 An embedded-hal driver for the TT21100 multi-touch touchscreen controller. If there is a feature which has not yet been implemented and which

Jesse Braham 5 Jan 9, 2023
A program written in pure Rust to query music info from mpd and display it in a notification.

musinfo A program written in pure Rust to query music info from mpd and display it in a notification. Note: Cover art is expected to be placed at /tmp

Cpt.Howdy 10 Aug 16, 2022
A bare metal STM32F103C8T6/STM32F103 MCU program written in pure Rust

A bare metal (register level) STM32F103C8T6/STM32F103 MCU program written in pure Rust without any IDE, SDK, HAL or library, and no assembly code, the only tool required is the Rust compiler.

Hema Shushu 105 Dec 18, 2022
Wait Service is a pure rust program to test and wait on the availability of a service.

Wait Service Wait Service is a pure rust program to test and wait on the availability of a service.

Magic Len (Ron Li) 3 Jan 18, 2022
mollusc is a collection of pure-Rust libraries for parsing, interpreting, and analyzing LLVM.

mollusc is a collection of pure-Rust libraries for parsing, interpreting, and analyzing LLVM.

William Woodruff 50 Dec 2, 2022
Svix - A pure Rust and fully tested KSUID implementation

Svix - Webhooks as a service Svix-KSUID (Rust) A pure Rust and fully tested KSUID implementation This library is fully compatible with Segment's KSUID

Svix 48 Jan 3, 2023
Motoko concrete syntax parser in Rust.

motoko.rs Motoko concrete syntax parser and dynamic evaluator (VM) in Rust. Motoko VM The Motoko VM explores a more dynamic way for Motoko to execute.

DFINITY 8 Dec 15, 2022
λ-calculus parser made by rust

Lambda Calculus Parser This is a parser for λ-calculus expressions. It takes a λ-terms as input, parses it and returns a JSON representation of the te

Lee ByeongJun 4 Apr 17, 2023