Emotiv Demo

Emotiv Unity3D Demo Package

The emotiv Demo package is a package to be used in Unity3D. This demo allows you to fully integrate your emotiv with unity3D as long as you use the Reh@panel tool.

Developed by: Tatiana Vieira, Yuri Almeida

Importing the package

  1. Create a new project
  2. Import the package EmotivDemo.unitypackage
    1. Assets -> Import package -> Custom Package

Requirements to use the package

  1. Make sure you have the Emotiv SDK installed
  2. Plug in your Emotiv to the PC
  3. Make sure that it is sending information by UDP to port 1202 (To change this port see below).
    1. You can use the Reh@panel to do this – Download Link here

Testing the scene

  1. Open the Scene
    1. Neurehab -> Demo Emotiv-> Scenes -> EmotivDemo
  2. Make sure you fulfill all the requirements
  3. Press Play


1 – UDPGameobject that has the UDP connection Information. You can change the UDP port here
2 – ComponentsGameobject that has the Emotiv.cs script
3 – Emotiv PrefabPrefab that has the EmotivUnity.cs script. This prefab will only appear in the scene when you have pressed Play


1 – Number Of SamplesThe number of data samples to save for each data input. In the end returns the average of that data input.
2 – Position MultiplierMultiplies the position that is receiving for this value. This is useful when you have a game world scale that differs from the real world.
3 – Prefab parentThe Gameobject parent where the device prefabs are going to be instantiated. Each instantiated prefab represents a Emotiv that is sending data by UDP.
4 – PrefabsThe list of prefabs that can be instantiated.
5 – Time to LiveThe maximum time in seconds that a prefab can wait for new data before it is destroyed.


1 – Available Data All the data that we are receiving from a Emotiv. Note that the Gameobject Unity references are for this specific demo. You don’t need to have bars to represent the emotiv data.
The data is accessed through the EmotivUnity.cs script. If you open this script, in the UpdateGuiValues function you will notice that the Emotiv prefab values are updated there.  
private void UpdateGuiValues()
{
BarLongTermExc.fillAmount = GenericDeviceData.GetFloat(emotiv.longtermexcitement.ToString()) /
GenericDeviceData.GetFloat("max_" + emotiv.longtermexcitement);
...
}
To be able to access any data that the Emotiv is sending, you will need to know two things: the label of the information you want to access and the type of that information. Then, using the EmotivUnity.cs script, you can find all this information by accessing the GenericDeviceData Dictionaries as shown below:
GenericDeviceData.Get[INFORMATION_TYPE]([INFORMATION_LABEL]);
For example, to access the Emotiv blink value which is labeled as ‘blink’ and is of the type boolean, you can
GenericDeviceData.GetBoolean(“blink”)

Current Emotiv protocol values

Information Label [INFORMATION_LABEL] Information Type [INFORMATION_TYPE]
counter Value (float)
af4Value (float)
f3Value (float)
f7Value (float)
f8Value (float)
fc5Value (float)
fc6Value (float)
t7Value (float)
t8Value (float)
p7Value (float)
p8Value (float)
o1Value (float)
o2Value (float)
gyro Boolean
longtermexcitementValue (float)
shorttermexcitementValue (float)
meditationValue (float)
frustrationValue (float)
boredomValue (float)
eyebrowextentValue (float)
smileextentValue (float)
upperfacepowerValue (float)
lowerfacepowerValue (float)
blinkBoolean
lookingupBoolean
lookingdownBoolean
lookingleftBoolean
lookingrightBoolean
eyelocationxValue (float)
eyelocationyValue (float)

Media