SlideShare a Scribd company logo
Building a 

Thought-Controlled Drone
Jim McKeeth, Embarcadero Technologies
jim.mckeeth@embarcadero.com

@JimMcKeeth
Presented at
InterDrone Conference
Sept 9th, 2015
About Jim McKeeth
• Lead World Wide Developer Evangelist
• Longtime developer
• Object Pascal, Java, C#, JavaScript, Objective-C, etc.
• Invented and patented swipe to unlock in 2000
• US Patent # 8352745 & 6766456, etc.
• Improvisational performer with ComedySportz Boise
• I am not a neuroscientist, but I find this all fascinating!
• Founded 1993
• Provides Architect, Database and Developer Tools
• 3.2 Million Customers including 97% of Fortune 2000
• 35+ Product Awards – Consistent Innovation
• 500+ Employees in 29 Countries
• www.embarcadero.com
Agenda
• Drone technical details
• Headset technical details
• Drone API
• Headset SDK
• Concerns, Challenges and the Future
More Information
• My email: jim.mckeeth@embarcadero.com
• My blog: delphi.org
• This Slide Deck

http://www.slideshare.net/jimmckeeth/build-brain-controlled-drone
• Overview Slide Deck 

http://www.slideshare.net/jimmckeeth/jim-mc-keeth-wearable-thought-input
• The Code: https://github.com/jimmckeeth/Delphi-Emotiv-EPOC
“In five years, science
fiction will be real!”
— Claus Torp Jensen (@ClausTorpJensen)
Senior Technical Staff Member and Chief Architect
API Economy at IBM (@ibmapimgt)
What will the world be like 

in five years?
The Pieces
Emotiv EPOC
Brain-Computer Interface Parrot.AR Drone 2
Simi-Autonomous
Connected App Platform
Drone Technical Details
The Drone: Parrot AR.Drone 2.0
• Price: $299.99
• Runs Linux internally, but not user accessible
• Contains it’s own WiFi access point
• Connect via UDP & TCP
• Send control strings
• Maintain transmission rate to keep alive
• Can also receive status and video back
Completely Rebuildable
HD Battery $60
Gears+Shafts $15
Tools $20
Cross bars $30
Screws $7
Propellers $12
4x Engines $200
Bottom structure $60
Main board $110
Nav board $70
Charger $40
Outdoor haul $25
————————
Total $650
New contender: Parrot Bebop
• Price: $499.99
• Lots of upgrades, especially camera
• Also contains own WiFi access point
• Whole new SDK
• iOS, Android & Linux
• Published Nov 2014
• Incompatible with AR.Drone 2.0
SDK vs. API
• Parrot AR.Drone 2.0 provides both an API and SDK (Bebop has just an
SDK at this point.)
• An SDK is a software library that does additional work locally - makes it
easier to handle video streaming, etc.
• An API is a specification of how to connect and control.
• SDK works with specific tools and platforms.
• Typically SDK uses API.
• My examples use the API so it works across platforms.
Brain Computer Interface (BCI)
Headset Options
Electroencephalography (EEG)
• Measures electrical activity along the
scalp.
• Detects voltage fluctuations resulting from
ionic current flows within neurons of brain.
Image source: https://commons.wikimedia.org/wiki/File:EEG_cap.jpg
Neural Oscillation / Brain WavesBeta
15-30Hz
Waking Consciousness and Reasoning
Alpha
7-14Hz
Deep Relaxation
Delta
4Hz
Deep Sleep
Theta
4-7Hz
Light Meditation And Sleeping
Mu
8-13Hz
Voluntary Movement
Gamma
30-100Hz
Conscious Perception
Waveforms by Hugo Gamboa
NeuroSky’s MindWave (also in XWave headsets)
• EEG with 1 dry electrode
• Measures “attention,” “meditation” and eye-blinks
• Bluetooth communication
• SDK for iOS, Android, PC & Mac
• $129.99 to $79.95 retail neurosky.com
• Hacking: http://makezine.com/2011/05/10/behind-
the-brain-blinker/
InteraXon’s Muse
• 7 dry EEG sensors via Bluetooth
• Focuses on “brain fitness”
• 4 hour battery
• Android, Mac & Windows SDK now, 

iOS coming soon
• Works with Windows, OS X, iOS, Android, etc.
• $299 at choosemuse.com
OpenBCI
• Open source hardware & software
• Bluetooth, Arduino, EEG
• 8 wet Electrodes per board (daisy chainable)
• Full open EEG & BCI platform
• SDK provides EEG data
• www.openbci.com starting at $449
• No iOS or Android yet
Emotiv EPOC
• 16 wet electrodes
• 14 EEG electrodes + 2 reference electrodes
• Gyroscope to read head movements
• 4 mental states, 13 conscious thoughts & facial
expressions – 4 Processing suites
• Wireless (encrypted) for Windows, Linux or Mac
• $399 for Desktop
• $499 for Bluetooth Smart (EPOC+)
• www.emotiv.com
Emotiv Insight
• Expected eventually
• Starting at $299 (estimate)
• 5 dry sensors + 2 reference
• Bluetooth 4.0 LE (Smart)
• Battery Life: 4+ hours
• SDK: Android, iOS, Mac, Linux and
Windows Platforms
• www.emotiv.com
• Comparison http://bit.ly/1cfliTn
Emotiv EPOC SDK Overview
Expressiv Suite
• Detect facial expressions
• Eyelid & eyebrow positions
• Wink, blink, furrow
• Horizontal eye movement
• Smile, laugh, clenching & smirking
• EEG sensors picking up signals to muscles
(not brain waves)
• Very fast (10ms)
Image Source: https://commons.wikimedia.org/wiki/File:Duchenne-FacialExpressions.jpg
Uses for Facial Detection
• Anything requiring fast input
• Facial gesture detection
• Basic eye tracking
• Fast input & responses
Image Source: https://commons.wikimedia.org/wiki/File:Duchenne-FacialExpressions.jpg
Affectiv Suite
• Detect emotions / mental states
• Excitement
• Engagement or Boredom
• Meditation
• Frustration
• Passive detection
• Variable levels of each
• Short & long term tracking
Image Source: https://commons.wikimedia.org/wiki/File:Drama-icon.svg
Uses for Emotion Tracking
• Realtime media evaluation
• Stress analysis and management
• Mood monitoring
• For more accuracy combine with
other data sources
• Eye tracking, heart rate, etc.
Image Source: https://commons.wikimedia.org/wiki/File:Drama-icon.svg
Cognitiv Suite
• Detect conscious thoughts
• Requires training
• Detect 13 thought patterns with intensity level
(4 at a time)
• Left, right, up, down, forward, pull, CW, CCW,
left, right, sway-back, sway-forward,
Disappear
• Not as fast as Expresiv
Image Source: https://commons.wikimedia.org/wiki/File:ThinkingMan_Rodin.jpg
Uses for Cognitive Thought Identification
• Whole new input method
• Variable intensity for fine control
• Observe subconscious responses
• More training improves accuracy
• Improves the model
• Trains your brain to focus
Image Source: https://commons.wikimedia.org/wiki/File:ThinkingMan_Rodin.jpg
Brain-Computer Interface
Internet of Things
Autonomous Vehicles
expectations
Speech-to-Speech Translation
time
Plateau of
Productivity
Slope of EnlightenmentTrough of
Disillusionment
Peak of
Inflated
Expectations
Innovation
Trigger
Plateau will be reached in:
more than 10 years5 to 10 years2 to 5 yearsless than 2 years
obsolete
before plateau
Gartner's 2014 

Hype Cycle for
Emerging Technologies
August 11, 2014
Smart Advisors
Data Science
Prescriptive Analytics
Neurobusiness
Biochips
Affective Computing
Smart Robots
3D Bioprinting Systems
Volumetric and Holographic Displays
Software-Defined Anything
Quantum Computing
Human Augmentation
Connected Home
Quantified Self
Smart WorkspaceVirtual Personal Assistants
Digital Security
Bioacoustic Sensing
Natural-Language Question Answering
Consumer 3D Printing
Cryptocurrencies
Complex-Event Processing
Big Data
In-Memory Database Management
Content Analytics
Hybrid Cloud Computing
Gamification
Augmented Reality
Machine-to-Machine
Communication Services
Mobile Health
Monitoring
Cloud Computing
NFC
Virtual Reality
Gesture Control
In-Memory Analytics
Activity Streams
Enterprise 3D Printing
3D Scanners
Consumer Telematics
Speech Recognition
Wearable User Interfaces
Using the AR.Drone API
Command Strings
• Connect via WiFi access point to 192.168.1.1 UDP port 5556
• Command string format: AT*[cmd]=[seq],[arg array]
• Sequence number must not repeat
• Argument array is comma separated typically
• Floating point numbers must be encoded as decimals (more later)
• Send command every 30 ms (>2 seconds = session dropped)
Command String Examples
• FlatTrim: AT*FTROM=[seq]
• Movement: AT*PCMD=[seq],1,Roll, Pitch, Vert, Yaw
• Values of 1.0 to -1.0
• Use 0 in all values to hover
• Takeoff: AT*REF=[seq],290718208
• Land: AT*REF=[seq],290717696
• Emergency: AT*REF=[seq],290717952
Float as Integer
• Single precision floating point number is 32 bits
• Integer is 32 bits
• Map IEEE-754 bit value from float to integer
• -0.8 = 0xBF4CCCCD =
10000001011001100110011001 = 1085485875
Drone Concerns
• Manual override - keyboard override BCI, just in case
• Send emergency command to clear error state
• Start with FlatTrims to level drone
• Use state machine to send command 30 times a second
1. Keyboard override
2. BCI Input
3. Hover
ToDo with Drone
• Process NavData (sent back on UDP port 5554)
• Get battery data to know remaining flight time, errors, etc.
• Process Video stream (sent back on UDP port 5555)
• Display on Google Glass for HUD
• Find use for drone “Animations” like flips
• Maybe use LED animations when receiving BCI input
Using Emotiv EDK
SDK Format
• On Windows a Visual C++ DLL provides the interface
• Examples in VC++, C#.NET, Java, Python & Matlab
• All my code is in Object Pascal
• On OS X a dylib provides the interface
• Examples in Qt & Xcode
Emotiv EDK Workflow
• Call EE_EngineConnect to connect
• Create event handler EE_EmoEngineEventCreate
• Create state structure EE_EmoStateCreate
• Define actions to listen for and then train those actions (more later)
• Every 10 ms call EE_EngineGetNextEvent (more later)
Handle Cognitive Actions
• If state is EDK_OK then call EE_EmoEngineEventGetType
• If EventType is not EE_EmulatorError then call
EE_EmoEngineEventGetUserId
• If EventType is EE_CognitivEvent then it was a training event (next slide)
• If EventType is EE_EmoStateUpdated then get
EE_EmoEngineEventGetEmoState
• Read ES_CognitivGetCurrentAction and
ES_CognitivGetCurrentActionPower
Listen & Train
• Listening:
• Call EE_CognitivSetActiveActions with mask of Actions
• Call EE_CognitivSetTrainingAction with the ID of the action to train
• Call EE_CognitivSetTrainingControl with COG_START
• On EE_CognitivEventGetType of EE_CognitivTrainingSucceeded call
EE_CognitivSetTrainingControl with COG_ACCEPT
New Emotiv Xavier SDK
New Emotiv Xavier SDK
• EPOC+ and Insight are Bluetooth Smart
• Connect to mobile devices - iOS & Android
• Allows to additional user definable cognitive actions
• Still only listens for 4 cognitive actions at a time
Thought Controlled Drone
Thoughts to Movement
• Moves while thought active, otherwise hover in position
• Speed of movement = intensity of thought
• How to allow more than 4 directions of movement?
• Use Expressiv facial gesture to switch between sets
• Future consideration: Use strobing grid of controls
Typing via BCI
Jonathan Wolpaw

Wadsworth Center

Albany, NY
~15 seconds / key
. . . . . . . .
. A B C D E F .
. G H I J K L .
. M N O P Q R .
. S T U V W X .
. Y Z 1 2 3 4 .
. 5 6 7 8 9 0 .
. . . . . . . .
BCI Control
Panel
Example
Purpose of Feedback
• Using a visual feedback gives the
wearer something to focus on
• Otherwise they often change their
thought pattern when the drone is
moving
• Also gives them immediate awareness
of what is picked up
Moverio BT-200 Product Overview
Integrated Sensors
Accelerometer
Compass
Gyro
Head Set
Camera
Earbuds
with
Microphone
+x
+y
+z
Epson Moverio BT-200 Specs
Epson BT-200
Retail Price $699
Display Type Transparent
Resolution 960×540 QHD
Android v4.0.4 API Level 15 - Ice Cream Sandwich
Camera VGA, 640x480
WLAN 802.11b/g/n 2.4GHz
Bluetooth 3.0
micro USB v2.0 (On-The-Go)
GPS P-GPS
CPU
TI OMAP 4460
(ARM Cortex A9 Dual Core 1.2GHz)
RAM 1GB
Flash 8GB
microSD Max 32GB
Laptop
EDK
My	
  
App
Data Flow
Electrical	
  
Signals
Wireless	
  Signal
AT*REF=1,290718208
Provides	
  
WiFi	
  	
  
Hotspot
Feedback
Q & A
More Information
• My email: jim.mckeeth@embarcadero.com
• My blog: delphi.org
• This Slide Deck

http://www.slideshare.net/jimmckeeth/build-brain-controlled-drone
• Overview Slide Deck 

http://www.slideshare.net/jimmckeeth/jim-mc-keeth-wearable-thought-input
• The Code: https://github.com/jimmckeeth/Delphi-Emotiv-EPOC

More Related Content

PPTX
What is-32-bit-and-64-bit
PPTX
32 bit and 64 bit Register manipulation
PDF
Interview preparation workshop
PPT
brain chip technology
PPTX
BRAIN COMPUTER INTERFACE (BCI)
PPTX
Operating Systems FYBSC IT UNIT I- Introduction to Operating Systems
PPT
10 Instruction Sets Characteristics
PPTX
Pace IT - Common Laptop Components
What is-32-bit-and-64-bit
32 bit and 64 bit Register manipulation
Interview preparation workshop
brain chip technology
BRAIN COMPUTER INTERFACE (BCI)
Operating Systems FYBSC IT UNIT I- Introduction to Operating Systems
10 Instruction Sets Characteristics
Pace IT - Common Laptop Components

What's hot (20)

PPTX
operating system
PPT
Computer Memory
PPTX
Multi core processors
PPTX
Risc and cisc
PPTX
Analysing EEG data using MATLAB
PPT
Computer Organization and Assembly Language
PPTX
BIG,Emotiv Systems
PPT
brain computer-interfaces PPT
PPTX
Difference between hardware,software and firmware lesson 4
PPTX
Sensors and Peripherals
PDF
Exploring the Brain Computer Interface
PPTX
Bootstrap loader
PPTX
Brain Computer Interface.ppt
DOCX
Central processing unit
PPTX
Processor powerpoint
PPT
PDF
Iot for smart agriculture
PPT
Operating systems1[1]
PPT
Aufbau Und Aufgaben Des Prozessors (Cpu)
PDF
Chapter 2 Hardware and Software
operating system
Computer Memory
Multi core processors
Risc and cisc
Analysing EEG data using MATLAB
Computer Organization and Assembly Language
BIG,Emotiv Systems
brain computer-interfaces PPT
Difference between hardware,software and firmware lesson 4
Sensors and Peripherals
Exploring the Brain Computer Interface
Bootstrap loader
Brain Computer Interface.ppt
Central processing unit
Processor powerpoint
Iot for smart agriculture
Operating systems1[1]
Aufbau Und Aufgaben Des Prozessors (Cpu)
Chapter 2 Hardware and Software
Ad

Viewers also liked (20)

PDF
Pushing Java EE outside of the Enterprise - Home Automation
PDF
Keynote on industrial internet
PDF
Overview of IoT and Security issues
PDF
La metodología Lean Startup
PPTX
IoT Developer Survey 2015
PDF
LUMA's State of the State 2015 at DMS 15
PDF
IoT gateway dream team - Eclipse Kura and Apache Camel
PPTX
Drone101 - Introduction to Multirotors
PPTX
Drone Technology
DOC
Master thesis 2
PPTX
Flying A Drone
PDF
Open_IoT_Summit-Europe-2016-Building_a_Drone_from_scratch
PPTX
PDF
Enabling innovation in wearable SoCs
PDF
From Black Box to Black Magic, Pycon Ireland 2014
PDF
Developing a viable wearable technology business to penetrate into the mass m...
PPTX
Fin gesture control 1
PPTX
The Future of Wearable Technology
PPTX
Fin - The Wearable Ring
DOCX
Debra Wilkins marketing CV 7th July 2016
Pushing Java EE outside of the Enterprise - Home Automation
Keynote on industrial internet
Overview of IoT and Security issues
La metodología Lean Startup
IoT Developer Survey 2015
LUMA's State of the State 2015 at DMS 15
IoT gateway dream team - Eclipse Kura and Apache Camel
Drone101 - Introduction to Multirotors
Drone Technology
Master thesis 2
Flying A Drone
Open_IoT_Summit-Europe-2016-Building_a_Drone_from_scratch
Enabling innovation in wearable SoCs
From Black Box to Black Magic, Pycon Ireland 2014
Developing a viable wearable technology business to penetrate into the mass m...
Fin gesture control 1
The Future of Wearable Technology
Fin - The Wearable Ring
Debra Wilkins marketing CV 7th July 2016
Ad

Similar to Building a Thought Controlled Drone (20)

PPT
Emotiv Epoc/EEG/BCI
PPT
Emotiv Epoc/BCi/EEG
PDF
Thought: The Future of Mobile and Embedded Application Input
PPTX
Introduction to Brain Computer Interface
PPTX
Brain access
PPT
Brainsense -Introduction to brain computer interface
PPTX
Thought Detection via BCI
PPTX
Mind-Controlled Drones and Robots
PPSX
A.real.brainstorming!
PPTX
Swarm Extreme
PPTX
Mind-Controlled Drones and Robots
PPTX
Emotiv EPOC EEG Headset
PPTX
Team CircuitBaaz (hackathon format about project)
PDF
Reni_and_Sam_Poster_Final_449
PPT
Brain Computer Interface
PPTX
Mind control device
PPT
Brainwave starter Kit- Brain computer interface
PDF
Brain Game Simulator using BCI | EEG Applications | NeuroSky Minwave
PDF
IVE 2024 Short Course - Lecture16- Cognixion Axon-R
PPTX
Brain Computer Interface-Webinar
Emotiv Epoc/EEG/BCI
Emotiv Epoc/BCi/EEG
Thought: The Future of Mobile and Embedded Application Input
Introduction to Brain Computer Interface
Brain access
Brainsense -Introduction to brain computer interface
Thought Detection via BCI
Mind-Controlled Drones and Robots
A.real.brainstorming!
Swarm Extreme
Mind-Controlled Drones and Robots
Emotiv EPOC EEG Headset
Team CircuitBaaz (hackathon format about project)
Reni_and_Sam_Poster_Final_449
Brain Computer Interface
Mind control device
Brainwave starter Kit- Brain computer interface
Brain Game Simulator using BCI | EEG Applications | NeuroSky Minwave
IVE 2024 Short Course - Lecture16- Cognixion Axon-R
Brain Computer Interface-Webinar

More from Jim McKeeth (16)

PDF
Memory Safety with Delphi - Jim McKeeth - Webinar June 2024
PDF
Announcing Codolex 2.0 from GDK Software
PDF
Smart Contracts - The Blockchain Beyond Bitcoin
PDF
Rapid Prototyping Mobile IoT Projects with Arduino and Open Hardware
PDF
Day 3 of C++ Boot Camp - C++11 Language Deep Dive
PDF
Day 5 of C++ Boot Camp - Stepping Up to Mobile
PDF
Android Services Skill Sprint
PDF
Creating Android Services with Delphi and RAD Studio 10 Seattle
PDF
Deep Dive into Futures and the Parallel Programming Library
PDF
Embarcadero's Connected Development
PDF
The Internet of Things and You - A Developers Guide to IoT
PDF
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
PDF
Android voice skill sprint
PDF
Introduction to Android Development with Java
PDF
Hacking iBooks and ePub3 with JavaScript!
PDF
Inventing merit badge
Memory Safety with Delphi - Jim McKeeth - Webinar June 2024
Announcing Codolex 2.0 from GDK Software
Smart Contracts - The Blockchain Beyond Bitcoin
Rapid Prototyping Mobile IoT Projects with Arduino and Open Hardware
Day 3 of C++ Boot Camp - C++11 Language Deep Dive
Day 5 of C++ Boot Camp - Stepping Up to Mobile
Android Services Skill Sprint
Creating Android Services with Delphi and RAD Studio 10 Seattle
Deep Dive into Futures and the Parallel Programming Library
Embarcadero's Connected Development
The Internet of Things and You - A Developers Guide to IoT
Accessing REST & Backend as a Service (BaaS) - Developer Direct - Mobile Summ...
Android voice skill sprint
Introduction to Android Development with Java
Hacking iBooks and ePub3 with JavaScript!
Inventing merit badge

Recently uploaded (20)

PPTX
Embeded System for Artificial intelligence 2.pptx
PPTX
DEATH AUDIT MAY 2025.pptxurjrjejektjtjyjjy
PPTX
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
PPTX
Presentacion compuuuuuuuuuuuuuuuuuuuuuuu
DOCX
A PROPOSAL ON IoT climate sensor 2.docx
PPTX
02fdgfhfhfhghghhhhhhhhhhhhhhhhhhhhh.pptx
PPTX
A Clear View_ Interpreting Scope Numbers and Features
PDF
Dynamic Checkweighers and Automatic Weighing Machine Solutions
PPTX
Fundamentals of Computer.pptx Computer BSC
PPTX
Nanokeyer nano keyekr kano ketkker nano keyer
PPTX
PLC ANALOGUE DONE BY KISMEC KULIM TD 5 .0
PDF
How NGOs Save Costs with Affordable IT Rentals
PPTX
Presentation 1.pptxnshshdhhdhdhdhdhhdhdhdhd
PPTX
material for studying about lift elevators escalation
PPTX
Prograce_Present.....ggation_Simple.pptx
PPTX
Lecture 3b C Library _ ESP32.pptxjfjfjffkkfkfk
PPTX
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
PPT
Hypersensitivity Namisha1111111111-WPS.ppt
PPTX
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
PPTX
"Fundamentals of Digital Image Processing: A Visual Approach"
Embeded System for Artificial intelligence 2.pptx
DEATH AUDIT MAY 2025.pptxurjrjejektjtjyjjy
5. MEASURE OF INTERIOR AND EXTERIOR- MATATAG CURRICULUM.pptx
Presentacion compuuuuuuuuuuuuuuuuuuuuuuu
A PROPOSAL ON IoT climate sensor 2.docx
02fdgfhfhfhghghhhhhhhhhhhhhhhhhhhhh.pptx
A Clear View_ Interpreting Scope Numbers and Features
Dynamic Checkweighers and Automatic Weighing Machine Solutions
Fundamentals of Computer.pptx Computer BSC
Nanokeyer nano keyekr kano ketkker nano keyer
PLC ANALOGUE DONE BY KISMEC KULIM TD 5 .0
How NGOs Save Costs with Affordable IT Rentals
Presentation 1.pptxnshshdhhdhdhdhdhhdhdhdhd
material for studying about lift elevators escalation
Prograce_Present.....ggation_Simple.pptx
Lecture 3b C Library _ ESP32.pptxjfjfjffkkfkfk
Entre CHtzyshshshshshshshzhhzzhhz 4MSt.pptx
Hypersensitivity Namisha1111111111-WPS.ppt
1.pptxsadafqefeqfeqfeffeqfqeqfeqefqfeqfqeffqe
"Fundamentals of Digital Image Processing: A Visual Approach"

Building a Thought Controlled Drone

  • 1. Building a 
 Thought-Controlled Drone Jim McKeeth, Embarcadero Technologies jim.mckeeth@embarcadero.com
 @JimMcKeeth Presented at InterDrone Conference Sept 9th, 2015
  • 2. About Jim McKeeth • Lead World Wide Developer Evangelist • Longtime developer • Object Pascal, Java, C#, JavaScript, Objective-C, etc. • Invented and patented swipe to unlock in 2000 • US Patent # 8352745 & 6766456, etc. • Improvisational performer with ComedySportz Boise • I am not a neuroscientist, but I find this all fascinating!
  • 3. • Founded 1993 • Provides Architect, Database and Developer Tools • 3.2 Million Customers including 97% of Fortune 2000 • 35+ Product Awards – Consistent Innovation • 500+ Employees in 29 Countries • www.embarcadero.com
  • 4. Agenda • Drone technical details • Headset technical details • Drone API • Headset SDK • Concerns, Challenges and the Future
  • 5. More Information • My email: jim.mckeeth@embarcadero.com • My blog: delphi.org • This Slide Deck
 http://www.slideshare.net/jimmckeeth/build-brain-controlled-drone • Overview Slide Deck 
 http://www.slideshare.net/jimmckeeth/jim-mc-keeth-wearable-thought-input • The Code: https://github.com/jimmckeeth/Delphi-Emotiv-EPOC
  • 6. “In five years, science fiction will be real!” — Claus Torp Jensen (@ClausTorpJensen) Senior Technical Staff Member and Chief Architect API Economy at IBM (@ibmapimgt) What will the world be like 
 in five years?
  • 7. The Pieces Emotiv EPOC Brain-Computer Interface Parrot.AR Drone 2 Simi-Autonomous Connected App Platform
  • 9. The Drone: Parrot AR.Drone 2.0 • Price: $299.99 • Runs Linux internally, but not user accessible • Contains it’s own WiFi access point • Connect via UDP & TCP • Send control strings • Maintain transmission rate to keep alive • Can also receive status and video back
  • 10. Completely Rebuildable HD Battery $60 Gears+Shafts $15 Tools $20 Cross bars $30 Screws $7 Propellers $12 4x Engines $200 Bottom structure $60 Main board $110 Nav board $70 Charger $40 Outdoor haul $25 ———————— Total $650
  • 11. New contender: Parrot Bebop • Price: $499.99 • Lots of upgrades, especially camera • Also contains own WiFi access point • Whole new SDK • iOS, Android & Linux • Published Nov 2014 • Incompatible with AR.Drone 2.0
  • 12. SDK vs. API • Parrot AR.Drone 2.0 provides both an API and SDK (Bebop has just an SDK at this point.) • An SDK is a software library that does additional work locally - makes it easier to handle video streaming, etc. • An API is a specification of how to connect and control. • SDK works with specific tools and platforms. • Typically SDK uses API. • My examples use the API so it works across platforms.
  • 13. Brain Computer Interface (BCI) Headset Options
  • 14. Electroencephalography (EEG) • Measures electrical activity along the scalp. • Detects voltage fluctuations resulting from ionic current flows within neurons of brain. Image source: https://commons.wikimedia.org/wiki/File:EEG_cap.jpg
  • 15. Neural Oscillation / Brain WavesBeta 15-30Hz Waking Consciousness and Reasoning Alpha 7-14Hz Deep Relaxation Delta 4Hz Deep Sleep Theta 4-7Hz Light Meditation And Sleeping Mu 8-13Hz Voluntary Movement Gamma 30-100Hz Conscious Perception Waveforms by Hugo Gamboa
  • 16. NeuroSky’s MindWave (also in XWave headsets) • EEG with 1 dry electrode • Measures “attention,” “meditation” and eye-blinks • Bluetooth communication • SDK for iOS, Android, PC & Mac • $129.99 to $79.95 retail neurosky.com • Hacking: http://makezine.com/2011/05/10/behind- the-brain-blinker/
  • 17. InteraXon’s Muse • 7 dry EEG sensors via Bluetooth • Focuses on “brain fitness” • 4 hour battery • Android, Mac & Windows SDK now, 
 iOS coming soon • Works with Windows, OS X, iOS, Android, etc. • $299 at choosemuse.com
  • 18. OpenBCI • Open source hardware & software • Bluetooth, Arduino, EEG • 8 wet Electrodes per board (daisy chainable) • Full open EEG & BCI platform • SDK provides EEG data • www.openbci.com starting at $449 • No iOS or Android yet
  • 19. Emotiv EPOC • 16 wet electrodes • 14 EEG electrodes + 2 reference electrodes • Gyroscope to read head movements • 4 mental states, 13 conscious thoughts & facial expressions – 4 Processing suites • Wireless (encrypted) for Windows, Linux or Mac • $399 for Desktop • $499 for Bluetooth Smart (EPOC+) • www.emotiv.com
  • 20. Emotiv Insight • Expected eventually • Starting at $299 (estimate) • 5 dry sensors + 2 reference • Bluetooth 4.0 LE (Smart) • Battery Life: 4+ hours • SDK: Android, iOS, Mac, Linux and Windows Platforms • www.emotiv.com • Comparison http://bit.ly/1cfliTn
  • 21. Emotiv EPOC SDK Overview
  • 22. Expressiv Suite • Detect facial expressions • Eyelid & eyebrow positions • Wink, blink, furrow • Horizontal eye movement • Smile, laugh, clenching & smirking • EEG sensors picking up signals to muscles (not brain waves) • Very fast (10ms) Image Source: https://commons.wikimedia.org/wiki/File:Duchenne-FacialExpressions.jpg
  • 23. Uses for Facial Detection • Anything requiring fast input • Facial gesture detection • Basic eye tracking • Fast input & responses Image Source: https://commons.wikimedia.org/wiki/File:Duchenne-FacialExpressions.jpg
  • 24. Affectiv Suite • Detect emotions / mental states • Excitement • Engagement or Boredom • Meditation • Frustration • Passive detection • Variable levels of each • Short & long term tracking Image Source: https://commons.wikimedia.org/wiki/File:Drama-icon.svg
  • 25. Uses for Emotion Tracking • Realtime media evaluation • Stress analysis and management • Mood monitoring • For more accuracy combine with other data sources • Eye tracking, heart rate, etc. Image Source: https://commons.wikimedia.org/wiki/File:Drama-icon.svg
  • 26. Cognitiv Suite • Detect conscious thoughts • Requires training • Detect 13 thought patterns with intensity level (4 at a time) • Left, right, up, down, forward, pull, CW, CCW, left, right, sway-back, sway-forward, Disappear • Not as fast as Expresiv Image Source: https://commons.wikimedia.org/wiki/File:ThinkingMan_Rodin.jpg
  • 27. Uses for Cognitive Thought Identification • Whole new input method • Variable intensity for fine control • Observe subconscious responses • More training improves accuracy • Improves the model • Trains your brain to focus Image Source: https://commons.wikimedia.org/wiki/File:ThinkingMan_Rodin.jpg
  • 28. Brain-Computer Interface Internet of Things Autonomous Vehicles expectations Speech-to-Speech Translation time Plateau of Productivity Slope of EnlightenmentTrough of Disillusionment Peak of Inflated Expectations Innovation Trigger Plateau will be reached in: more than 10 years5 to 10 years2 to 5 yearsless than 2 years obsolete before plateau Gartner's 2014 
 Hype Cycle for Emerging Technologies August 11, 2014 Smart Advisors Data Science Prescriptive Analytics Neurobusiness Biochips Affective Computing Smart Robots 3D Bioprinting Systems Volumetric and Holographic Displays Software-Defined Anything Quantum Computing Human Augmentation Connected Home Quantified Self Smart WorkspaceVirtual Personal Assistants Digital Security Bioacoustic Sensing Natural-Language Question Answering Consumer 3D Printing Cryptocurrencies Complex-Event Processing Big Data In-Memory Database Management Content Analytics Hybrid Cloud Computing Gamification Augmented Reality Machine-to-Machine Communication Services Mobile Health Monitoring Cloud Computing NFC Virtual Reality Gesture Control In-Memory Analytics Activity Streams Enterprise 3D Printing 3D Scanners Consumer Telematics Speech Recognition Wearable User Interfaces
  • 30. Command Strings • Connect via WiFi access point to 192.168.1.1 UDP port 5556 • Command string format: AT*[cmd]=[seq],[arg array] • Sequence number must not repeat • Argument array is comma separated typically • Floating point numbers must be encoded as decimals (more later) • Send command every 30 ms (>2 seconds = session dropped)
  • 31. Command String Examples • FlatTrim: AT*FTROM=[seq] • Movement: AT*PCMD=[seq],1,Roll, Pitch, Vert, Yaw • Values of 1.0 to -1.0 • Use 0 in all values to hover • Takeoff: AT*REF=[seq],290718208 • Land: AT*REF=[seq],290717696 • Emergency: AT*REF=[seq],290717952
  • 32. Float as Integer • Single precision floating point number is 32 bits • Integer is 32 bits • Map IEEE-754 bit value from float to integer • -0.8 = 0xBF4CCCCD = 10000001011001100110011001 = 1085485875
  • 33. Drone Concerns • Manual override - keyboard override BCI, just in case • Send emergency command to clear error state • Start with FlatTrims to level drone • Use state machine to send command 30 times a second 1. Keyboard override 2. BCI Input 3. Hover
  • 34. ToDo with Drone • Process NavData (sent back on UDP port 5554) • Get battery data to know remaining flight time, errors, etc. • Process Video stream (sent back on UDP port 5555) • Display on Google Glass for HUD • Find use for drone “Animations” like flips • Maybe use LED animations when receiving BCI input
  • 36. SDK Format • On Windows a Visual C++ DLL provides the interface • Examples in VC++, C#.NET, Java, Python & Matlab • All my code is in Object Pascal • On OS X a dylib provides the interface • Examples in Qt & Xcode
  • 37. Emotiv EDK Workflow • Call EE_EngineConnect to connect • Create event handler EE_EmoEngineEventCreate • Create state structure EE_EmoStateCreate • Define actions to listen for and then train those actions (more later) • Every 10 ms call EE_EngineGetNextEvent (more later)
  • 38. Handle Cognitive Actions • If state is EDK_OK then call EE_EmoEngineEventGetType • If EventType is not EE_EmulatorError then call EE_EmoEngineEventGetUserId • If EventType is EE_CognitivEvent then it was a training event (next slide) • If EventType is EE_EmoStateUpdated then get EE_EmoEngineEventGetEmoState • Read ES_CognitivGetCurrentAction and ES_CognitivGetCurrentActionPower
  • 39. Listen & Train • Listening: • Call EE_CognitivSetActiveActions with mask of Actions • Call EE_CognitivSetTrainingAction with the ID of the action to train • Call EE_CognitivSetTrainingControl with COG_START • On EE_CognitivEventGetType of EE_CognitivTrainingSucceeded call EE_CognitivSetTrainingControl with COG_ACCEPT
  • 41. New Emotiv Xavier SDK • EPOC+ and Insight are Bluetooth Smart • Connect to mobile devices - iOS & Android • Allows to additional user definable cognitive actions • Still only listens for 4 cognitive actions at a time
  • 43. Thoughts to Movement • Moves while thought active, otherwise hover in position • Speed of movement = intensity of thought • How to allow more than 4 directions of movement? • Use Expressiv facial gesture to switch between sets • Future consideration: Use strobing grid of controls
  • 44. Typing via BCI Jonathan Wolpaw
 Wadsworth Center
 Albany, NY ~15 seconds / key . . . . . . . . . A B C D E F . . G H I J K L . . M N O P Q R . . S T U V W X . . Y Z 1 2 3 4 . . 5 6 7 8 9 0 . . . . . . . . .
  • 46. Purpose of Feedback • Using a visual feedback gives the wearer something to focus on • Otherwise they often change their thought pattern when the drone is moving • Also gives them immediate awareness of what is picked up
  • 47. Moverio BT-200 Product Overview Integrated Sensors Accelerometer Compass Gyro Head Set Camera Earbuds with Microphone +x +y +z
  • 48. Epson Moverio BT-200 Specs Epson BT-200 Retail Price $699 Display Type Transparent Resolution 960×540 QHD Android v4.0.4 API Level 15 - Ice Cream Sandwich Camera VGA, 640x480 WLAN 802.11b/g/n 2.4GHz Bluetooth 3.0 micro USB v2.0 (On-The-Go) GPS P-GPS CPU TI OMAP 4460 (ARM Cortex A9 Dual Core 1.2GHz) RAM 1GB Flash 8GB microSD Max 32GB
  • 49. Laptop EDK My   App Data Flow Electrical   Signals Wireless  Signal AT*REF=1,290718208 Provides   WiFi     Hotspot Feedback
  • 50. Q & A
  • 51. More Information • My email: jim.mckeeth@embarcadero.com • My blog: delphi.org • This Slide Deck
 http://www.slideshare.net/jimmckeeth/build-brain-controlled-drone • Overview Slide Deck 
 http://www.slideshare.net/jimmckeeth/jim-mc-keeth-wearable-thought-input • The Code: https://github.com/jimmckeeth/Delphi-Emotiv-EPOC