Introduction: Brain-Controlled Wheelchair
Hello! A lot of people have written us saying they are building a Brain-Controlled Wheelchair, and that's great! We look forward to helping you get through the hard parts, but some of you won't need any help (maybe). What we want from you (all of you) are pictures! Or at least a message saying "Hey, we're doing it and we're in (location)" so we can get all excited.
Thank you and Good Luck!
This Instructable will show how to make a Brain-Controlled Electric Wheelchair, so that a person can become mobile without moving their body.
This could be useful for people who are paralysed, and are unable to control parts of their body enough to physically activate the joystick of an electric wheelchair. Many people may be able to use this technology to gain some independence, and to take a break from needing an attendant to push their wheelchair so they can get some fresh air.
The parts of this system include an electric wheelchair, a laptop computer, an Arduino, an interface circuit, an EEG headset, and a collection of ready-made and custom software.
The software which was written specifically for this project (including the GUI and Arduino sketch) has been bundled with Puzzlebox Brainstorms, and is released freely under an Open Source license.
The EEG headset, which connects wirelessly to the laptop, allows the operator to simply think "forward" or "left" or "right" to cause the wheelchair to move. Performance is related to practice by the user, proper configuration of the software, and good contact made by the EEG electrodes on the scalp of the operator.
The interface circuit connects between the Arduino's digital pins and the joystick of the wheelchair. When the Arduino receives a command from the computer, it causes the circuit to "fool" the wheelchair into thinking that the operator has moved the joystick.
WARNING: Electric wheelchairs are designed for trained operators who have practised manoeuvring safely. Electric wheelchairs can weigh upwards of 200 pounds EMPTY! They have no mechanism to stop when they hit a human or an animal, or go off a curb or down stairs or right through a bannister. Make sure no one is in the path of a wheelchair which is not being operated by a human who can operate the OFF switch. Make sure everyone in the vicinity of this Instructable realizes what may happen if they don't get out of the way.
Do not attempt to stop an electric wheelchair with your body.
Step 1: Acquire Materials
To build this Instructable, you will need an electric wheelchair, (We used an Action Arrow Storm Series), an EEG Headset, (We used an Emotiv wireless headset), a Laptop Computer, an Arduino, and an interface circuit made from basic electronics, (see step 5 for materials for the interface circuit).
The Electric Wheelchair was acquired as an unwanted extra from a local repair shop. It was not considered serviceable for disabled persons because its condition was below standard. If you hear of someone in need of an electric wheelchair who is low on funds, encourage them to ask repair shops for unwanted chairs.
The EEG Headset is an EPOC acquired from Emotiv. Their site is here:
The Laptop Computer was Steve's but any laptop will do, it only needs to have two USB ports - one to connect to the Arduino, and the other for the EEG headset's Wireless receiver.
An Arduino is a small microcontroller platform with a USB serial interface. In this case, it serves as a bridge between the laptop computer and the interface circuit (see steps 5 and 6).
Originally, the Arduino was not used, and the interface circuit was connected directly to the parallel port of the computer. The computer we eventually used does not have a parallel port, so the Arduino performs the function of providing eight on/off signals based on a packet of serial data sent through its USB interface. So if your laptop has a parallel port but is new enough to run the Emotiv software, you might be able to skip the Arduino.
Step 2: Software
The Software necessary includes the Puzzlebox Brainstorms BCI (Brain-Computer Interface) package which provides a GUI and visual feedback to the user and issues control commands to the Arduino hardware. Also required is the standard drivers and software included with the Emotiv EEG headset as well as an Aurduino Sketch which is a simple program written by us for an Arduino.
An optional Python-basedbackend control script can operate independently of the Puzzlebox Brainstorms GUI (see Step 7) and will translate keypresses entered on the keyboard into commands sent to the Arduino, which is connected to the interface circuit. The interface circuit makes the wheelchair move by simulating someone pushing on the joystick. This option is useful for controlling the wheelchair remotely via SSH session from another computer or device such as a mobile phone. The backend control script can be found here:
And a suitable Python interpreter can be found here:
The Puzzlebox Brainstorms software runs alongside the Emotiv headset's Control Panel and EmoKey application, which allows the wearer of the headset to cause characters to be "typed" on the laptop when a learning algorithm matches the user's current brainwave patterns to previously trained sequences.These "typed" characters activate buttons displayed in the Puzzlebox Brainstorms GUI (or the backend control script) which tells the Arduino to activate the Interface Circuit which simulates someone pushing on the joystick, which causes the wheelchair to move. The Puzzlebox Brainstorms software can be found here:
There are two programs from Emotiv which we will use for this project: Emotiv Control Panel and EmoKey. Both are available to download freely as part of their "SDKLite" software pack:
We were running the Microsoft Windows operating system because that is the most supported operating system by the Emotiv software at this time. (They are working on a Linux version)
The Arduino Sketch is a program which is loaded into the Arduino hardware using free software from the Arduino site. The program watches for a series of characters coming in the USB serial port from the computer. When it sees the letter "x" it watches the next eight characters that come through, and they correspond to eight pins on the Arduino. If a character is "1" then that pin is set to ON, and outputs 5 volts, otherwise the pin is turned OFF and outputs zero volts.
The Arduino sketch can be found here:
To load the above program into the Arduino, you need the Arduino software, found here:
You might also need drivers for the USB serial interface on the Arduino, depending on your operating system and which version of the Arduino you own. Details at:
Step 3: Test the Wheelchair
The wheelchair will most likely use a pair of batteries the size of car batteries, and the same voltage. These batteries are the most likely part of the wheelchair to present a problem. If the chair has been unused for a long time, or if it was left in the "ON" position, the batteries might be totally ruined.
Otherwise, the batteries need to be charged. A wheelchair has a charger connector, and should come with a charger with the same connector. Keep in mind that the batteries are connected in series, which means that the two 12-volt batteries appear as a single 24-volt battery to the chair. The charger must be a 24-volt charger, or a 28-volt regulated power supply.
Of course, you can also just use two ordinary car batteries, but they should be matched as to capacity and condition. Ideally two identical brand-new batteries would be used.
It is possible to charge them individually with a 12-volt battery charger, but they should be charged equally since they will be cooperating to power the chair.
Some wheelchairs include reclining motors and other adjustments. These systems usually have tilt sensors and other safety sensors which keep the chair from moving when it's not safe. If the chair appears to turn on, but it won't move, check for this.
Also, chairs usually have a "clutch" which can disengage the wheels from the motors. Sometimes this is a lever, and sometimes it's a lockable hub in the middle of the wheel. There should be a sticker explaining clearly how to engage or disengage it. If the clutch is released, the motors will not cause the chair to move, and they may not even turn if the wheelchair "brain" knows that they are disengaged.
Finally, there may be a manual brake. Look for a sticker explaining how to operate it. But most of the time, the brake is built into the motor, and is activated whenever the motors aren't turning. In this type of chair, it will be impossible to push around if the clutches are engaged. When the joystick is moved (and the chair is on) you will hear clicks as the brakes are released and the motors are engaged. The brakes click back on when the chair stops after releasing the joystick.
If the batteries are charged, and the chair turns on and drives around, there is not much more to check. Experiment with all of the switches you can find, to learn which are related to movement of the chair. Our chair had two switches; one selects between OFF and LOW and HIGH speed, the other between DRIVE "A" and DRIVE "B" which are slow and fast. It is necessary to know how to turn the chair OFF if it gets out of control. It is useful to set the chair to its lowest speed when experimenting with computer control.
Step 4: Modify the Wheelchair's Joystick
(Note: we used an Action Arrow Storm Series electric wheelchair, with an Action MOC MK III motor controller. The following instructions apply to the joystick for that system. Other electric wheelchairs with different controllers may be similar or totally different. Some chairs use an inductive joystick which is far too sophisticated for this hack!)
To control the wheelchair electronically, we need to make a connection to its joystick. The joystick is a pair of variable resistors, one for forward/backward and another for left/right. Each variable resistor is connected between two voltages; one approximately zero and the other around 12 volts.
This means that the center wire of each variable resistor is somewhere in the middle at rest, when the joystick is not being moved. A circuit is necessary to pull current on these variable resistors when the Arduino's digital outputs cause it to do so.
In this wheelchair, the Joystick is a high-tech assembly where you can't see the actual variable resistors. There are five wires coming out of the joystick, and two of them are the "middle terminal" of the forward/backward and left/right variable resistors. We had to use a voltmeter and some head-scratching to figure out which wires these were (hence the electrical tape).
First we found Ground (usually the most prolific node on a circuitboard) and then we were able to measure the wires of the joystick while moving it around. We saw that one wire changed up and down in voltage when the stick was pushed forward/backward and another one when the stick went left/right. These were the "middle terminal" of the two variable resistors in the joystick.
So we make a connection to the "middle terminal" of the forward/backward variable resistor, and another wire to the left/right one. We also run a wire from Ground of the joystick circuit, and its 12-volt supply, which we found using the voltmeter. These four wires run to a female pin-header connector like a CDROM drive audio cable uses. This connector goes to a four-pin header on the interface board.
Step 5: Build the Interface Board
The interface board takes eight control lines in, from an Arduino or a PC parallel port, and can make the wheelchair think the joystick is being moved. It does this using transistors, some diodes and a bunch of resistors. All of these parts can be found at mouser.com or digikey.com or several other suppliers. Since the transistors (2N7000) are FETs, they draw no current (although their default-mode resistors take a milliamp or so) so they can be driven from any digital control signal. The diodes we used are 1N4148.
A datasheet for the 2N7000 transistor can be found here:
The circuit contains eight transistors. Two of them pull the forward/backward wire toward ground through a resistor each. One has a larger resistor and the other a smaller one. When both transistors are turned on, both resistors are pulling toward ground, representing maximum speed in that direction. Another two transistors are used the same way for the left/right wire.
The other four transistors are connected between ground and a resistor to the 12 volt power supply. These transistors are normally on, and their drain terminal is connected through a diode to the forward/backward or left/right wire. When these transistors are turned off, the resistor is no longer pulled toward ground and the joystick wire gets pulled toward the +12v wire through the diode.
This is an easy way to let an eight-bit TTL (0 / 5V diigtal) controller like the PC parallel port or 8 pins of an Arduino control the 12-volt analog wheelchair joystick. In actual practice (as you can see by looking at the schematic and the actual circuit) the resistor values have to be chosen to achieve values which will not cause the wheelchair brain to think there is a malfunction in the joystick. (the 41K and 6.8K resistors are to pull the transistors' inputs to their default state, so the joystick works normally when nothing is plugged into the interface boards' input side).
To determine resistor values, start with a variable resistor (a 100K-ohm is a good start) and connect a wire to its center and left terminal. With the wheelchair safely elevated to prevent movement (or with the operator safely in the seat with room to drive around) connect the variable resistor while taking notes. Start by connecting to the left/right wire and ground and with your variable resistor turned all the way to the right. (this is the highest resistance, 100K ohms). A picture of a variable resistor is shown below.
When the left/right function is activated on a wheelchair, it rotates about its center like a tank. Make sure your feet are safely in the stirrups or you could get hurt!
If the wheelchair does nothing, turn the knob left until the slowest speed desired happens. Disconnect the resistor, measure it with an ohm-meter, and write everything down (how it was connected and what the chair did). Do it again and find the lowest resistance and the highest speed desired and write that down. For this direction, you will need a resistor for each of the two transistors associated - one will be the value of the first test (slowest movement) and the other will be (get ready) the inverse of [the inverse of the value of the second test minus the inverse of the value of the first test]. This way, when both transistors are activated, the wheelchair sees the resistance of the second test. You can always just round up values if you don't have the exact right number. These resistors and the next two will go on the lower transistors in the schematic, to pull the joystick wire toward ground when those transistors are activated.
This test must be repeated with the forward / backward wire (you might go backwards at high speed). Take notes. After those two resistors are figured out, you will need to try the same tests but this time, connecting your variable resistor through a diode to the Red wire, which has +12 volts from the joystick circuit. Don't let this Red wire get shorted to ground, even for a second - you might FRY your electronics. The results of these tests will be the resistor values chosen for the upper transistors, which pull toward the red wire as you can see in the schematic.
Once you have determined the resistor values you want to use, or even before that, you can build the interface board. We used "perfboard" and assembled it according to the same physical arrangement shown in the schematic image seen below, except that we used 8-pin machine sockets which work well for shoving resistors into, so that changes can be made to the speed of movement of the machine. You could also just use a bunch of 100K-ohm variable resistors....
Perfboard on WikiPedia:
The Gate terminal of each transistor goes to one of the eight control wires of the input cable. We used a DB25 Male connector since we were originally using a PC parallel port. The control wires are connected to pins 2 through 9, and ground to pins 18-25. We then had to make an adaptor to connect this to the Arduino when it replaced the parallel port in our setup. You can skip the whole DB25 connector and just wire directly from the Arduino to the transistors on the interface board as long as you wire it up the right way, which is easier without the extra step anyway.
Step 6: Program and Connect the Arduino
You will need to download and install the Arduino software onto your computer. This is the program which will let you load the Sketch onto your Arduino which will make it perform its function in this system. The Arduino software communicates to the Arduino through a serial port which appears to your computer after the USB interface is plugged in.
If the Arduino is plugged in and your computer can't figure out that it is a serial port, you will need to download a driver from the Arduino website.
You will also need the sketch we have written for this application.
All of the above software is linked in Step Two of this instructable.
Once you have the Arduino software running, and it recognizes your Arduino hardware (which is plugged into your computers' USB port) you will need to load the sketch we have written using the File menu. Then go to the Tools menu and select "Board" and choose the model of Arduino you have. The Diecimila, Duemilanove or Uno are very similar and any of them would work for this application. Next, from the Tools menu, make sure the Serial Port of your Arduino is selected.
At this point, with our sketch loaded, you can go to the File menu and select "Upload to I/O board" to load the sketch into your Arduino. After this step works, you can quit the Arduino program. You won't need it again unless you want to change the way your Arduino operates, and it shouldn't be running while the Python program is running.
After this, you will need to make a connector to go between the Arduino and the interface board which controls the joystick of the wheelchair. We used pins 10, 2, 3, 4, 5, 6, 7, 8, of the Arduino and connected them to pins 2, 3, 4, 5, 6, 7, 8 and 9 of the DB25F connector from the interface board. We also connected Ground from the Arduino to pin 18 of the DB25F connector.
If it is not obvious at this point, you can skip the whole DB25 connector and just wire directly from the Arduino to the transistors on the interface board. Our setup is the result of originally using the parallel port of the PC instead of an Arduino (which is still an option if you have a parallel port and don't want to use an Arduino)
Step 7: Install the Python Interpreter and Program
NOTE: The Puzzlebox Brainstorms software includes the console-based Python program described in this step. Strictly speaking it should not be necessary to download the Python interpreter or any of the software's dependencies (the Windows version mentioned in Step 8 is pre-compiled and packaged), but it is assumed anyone who wishes to leverage this software for a new type of wheelchair will need to know how to control everything from a source code level, so we have included these details for completeness.
Download and install the Python interpreter and download the Python program, listed in Step Two of this Instructable.
You may have some trouble configuring the program for the correct serial port of your Arduino, especially if your computer already has a serial port.
Make sure the Arduino is plugged in and run the program using the Python interpreter. If you press direction keys such as i j k m, you will see the built-in LED on the Arduino turn on or off because it is wired (in software) to one of the output lines to the interface board.
At this point you can connect the Arduino to the interface board. Prop the wheelchair up so its wheels are not touching the ground, or if you can (and we did) disengage the wheel clutches. This way, when the motors turn, they don't actually cause the wheelchair to move (although it no longer is braked in place and could roll).
If you turn on the wheelchair, the lights should come on normally and indicate that the wheelchair is ready to be moved. Moving the joystick should cause the brakes to click off and the motors to try to move the chair.
Now that the Python program is running, as in the picture below, pressing one of the movement keys will cause the program to tell the Arduino to send the wheelchair in that direction for a short time, and then tell it to stop. Pressing the 1, 2, or 3 keys will set the program to "speed" 1 2 or 3. In speed 1, the minor transistor for each direction is activated. In speed 2, the major transistor (the one with the lessor resistor) is activated. In speed 3, both transistors (seen as 1 or 0 in the text display below) is activated.
(note that these speeds have nothing to do with speeds selected with the ON/OFF switches of the chair - see step 3)
When the software sets the output to 00110011 the wheelchair is told to stop.
At this point you should test that the Python program properly causes the wheelchair to move when a key is pressed (repeatedly) and the next step is to configure the Puzzlebox Brainstorms and EEG headset software.
Step 8: Install the Puzzlebox and Emotiv Software
Puzzlebox Brainstorms is an open source BCI (Brain-Computer Interface) software package which allows control of various robots and vehicles via EEG. Version 0.4.5 of the software was updated to control the Action Arrow Storm Series wheelchair featured in this Instructable.
The software has been pre-packaged for Linux and Windows and is available for download at the website: (this was listed in Step 2)
The software should be entirely compatible with Mac OS X, however it has not been packaged or tested with that operating system.
There are two programs from Emotiv which we will use for this project:
Emotiv Control Panel
Both are available to download freely as part of their "SDKLite" software pack:
(this was listed in Step 2)
Step 9: Train the Software and the Human Operator
To drive and control the wheelchair via EEG we will use the Emotiv Control Panel application to perform detections of the user's intent, turn those detections into keystrokes using EmoKey, and use those keystrokes to actually drive the wheelchair using Puzzlebox Brainstorms.
To begin, load the Emotiv Control Panel program and select or enter a user name for your user's profile. We'll be using the "Cognitiv" function of this software which is effectively a learning algorithm. The user will need to train the software to recognize their "Neutral" state - that is the user should sit still, and look away from the screen, clear their mind and try not to think about anything in particular. Then the user should select a direction to move a floating box on the screen, for example they can "Push" the box away from themselves or "Lift" it up in the air. Once trained, the software will attempt to detect the difference which occurs in the user's brainwaves between the neutral state and the patterns which occur when the user thinks about moving the box.
In our experience the Emotiv software is very good at training at least one direction direction for control, for example thinking "Push" to drive the wheelchair forward, and allowing that user to "turn on" or "turn off" that single command at will. However it seems that most if not all users have trouble training a second or third direction as effectively as the first. For this reason it is recommended when first using the software to "cheat" for left and right control by using facial muscles (which is technically EMG, not EEG) for example closing one eye to move left or right or clenching either side of the jaw.
Next we will use the EmoKey software to translate the detections made by the Emotiv Control Panel into keystrokes which send to Puzzlebox Brainstorms which in turn controls the wheelchair.
An example file is available which uses "Push" to drive the wheelchair forward whenever the meter rises above 30% and issues a "Stop" command whenever the meter drops back below that level:
The user can start with this file and tweak settings as appropriate for their level of comfort and control.
Finally the Puzzlebox Brainstorms software can be be started. Simply select your wheelchair model and the serial port to which the Arduino board is attached and press connect. You should close the Serial Monitor included with the Arduino IDE before pressing the "Connect" button.
At this point if both Emotiv Control Panel and EmoKey are running and configured, detections should be occurring and sent to Puzzlebox Brainstorms, allowing control of the wheelchair.
You should also be able to drive the wheelchair using the on-screen buttons or following keyboard keys:
i - Forward
j - Left
k (or m) - Reverse
l - Right
Space - Stop
You can also set the speed of the wheelchair using the on-screen dial.
NOTE: On the right-hand portion of the GUI there are meters labelled "Concentration" "Relaxation" and "Speed". These meters are used for controlling the wheelchair using an alternative EEG Headset NeuroSky called the NeuroSky MindSet. In this mode when the user's concentration level reaches a certain threshold, the wheelchair will being to drive forward (so long as the "Enabled" button is checked under the "Speed" meter). It will be necessary to connect to the NeuroSky MindSet under the Control Panel tab, through a program such as Puzzlebox Synapse (also available at the Puzzlebox Brainstorms website) or ThinkGear Connect (which is included with the NeuroSky MindSet). For more information please visit the Puzzlebox Brainstorms website, as this Instructable focuses on using the Emotiv EPOC.
Step 10: Practice Makes Perfect
We have a be nice policy.
Please be positive and constructive.
I'm looking to create an Aduino interface to a wheelchair controller, but my controller uses "a double decoded contactless inductive joystick" whatever that means. (It's from the manual.) Any ideas how I might create an interface for this, or links to other solutions?