Giter Site home page Giter Site logo

muse.net's Introduction

Muse.NET

This library helps you connect to the Muse Headset. http://www.choosemuse.com/

The Muse broadcasts over Bluetooth LE (Low Energy).

To keep your application free of external dependencies, this library does not include external Muse drivers. It translates the messages comming from the Muse directly from the Bluetooth channel and translates them into simple classes.

Components

  1. Muse.Net - the core library. Found as package on nuget.org as Muse.Net
  2. Muse.Console - a few simple commands to test your device
  3. Muse.LiveFeed - a WinForms GUI that shows you a live graph of the EEG wave data feeds.

Platform

These are dotnet core SDK projects, targeting net framework.

WinRT bluetooth API's

The Muse.Net library uses the Bluetooth APIs from WinRT (Uwp) The DLL's included in the source code and copied to the output folder. These libraries are not cross platform / netcoreapp compatible.

These are included in the package, so there is no need to add them manually. However they are normally found here:

  • C:\Program Files (x86)\Windows Kits\10\UnionMetadata\Windows.winmd
  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETCore\v4.5\System.Runtime.WindowsRuntime.dll

Background

GATT

This library is built on top of the Gatt (Generic Attributes) interface for Bluetooth. https://www.bluetooth.com/specifications/gatt/generic-attributes-overview

Device output

THe Muse Headset has several sensors:

  • Accelerometer (when the devices is moving)
  • Gyroscope (when the device is turning)
  • Telemetry (battery, temperature)
  • Brain waves (2 front, 2 rear + Auxilary)

Communication

The device broadcasts each sensor output over a separate Gatt channel (characteristic). Broadcasts only occur over channels to which your app is subscribed.

Usage

	var client = new MuseClient(MyMuse.Address);
	var ok = await client.Connect();
	if (ok)
	{
		await client.Subscribe(
			Channel.EEG_AF7, 
			Channel.EEG_AF8, 
			Channel.EEG_TP10, 
			Channel.EEG_TP9,
			Channel.EEG_AUX);

		client.NotifyEeg += Client_NotifyEeg;
		await client.Resume();
	}

Subscribable events

The MuseClient has four events you can subscribe to: NotifyTelemetry, NotifyAccelerometer, NotifyGyroscope, NotifyEeg. Telemetry shows you battery, voltage and temperature. All the 5 EEG channels are broadcasted over the NotifyEeg event.

Attribution

Thanks to Carter Appleton for pointing a way to access WinRT. Win10Win32Bluetooth

A lot of the technology in this library has been based on muse-js

muse.net's People

Contributors

carterappleton avatar mharthoorn avatar stefrave avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

muse.net's Issues

Element not found (0x80070490)

Hellow! I have device muse 2.
I execute MuseModule.Scan() to know address of my muse device.
Run code:
var client = new MuseClient();
var ok = await client.Connect(MyMuse.Address);
if (ok)
{
await client.Subscribe(
Channel.EEG_AF7,
Channel.EEG_AF8,
Channel.EEG_TP10,
Channel.EEG_TP9,
Channel.EEG_AUX);

            client.NotifyEeg += Client_NotifyEeg;
            await client.Resume();
        }
        else
       {
            Console.WriteLine("Not connected");
        }

And got error:
System.Exception
HResult=0x80070490
Message=Element not found. (Exception from HRESULT: 0x80070490)
Source=Windows.Devices
StackTrace:
at Windows.Devices.Bluetooth.BluetoothLEDevice.GetGattService(Guid serviceUuid)
at Harthoorn.MuseClient.MuseClient.d__41.MoveNext() in C:\Users\Administrator_2\Downloads\Muse.Net-master\Muse.Net\Muse\MuseClient.cs:line 58
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
at ConsoleApp.Program.d__2.MoveNext() in C:\Users\Administrator_2\Downloads\Muse.Net-master\Muse.Console\Program.cs:line 25
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
at ConsoleApp.Program.Main(String[] args) in C:\Users\Administrator_2\Downloads\Muse.Net-master\Muse.Console\Program.cs:line 45

What is wrong?

Attention / Relaxation

Hi there,

Please forgive the stupid question, but I'm back to playing about with this SDK again and have the live feed sample running great. I'm just trying to understand what's being displayed,

So we have 5 graphs, top 2 being raw output from AF7 & AF8 and next 2 being raw output from TP9 & TP10. These correspond to standard probe positions on the head. All good.

Now the next graph, I understand that displays an FFT of AF8 and an FFT of TP9 on the same graph, this essentially shows the frequencies on those channels for a slice of time. I suck at maths and that's my understanding at least.

So do those 2 FFT plots relate to Attention & Relaxation? Or Do those have to be calculated by looking analysing the results of both of those?

Thanks for any help, it's difficult finding this information on Google without going down a rabbit of science papers which I simply don't understand.

Meaning of values

Hi @mharthoorn , great sample, thankyou very much! This is perfect considering muse have pulled their SDK.

Anyway, I have a quick question, do you have any reference material saying what the values actually mean? At a minimum, what does each channel signify?

                Channel.EEG_AF7,
                Channel.EEG_AF8,
                Channel.EEG_TP10,
                Channel.EEG_TP9,
                Channel.EEG_AUX

Many thanks in advance.

How to use?

I am having a hard time trying to figure out how i could use this. Could you please explain to me in detail the process to successfully getting the raw values as output.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.