Introduction: Control Your Friends Using the Power of Neuroscience (Remote Control Human Part II)
In this Instructable we'll use a Mindwave Mobile EEG (electroencephalogram) unit, a trusty Arduino UNO, a TENS (Transcutaneous Electrical Nerve Stimulation) unit, and a simple relay to remotely control a human minion with our minds!
This Instructable scaffolds on the skills learned in the Remote Controlled Human (http://bit.ly/1DVxLrl). Please review that project to get familiar with what a TENS unit is and how to switch it on/off using a digital microcontroller pin. In this case, we're sending the on/off signal directly from our minds instead of pressing buttons on a smartphone. No more pesky finger movements needed to rule the world!
WHAT SORCERY IS THIS?!
This whole apparatus works because of the way brain cells generate and send signals to each other and to muscles. Neurons are constantly exchanging ions with the extracellular milieu to maintain resting potential and to propagate action potentials that act as messages to other cells. Ions of similar charge repel each other, and when many ions are pushed out of many neurons at the same time, they can push their neighbours, who push their neighbours, and so on, in a wave. This process is known as volume conduction. When the wave of ions reaches the electrodes on the scalp the difference in push or pull voltages between any two electrodes can be measured by a voltmeter. Recording these voltages over time gives us the EEG signal (http://bit.ly/1k2iZ5H).
Because our apparatus uses the EEG signal to control a computer program and that computer program to control muscle movement it is a rudimentary Brain Machine Interface (http://bit.ly/1iewcYo). My former colleagues at Duke University pioneered the use of brain signals to control external devices. They even managed to get a paraplegic in a robotic exoskeleton to kick off the 2014 World Cup in Brazil! Ours is a much more humble device but operates on the exact same principles. You're learning and doing real neuroscience here!
OK...we can easily record brainwaves to get a control signal but how do we stimulate the muscles? We're using electrical pulses from the TENS unit to hijack the neuromuscular junction (http://bit.ly/1Fihfy1). The neuromuscular junction is where a motor neuron activates a muscle to contract. Motor neurons in your brainstem and spinal cord send signals to contract via long nerves. Some of these nerves, like the ulnar nerve, are relatively exposed so we can easily take them over.
The Arduino UNO translates your brainwaves into a control signal for the TENS unit. The TENS unit stimulates involuntary muscle movements, and the relay acts as a bridge between the two. SAFETY ADVISORY: TENS is the use of electric current produced by a device to stimulate the nerves for therapeutic purposes. We're gonna hack this for nefarious non-therapeutic purposes but remember that the comfort, health and safety of your cyborg minions always comes first. Follow all safety guidelines provided with your TENS unit and always start at a lower current and ramp up to avoid pain or discomfort. OK...now let's have some fun! A remote control human can be built in about 10 minutes with the following ingredients:
- 1 Arduino UNO (http://bit.ly/Jxa4fz)
- 1 TENS unit (http://bit.ly/1aEnhBu)
- 1 GROVE relay unit (http://bit.ly/1Fh9DvE)
- 1 GROVE breakout cable (http://bit.ly/1IEo8wp)
- 3 Male-to-Male jumper cables
- 2 Male headers
- Wire cutters/strippers
- Small slotted screwdriver
Step 1: Prepare the TENS Cables and Wire Into the Relay
Complete steps 1 and 2 from the Remote Controlled Human project (http://bit.ly/1DVxLrl) and you should end up with one of the TENS electrode leads wired through the relay as shown in the pics. The relay allows you to completely disconnect the TENS electrode power unless the "ON" control signal is being sent.
Step 2: Connect Arduino UNO
Use the GROVE breakout cable to connect the relay to some free rows on the breadboard. Then take three male-to-male jumper cables and wire them as follows: VCC on relay to 5V on the UNO; GND on relay to GND on the UNO; SIG on relay to a digital pin on the UNO (here we use pin D13). Don't use D0 or D1; we need those pins for serial communication between the computer and UNO.
Step 3: Test Relay Function
Download the latest Arduino IDE (http://bit.ly/1jDe283). Use the included PhysicalPixel sketch (File > Examples > 04. Communication > PhysicalPixel) to test your relay. After flashing the sketch to your UNO open the Serial Monitor with a baud rate of 9600 and type "H" (no quotation marks). The on-board LEDs on your relay and UNO should light up. Type "L" and they should turn off.
We can now send an ON/OFF signal to our TENS unit via the serial port on the computer!
Step 4: Install Processing
Download and install Processing (http://bit.ly/1c2nkaT). The Processing IDE looks a LOT like the Arduino IDE so we should be comfortable here.
Open up the linked Processing sketch files and save the folder to your main Processing directory.
You'll also need this handy socket connector to make getting data from the Mindwave really simple (http://bit.ly/1FheZXO).
It's already included in the linked archive, so you don't have to install it yourself.
The path should be something like .../Processing/MindControl/code/ThinkGear.jar
Now you're ready to read your own mind!
Step 5: Put on Your Mindwave
Follow NeuroSky's instructions to pair your Mindwave Mobile and computer over Bluetooth. After pairing, fire up the MindControl sketch and test the functionality. The sketch will print your "meditation" and "attention" levels in realtime. If attention goes above 80, the sketch sends an "H" over the serial port which tells the Arduino UNO to switch digital pin 13 HIGH. That triggers the relay and allows current to flow to the TENS electrodes. Right now they're not connected to anything just to be safe.
Step 6: Connect Your Minion to the TENS Unit
Connect the two TENS electrodes across the muscle group or nerve you want to stimulate. The ulnar nerve (http://en.wikipedia.org/wiki/Ulnar_nerve) is really convenient for stimulating because it is the largest unprotected nerve in the human body. It runs right through your elbow and down your forearm, so place the electrodes as shown in the picture. The ulnar nerve is directly connected to the little finger, and the adjacent half of the ring finger, so you should expect one or both of these fingers to move when you turn on your cyborg minion.
Make sure you have the TENS unit dialed down to 1 before turning your minion on! You can always dial the power up slowly to a level that elicits muscle movement without causing pain or discomfort.
Now try a task that requires you to focus a bit, like counting backward from 100.
As your "attention" level increases the pin should switch to HIGH, the relay should close, current should flow through the TENS electrodes and stimulate the ulnar nerve to involuntarily move your cyborg minion's finger(s)! It's alive. Now go take over the world.
Remember, you have many more digital pins on the UNO, so with 4 TENS units and an 8 relay board you could independently control 8 different muscle groups in you cyborg minion. Mwuahaha (x8).
We have a be nice policy.
Please be positive and constructive.