Backyard Brains Logo

Neuroscience for Everyone!

+1 (855) GET-SPIKES (855-438-7745)


items ()

Experiment: Advanced Neuro-Prosthetics-Take Someone's Free Will

Have you ever had the desire to lose your free will? Or, alternatively, have you ever had the desire to take someone's free will? Now you can with our new "Human-Human-Interface Experiment."

Time 2 hours
Difficulty Advanced

What will you learn?

In a continuation of our 1) Neuroprosthetics Experiment and 2) Muscle SpikerShield Experiment, you will learn how to use your muscle signal to control other devices, in this case, a TENS (transcutaneous electrical nerve stimulator) to excite and contract the muscle of another human.

Prerequisite Labs

  • Muscle SpikerShield - You should become familiar with how to use your Muscle SpikerShield and an Arduino


Making the Connection:

The Human-Human Interface is available as an easy to use complete kit! It comes with everything you need, including an arduino board already programmed with the HHI code! For the fastest way to begin imparting your will upon others, check it out in our store! If you're a budding neuro-prosthetic designer, and you're still interested in building and gathering the devices yourself, check out our DIY page for further instructions!

Background

Note: A TENS unit by definition delivers enough current to cause muscle contraction. Do not place electrodes across the muscles of the throat or the chest. This experiment is appropriate for college students. Adult supervision is needed for younger (high school) users.

We have previously discussed "neuroprosthetics," that is, designing a machine that interfaces with living neurons to control a device or for sensory substitution. But what about muscles? If people have damage to their spinal nerves, the muscles themselves can be stimulated, and this line of research is called "functional electrical stimulation."

For example, functional electrical stimulation can often be used to help someone stand up, or to improve walking by helping to swing a foot forward.

In addition, if someone has an artificial limb, such as a robotic arm, they can use the electrical activity generated by the electromyographic signals in their pectoral muscles to control the motors and control systems in the robotic arm. A notable example is Jesse Sullivan, who lost his arms during an electrical installation. There is also a company called RSLSTEEPER that has developed a bionic arm called the "bebionic3" which functions on very similar principles, but uses muscular activity in the amputee's stump to control the wrist and hand movements.

Relation to RoboRoach

Fans of the RoboRoach have often asked us: "When will you get this working on humans?" We responded and solved this customer request by launching our "Society" invention. But many people were left unsatisfied. They wanted something more direct.

On the other hand, critics of the RoboRoach have often asked us: "How would you like it if someone controlled you with electrical stimulation?" Now, after months in the research lab, we finally now have the answer, and it is...

"...it depends.""

If you like who is controlling you, the feeling can be quite nice.

Downloads

Your HHI arduino comes pre-loaded with the HHI code. If you use your arduino for other projects, if you accidentally press the reset button, or would like to adjust the thresholds, you will have to re-upload the code! You can do this with the Arduino software. If you are new to Arduino and need to learn how to upload code, check out this helpful guide

Download our Arduino(.ino) Human-Human-Interface Sketch

Video

The Code

Explanation of the MuscleSpikerShieldWithHHI_V1_0.ino.zip code

Some things to note:

  1. We have the EMG input set to analog-in 0. This is done with a jumper. You can change the jumper position to set the analog-in to analog-in 0 (left), analog-in 1 (middle), or analog-in 2 (right). This allows you to stack three Muscle SpikerShields at once should you prefer to do so for other experiments recording from multiple muscle groups...
  2. The LEDs are incorporated into the circuit through the jumper to the chip
  3. We have the Stimulation output (to activate the relay) set to Digital Out 3.

In the code, the analogRead function is used to convert the EMG signal into a number between 0 and 1024. This number, which updates every 100 ms, is called "finalReading". We then set an "if" statement threshold with the line " if (finalReading > 3)". Final reading is then matched against the threshold to determine how many LEDs will light up and whether or not the relay circuit gets tripped. When the EMG signal goes above a "3" we activate the relay with the Digital Out 3. This sends a 1 second digital high pulse, activating the relay, allowing current to flow through the TENS unit and stimulate the muscle of your partner. You can change the threshold from "3", found at the beginning of the code as #define Threshold 3 to a lower number to make stimulating someone easier (less EMG amplitude), or a higher number to make stimulating someone harder (more EMG amplitude).

The Code

/*------------------------------------------------------------------------------------
 * Code monitors amplitude of EMG envelope, displays EMG strength on LED bar and controls
 * relay that turns on/off a TENS (Transcutaneous Electrical Nerve Stimulation) device.
 *------------------------------------------------------------------------------------
 */

 #define RELAY_PIN 3                         //pin for relay that controls TENS device
 #define SENSITIVITY_BUTTON_PIN 7            //pin for button that selects sesitivity
 #define NUM_LED 6                           //number of LEDs in LED bar
 #define RELAY_THRESHOLD 4                   //defines sensitivity of relay

 byte ledPins[] = {8, 9, 10, 11, 12, 13};    //pins for LEDs in LED bar

 //EMG saturation values (when EMG reaches this value the TENS relay will be activated)
 int sensitivities[] = {200, 350, 520, 680, 840, 1000};
 int lastSensitivitiesIndex = 2;             //set initial sensitivity index

 int emgSaturationValue = 0;                 //selected sensitivity/EMG saturation value
 int analogReadings;                         //measured value for EMG
 byte ledbarHeight = 0;                      //temporary variable for led bar height


 //-----------------------------------------------------------------------------------
 //   Setup inputs and outputs
 // ----------------------------------------------------------------------------------
 void setup(){

	 //init button pin to input
	 pinMode(SENSITIVITY_BUTTON_PIN, INPUT);
	 //init relay pin to output
	 pinMode(RELAY_PIN, OUTPUT);
	 digitalWrite(RELAY_PIN, LOW);
	 //initialize all LED pins to output
	 for(int i = 0; i < NUM_LED; i++){
		 pinMode(ledPins[i], OUTPUT);
	 }

	 //get current sensitivity
	 emgSaturationValue = sensitivities[lastSensitivitiesIndex];
 }



 //-----------------------------------------------------------------------------------
 //   Main loop
 //
 //   - Checks state of sesitivity button
 //   - Measure EMG
 //   - Shows EMG strength on LED bar
 //   - Turns ON or OFF the relay for TENS device
 // ----------------------------------------------------------------------------------
 void loop()
 {

	 //-----------------------  Switch sensitivity ------------------------------------

	 //check if button is pressed (HIGH)
	 if (digitalRead(SENSITIVITY_BUTTON_PIN))
	 {
			 //turn off all the LEDs in LED bar
			 for(int j = 0; j < NUM_LED; j++)
			 {
				 digitalWrite(ledPins[j], LOW);
			 }

			 //increment sensitivity index
			 lastSensitivitiesIndex++;
			 if(lastSensitivitiesIndex==NUM_LED)
			 {
				 lastSensitivitiesIndex = 0;
			 }

			 //get current sensitivity value
			 emgSaturationValue = sensitivities[lastSensitivitiesIndex];

			 //light up LED at lastSensitivitiesIndex position for visual feedback
			 digitalWrite(ledPins[lastSensitivitiesIndex], HIGH);

			 //wait user to release button
			 while (digitalRead(SENSITIVITY_BUTTON_PIN))
			 {
				 delay(10);
			 }
			 //whait a bit more so that LED light feedback is always visible
			 delay(100);
	 }


	 //-----------------------------  Measure EMG --------------------------------------

	 analogReadings = analogRead(A0);//read EMG value from analog input A0


	 //---------------------- Show EMG strength on LED ---------------------------------

	 //turn OFF all LEDs on LED bar
	 for(int j = 0; j < NUM_LED; j++)
	 {
		 digitalWrite(ledPins[j], LOW);
	 }

	 //calculate what LEDs should be turned ON on the LED bar
	 analogReadings= constrain(analogReadings, 30, emgSaturationValue);
	 ledbarHeight = map(analogReadings, 30, emgSaturationValue, 0, NUM_LED);

	 //turn ON LEDs on the LED bar
	 for(int k = 0; k < ledbarHeight; k++)
	 {
		 digitalWrite(ledPins[k], HIGH);
	 }


	 //----------------------- Turn ON/OFF relay for TENS -------------------------------

	 //Turn ON relay if EMG is greater than threshold value
	 //(threshold is expressed in LED bar height units)
	 if(ledbarHeight>RELAY_THRESHOLD)
	 {
		 digitalWrite(RELAY_PIN, HIGH);
		 delay(50);
	 }
	 else
	 {
		 digitalWrite(RELAY_PIN, LOW);
	 }
}
    

Experimental Procedure

Set Up

The Controller

  1. Plug the EMG electrode cables (RCA) into the Muscle SpikerShield, matching the red, black, and white.
  2. Place two EMG electrodes on the forearm, one on the back of the hand, and clip on the EMG cables using the alligator clips. Red and black on the forearm muscle, and the ground (white/bare metal clip) on the back of the hand.
  3. Now, have the controller flex their forearm muscles. With a sufficient strong flex, your controller should be able to light up all the LEDs. If the LEDs are not lighting up, you can:

    a) change the numberical value of the #define Threshold 3 statement in the Arduino code (using the Arduino Software) to a lower value to make the threshold lower. Note that you will then have to reupload this code to the Arduino if you want to change this value.

    b) Press the white button directly below the LEDs to change the sensitivity level to make it easier to light up the LEDs.

Now you are ready to hook up the "Controlled Human."

The Controlled
  1. First, you need to set the frequency of the TENS device. You can see we have the settings at 10 Hz frequency and we set a ~50-80 ms pulse duration.
  2. You will then need to find the threshold of your partner. Place two surface EMG electrodes across the ulnar nerve. This runs up the back of the forearm.
  3. Now connect the TENS unit to the forearm with the modified TENS cable you built.
  4. Have your partner slowly increase the amplitude of the TENS until there is a visible change of the muscle activity. You should have the male connectors connected together with the pink jumper (this uses a different kind of connector if you followed the DIY instructions). Alternatively, you could use a non-modified TENS cable for this part of the experiment. The stimulation feels like pins and needles in your muscles. It is not terribly uncomfortable but some people may not like it.
  5. Now that the TENS' level is comfortably set, plug the Tens cables male header pins into the Muscle SpikerShield Stimulator output.
  6. And you are ready to go! Now when the "Controller" human flexes their muscles, the "Controlled" human's muscles should contract as well. Enjoy your human-human-interface!

Happy hacking! Let us know what you connect your EMG signals to! Let your creative mind flow and invent.

Common Questions

We receive a lot of questions regarding this experiment, and we collect some of the most common.

  • Can you achieve more full control, like say, an entire limb? These experiment works because the ulnar nerve lies just below the surface of the skin in your forearm and elbow, and it is relatively easy to stimulate. Putting the electrodes in other places on the arm stimulates the muscles more than the nerves. While someone could place more pairs of stimulating electrodes on the arm, the movements will always appear "jerky" due to stimulation thresholds and types of muscle fibers activated.
  • Can you control another person by using your brain waves (EEG) instead of muscle electrical activity (EMG)? Some research groups have had success with analogous experiments, but the set-up is more complicated and susceptible to false positives. EMG is much easier to amplify and control things with.

    Troubleshooting

    If your device is not working, try these solutions first!

  • If the leds are not lighting up at all, and/or if you only have one blinking red light, you may have accidentally reset your arduino! If this happens, reupload your code to the device. Look under the "The Code" section above for instructions.
  • If you are having trouble getting all the LEDs to light up with your flexing, there are two options: 1) reposition the muscle electrodes - 2) lower the thresholds in the code, again, see above in the "The Code" section for help with this.

    Science Fair Project Ideas

  • This setup is only one channel, but you can stack the Muscle SpikerShields to have up to three analog input channels (and our TENs unit has two output channels!). If you have two degrees of output control and three input control signals, do you think you can cause more sophisticated movements?
  • We've noticed that some people respond at lower or higher stimulation levels than others. What factors could you measure that may affect the level of someone's response to the same level of stimulation-age? Gender? How regularly they work out? If they're tired or not?
  • What other movements do you think you could induce with the Human-Human Interface? Remember to consider the earlier warnings about safe use of a TENS unit. Some suggestions-the medial nerve (another nerve in your arm), the patellar reflex (your leg moves when the center of your knee is hit), or trying to get individual fingers to move.
  • The stimulation of the muscles with the TENS, while interesting, is not nearly as elegant and smooth as the natural movements you can make with your own volitional control. Why do you think this is? How could you compare the two in an experiment? Which do you think would be stronger-your natural movements or those induced by the huge amouont of current coming from the TENS?
  • While this is a fun neuroprosthetic demo for public and classroom demonstrations, what would it take to make this a useful device for the clinic? We make tongue-in-cheek jokes about "controlling humans" here in this experiment, but what do you think it would take to fully control movements?
  • Acknowledgements

    We heartily thank Matias Guiterrez, of the Chilean Science Company bioquimica.cl, for challenging us to build this demo for his ChileVa science outreach events we participate in.

    Finalmente: Gracias to Italo Ahumada Morasky, a Chilean artist who drew these pictures for us.