You are on page 1of 15

Harness 2


A significant breakthrough in the recent past has been the emergence of low-cost headsets that
acquire, pre-process, and make available Electroencephalography (EEG) signals in a non-
invasive manner. One such headset is the Neurosky Mindwave EEG headset that collects and
transmits information pertaining to brain activity using the wireless Bluetooth protocol. This
study determines whether controlled patterns of brain activity can be used in a consistent manner
by controlling the height at which a simple hobbyist-type drone quad copter hovers.
This study involved several phases: i) reliable extraction of the brain signal; ii) investigation of
the ability of a person to exercise adequate thought discipline to put out a tightly clustered brain
activity; iii) synthesis of the electronic systems to map the thought pattern to an appropriate
control action on the drone.
The implementation of these phases will help evaluate the effectiveness of the Mindwave
headset and the attendant reliability of the use of brain signals to initiate consistent physical


With the discovery of electroencephalography (EEG) harkening back to the early 20th

Century, the study of brainwave signals and patterns have become increasingly popular because

it demonstrates how human beings are able to think, allows neurologists and psychologists to

identify specific states of mind (including mental disorders), and could possibly lead to the

discovery of hidden or unknown capabilities within the human brain itself.

Electroencephalography can also be applicable towards the field of electrical engineering

since brainwaves are electronic signals consisting of different voltages and frequencies once

neurons travel into the brains cortex, causing this electrical reaction to occur. This in turn,

inspires companies and researchers to create technologies that utilizes brainwaves to enhance

daily performances based on a users level of focus. Potential applications surrounding the use of

this brainwave technology can lead to aiding the physically disabled throughout their daily lives

(for example a mechanism that opens doors based on attention levels) and to potentially control

objects via thought process mimicking telepathy or The Force as seen in the Star Wars

Harness 3

The following research focuses on the use of the Neurosky Mindwave EEG headset to

control the hover of a UDI U818A 4CH 6 Axis QuadCopter Drone in a consistent manner. This

method of drone control will demonstrate the reliability of the Mindwave when extracting

brainwave signals, investigate ones ability to exercise their thought activity in an adequate

fashion, and to explore the synthesis of electronic systems that will map out thought patterns as

an appropriate control for the drone itself.

Measuring Brainwave Activity:

As covered before, electroencephalography focuses on the electronic signals emitted

from the brain. These electrical currents/signals are often difficult to detect with EEG devices

due to background noise frequencies in the surrounding environment as well as the brains

muscles. They are also difficult to detect due to the low voltage levels, emitted in microvolts

(V), and lower frequencies. Brainwave frequencies are often given classifications based on

range that also lie in correspondence to specific states in mind (shown below in Table 1).

Table 1. Brainwave Types based on Frequencies and State of Mind

Wave Mental State
Present during idea formation, learning, and communications
Gamma () 27 < f
while wide awake
Common mental state while performing daily activities while
Beta () 12 < f < 27
Alpha () 8 < f < 12 Present during relaxed/mediatory states
Theta () 3<f<8 Present during light sleep
Delta () 0.2 < f < 3 Present during deep sleep

Table 1 represents the most common brainwaves expressed in human beings on a regular

basis. It is significant for humans to generally emit a regular amount of these brainwaves daily

because deficiencies in certain brainwave types can lead to potential mental strains; for example,
Harness 4

a lack of Beta brainwaves could essentially lead to insomnia or severe depression, making it

crucial to perform simple activities on a regular basis, such as exercising or interacting with

others (Transparent Corporation).

With advanced modern technology, EEG devices can detect these brainwaves with highly

sensitive electrodes that cancel out as much background noise possible. Originally, EEG devices

were known to cost thousands of dollars to develop; however, due to the increase in popularity

within this field, companies are able to manufacture these technologies at a much affordable cost

that are equally, if not more, efficient than previous iterations. The company Emotiv has recently

developed a wireless headset that will be used as more of a learning tool to track daily behaviors

within a human being. The goal, according to Emotiv co-founder Tan Le, in developing this

product is to go beyond the simple biomedical uses of brainwave monitoring, and instead have

users challenge themselves on their own focus levels. The generated results from this device will

show users where to improve while performing activities (Marketplace). This research uses the

NeuroSky MindWave headset to acquire raw EEG signals that will be implemented towards the

drones flight.

Figure 1. Neurosky Mindwave Functionalities

Harness 5

This headset, shown in Figure 1, also uses a single electrode for brainwave detection, having a

ground acting as a reference point to help complete the circuit under a set voltage level of 3.3

Volts at maximum (Neurosky).

Quadcopter Control:

To synchronize the hover of the quadcopter to that of the brainwave signals, several steps

need to be implemented. The Neurosky Mindwave emits raw EEG signals to its provided USB

drive, making data inconsistent unless a proper code or program is utilized. Off of the Neurosky

website is a provided code for Matlab labeled as GetAttention() that will collect these signals

and classify them in an attention level that ranges from 0 to 100% (see Appendix A for code

details). As mentioned before, the collected brainwave signals are very inconsistent, causing

many outliers to occur when collecting data, thus making the drone flight to appear very random.

To prevent this, a moving average is created to not only prevent these outliers from appearing,

but to create smoother transitions for the graphical data and the drones flight. In this case,

Matlab will take an average of 5 raw data points and drop the first collected point to acquire the

next data point to place in the average for every second that passes (out of 30 60 seconds).

These data points will both be plotted via line graph on Matlab and sent out to an Arduino

microsystem for control of a servo motor.

With these attention levels categorized, the next step of controlling the quadcopters

hover is to program the position of a servo motor based on the respective attention levels. The

servo motor is operated through an Arduino MEGA microsystem that will generate the proper

pulse widths signals (PWMs) allowing different rotations to occur (see Figure 2 below).
Harness 6

Figure 2. Servo Motor Rotations

Figure 2 demonstrates the pulse widths necessary to generate clockwise through

counterclockwise rotations. The GetAttention() code generates various pulse signals to create a

full 180 rotation when attention levels travel from 0 to 100%. The degrees of the servo motor

however, had to be limited down to adjust the throttle of the quadcopter controller because of the

limited angle set on the controller and to prevent overloading on the servo motor. To prevent

this, the data being sent to the Arduino are modified heavily since the servo position changes

from data points set from 0 to 1. To compensate for the lower angle of the controller, the starting

initial value for the data points is 0.45 (representing 0% Attention), while data points are scaled

down by a factor of 380 to help reach the highest angular degree possible for the controller.

Figure 3. Servo Motor/Quadcopter Controller Configuration

Harness 7

This configuration shows the servo motor (being powered by the Arduino MEGA)

controlling the throttle of the quadcopter controller through a threaded paperclip. With the proper

servo positions set, the right area highlighted in Figure 3 suggests a low to mid throttle for the

quad copter (0 50% Attention) while the left area is mid to full throttle (50 100%).

The drones flight for this experiment is only determined by the level of throttle given,

not its change in angle, allowing for a simple change in altitude to represent ones level of

attention. The drone itself is contained within a customized guide track with a surface and ceiling

to prevent any veering off from unbalanced motors and for simplistic observation purposes (see

Appendix B for materials and construction details).


Figure 4. Quadcopter in its contained Guidance Track

This diagram demonstrates the position of the quadcopter due to the different amounts of

throttle provided by its controller. When observed, the quadcopter is at low throttle (the motor

rotation only) when attention levels range from 0 40%, mid throttle (some hovering) at 40

60%, and full throttle (continuous upward hovering) at 60 100%. When at full throttle, the

quadcopter will keep trying to hover; however, the ceiling will prevent it from doing so until

attention levels are lowered. The guidance track only allows for 3 ft. of observed hovering due to

the length of its bars.

Harness 8

Results and Discussion:

Figure 5. Sample Trial Results and Quadcopter in Motion

The following line graph shows a sample trial run of the drones flight based on the

amount of attention generated by a user over the allotted time of 60 seconds. The graph itself

demonstrates a user emitting higher levels of attention from the Mindwave headset, resulting in

the quadcopter continuously hovering into the ceiling until time has ellapsed.

The purpose of this experiment was to demonstrate the control of brainwave signals

through an EEG headset by using the throttle of a quadcopter as a visual representation of their

focus. Through the many trials conducted, each result throughout the course of 60 seconds all

varied based on the users activity, state of focus, and the user itself. There was no diffinitive

method for expressing various attention levles to control the quadcopters flight; however,

various methods were demonstrated throughout the performed trials that would assist in higher

attention levels being emitted. For example, one user was asked to solve difficult math problems

on the computer, which in turn caused more gamma brainwaves to be expressed due to the

higher levels of thinking. This on average would cause the quadcopter to be in a state of

continous throttle. Another method developed that received mixed results of attention was to

have a conversation with someone, encouraging user engagement. Some methods that did not
Harness 9

work were staring at the quadcopter directly since some users did not know how to express

consistent amounts of focus, having some trials differ greatly from another.

Aside from the lack of a consistent method to control quadcopter hovering, there were

several flaws within the design process due to the limitations of the technology and the

environment itself. The UDI U818A 4CH 6 Axis QuadCopter Drone had a limited battery life of

7 minutes when continuously controlled, limiting the number of trials per session and causing

weaker movements over time. Users states of mind were all varied during the time of trials,

having some being fully focused while others were fatigued from earlier activities. The

enivronment in which these trials were tested in was often full of comotion from other students,

causing difficulty for some users to concentrate. Complaints of the Mindwave headset giving

users headaches after a certain amount of trials also arose throughout the course, causing

sessions to end for the sake of ones mental health. Since the Mindwave is one of the simplest

EEG headsets on the market and lacks multiple sensors, attention levels of users may have not

been fully representing since there is only one point of reference on one area of the head. A

much more sophisticated headset would allow multiple points of reference to obtain highly

accurrate results from differen areas of the brain. Also, due the location of the performed trials

being next to a cellular tower, the signals obtained from the Mindwave may have been affected

by this or by the signals generated from the quadcopter controller.


The utilization of brainwave signals through an EEG headset to control the hovering of a

quadcopter proved to be a success. The results from each trial were all varied depending on the

users state of mind and level of activity, proving that there is no definitive method of controlling
Harness 10

the hovering of the quadcopter or emitting the proper levels of attention. Despite the drawbacks

from the intial designs and the human error given in each trial, this configuration of the drone

proved to be a sufficient demonstration on the level of focus and attention that one can express.

This research can be further expanded upon by focusing on the attention levels of those with

mental disabilities to see how well they could maintain the flight of the drone while performing

various activities (for example coloring a picture, talking to a person, or being at rest). Further

uses of the Neurosky Mindwave or any EEG device include, but are not limited to, the operation

of a chairlift in vehicles, the opening of a door for parapheligic users, or the activation of a light

switch or any electrical device when properly syncronized. With the continuous advancements in

technonolgy, the further utilization of EEG technology could potentially simplify daily routines

and allow humankind to potentially discover unknown attributes associated with the brain.
Harness 11

Works Cited:

Brainwave Entrainment and the Symptom Relief Project. Mind Over Menieres. 2015. Web. 7

February 2017. <


Brainwaves Overview. Transparent Corporation. Copyright 2015. Web. 4 December 2016.


Elicea, Isaac, et al. Brain-Wave Controlled Robot. University of Detroit Mercy. 2016. Print.

Le, Tan. A headset that reads your brainwaves. TED. July 2010. Web. 20 November 2016.


Marketplace. Marketplace Tech for Friday, October 21, 2016. Nashville Public Radio. 21

October 2016. Web. 2 December 2016.



NeuroSky. Mindwave Users Guide. NeuroSky. 30 March 2011. Web. 21 March 2017.



Standen, Amy. Brain Games: Move Objects With Your Mind To Find Inner Calm? National

Public Radio. 21 January 2014. Web. 23 November 2016.



Reed, Francis. How do Servo Motors Work. Jameco Electronics. 2017. Web. 13 April 2017.

Harness 12


Section A:

The following code is a modified GetAttention() code called readServo() alongside

plotRAW() that takes raw data from the EEG headset and modifies it down to an attention level

percentage from 0 100% while displaying the values on a plot. Neurosky provides its own

custom library of functions to use while coding in Matlab or in Arduino/C++.

%run this function to connect and plot raw EEG data
%make sure to change portnum1 to the appropriate COM port


a = arduino('COM32','Mega2560', 'Libraries', 'Servo'); % Recognizes Arduino

s = servo(a, 'D7'); % Recognizes location of servo motor on Arduino board

data = zeros(1,512); %preallocate buffer

dataAverage=data; %data averaging for smoother curves

portnum1 = 26; %COM Port #

comPortName1 = sprintf('\\\\.\\COM%d', portnum1);

% Baud rate for use with TG_Connect() and TG_SetBaudrate().

TG_BAUD_57600 = 115200;

% Data format for use with TG_Connect() and TG_SetDataFormat().


% Data type that can be requested from TG_GetValue().


%load thinkgear dll

fprintf('thinkgear64.dll loaded\n');

%get dll version

dllVersion = calllib('thinkgear64', 'TG_GetDriverVersion');
fprintf('ThinkGear DLL version: %d\n', dllVersion );
Harness 13

% Get a connection ID handle to ThinkGear
connectionId1 = calllib('thinkgear64', 'TG_GetNewConnectionId');
if ( connectionId1 < 0 )
error( sprintf( 'ERROR: TG_GetNewConnectionId() returned %d.\n',
connectionId1 ) );

% Set/open stream (raw bytes) log file for connection

errCode = calllib('thinkgear64', 'TG_SetStreamLog', connectionId1,
'streamLog.txt' );
if( errCode < 0 )
error( sprintf( 'ERROR: TG_SetStreamLog() returned %d.\n', errCode ) );

% Set/open data (ThinkGear values) log file for connection

errCode = calllib('thinkgear64', 'TG_SetDataLog', connectionId1,
'dataLog.txt' );
if( errCode < 0 )
error( sprintf( 'ERROR: TG_SetDataLog() returned %d.\n', errCode ) );

% Attempt to connect the connection ID handle to serial port "COM3"

errCode = calllib('thinkgear64', 'TG_Connect',
connectionId1,comPortName1,TG_BAUD_57600,TG_STREAM_PACKETS );
if ( errCode < 0 )
error( sprintf( 'ERROR: TG_Connect() returned %d.\n', errCode ) );

fprintf( 'Connected. Reading Packets...\n' );

%record data

i = 4; %collecting data points

while (i < 34) %for 90 seconds (raise 4 since i - 4)
if (calllib('thinkgear64','TG_ReadPackets',connectionId1,1) == 1) %if a
packet was read...

~= 0) %if RAW has been updated
i = i + 1;
data(i) =
4))/5; % collects average of 5 data points per second, creates smoother
if (dataAverage(i-4)/380)+0.45>1
writePosition(s, pos); %ranges from 0 - 100 attention, drone
controller at max is 0.70 while 0.45 min
Harness 14

fprintf('Attention: %3.2f percent i: %d \n',dataAverage(i-


calllib('thinkgear64', 'TG_FreeConnection', connectionId1);

%land slowly
for j=1:round(dataAverage(i-4))
pos=((dataAverage(i-4)/380)+0.45)-((j/380)); %take the current position
at end of trial
writePosition(s, pos); % create new position to 0 degrees
pause(0.01); % slower landing time

%% Plot RAW Data

function plotRAW(data)
%this subfunction is used to plot EEG data

axis([0 30 0 100])
title('Get Attention')
xlabel('Time (s)') % x-axis label
ylabel('Attention Level (%)') % y-axis label
Harness 15

Section B:

This section demonstrates a short procedure on how the guidance track for the drone and

contains the materials used.


UDI U818A 4CH 6 Axis 14.5 x 16.25 Plywood Board, 2

QuadCopter Drone w/ 5 V Battery Thickness
and Controller 6.5 x 8.25 Plywood Board, 0.25
3 x 3/8 Threaded Aluminum Thickness
Rods (4) 3/8 Hex-nuts (16)
Power Drill w/ 3/8 and Drills

Towards the center of the quadcopter, drill holes on each respective fin

o NOTE: Be cautious not to destroy the fins in the process and try to center the

holes as adequately as possible

Position the newly created holes on the quadcopter onto either plywood board and drill a

3/8 hole through it, using the quadcopter as a guide

o Repeat this process for the next plywood board, mark the position of both boards

facing straight for a reference position

Place the threaded aluminum rods through the quadcopter and the base plywood board,

placing the hex-nuts on both ends of each hole to secure the rods tightly

o Repeat this process for the smaller plywood board, straightening out both boards

to the marked reference points

o Tighten every hex-nut to prevent any balancing issues for the drone in flight

o NOTE: The base board was given small legs to stand up upon due to its small

thickness, the dimensions of the plywood boards are optional upon further

experimentation for better balance