Neuroscience for Everyone!

Experiment: Control Machines with your Brain

Now that you have your EMG Signal, can you use it to drive another system? Neural Engineering continues, using the popular Arduino microcontroller.

Time
30 minutes

Difficulty
Intermediate

What will you learn?

Here you will learn how to interface an Muscle SpikerShield with external hardware. This is continuation of our Neuroprosthetics Experiment; only now, you will use an EMG Signal from a muscle of choice, paired with an Arduino Microcontroller, to control a bank of LED lights with this Brain-Arduino interface!.

Prerequisite Labs

Equipment

Background

In the Muscle SpikerBox experiment we learned about how motor neurons activate muscles with electrical signals, and we learned how to record that electrical activity using the BYB Spike Recorder App. These EMG signals are powerful tools for doctors and scientists who study human physiology, but they are also powerful tools for us biohackers! By using our EMG signals as an input, we can begin to create human-machine interfaces.

The Muscle SpikerShield has all the same functionality of the Muscle SpikerBox, but it is also designed to pair with an Arduino Uno board. What is this 'Arduino,' you may ask? An Arduino is a microcontroller. Microcontrollers are simple devices at heart: they take input signals, execute custom code to interpret those signals, and then use that information and those commands to control other devices. A famous example of a microcontroller project is an automatic cat feeder. A sensor first measures the weight of food in the bowl (the input). Then the microcontroller reads that information and, if the weight of the food in the bowl is under a certain threshold, commands the food hopper to pour more food in the bowl.

Now that we've fed the cat, let's get back to business with the Muscle SpikerShield. The SpikerShield allows you to record your muscle's electrical activity and send it into the arduino. It's important to note here that our EMG signal begins as an analog (continuously varying). The analog signal is what you hear and see on the Spike Recorder App when you're recording your EMG. In order to use that signal in our Arduino code, we convert the analogue signal into a digital signal, breaking it up into a series of discrete numbers, making it easier to understand the signal and plug it into our code.

So, to recap, The SpikerShield allows you to record your muscle's electrical activity and send it into the arduino, which can then analyze this information and use it as an input to control Human-Machine Interfaces! Your muscles can now control neuroprosthetics (like a robot arm), video games, or even, as we're about to see... LEDs!

Procedure

Let's get started! If you purchased the SpikerShield Bundle, everything is ready to go out of the box! But, for the sake of learning, let's say you're starting from scratch. This experiment will guide you through setting up and programming the arduino.

First, mate the Muscle SpikerShield on top of the Arduino, aligning all the pins on the shield to the female headers on the Arduino. In this experiment we are using the first Analog input (A0), so be sure to jumper the input select to 1. Note: your Arduino can run on an external USB power source or the included battery leash once your code has been uploaded, but you need to use your computer to upload your code and to view the serial monitor. Plug it in to your computer now!

Then connect the orange electrode cable wire from the Muscle SpikerShield to some electrodes on your arms. Hook the two red clips onto your arm and place the black one on the back of your wrist. You can also plug in a speaker to hear your muscle activity alongside the visual outputs!

Open the Arduino serial monitor from the IDE to check the values. The values on the left are our digitized inputs. The values on the right are the number of LEDs which will light up at that signal strength! If you get larger values when you flex your muscles, and values near zero when you don't, then everything is working ok! If not, make sure all cables are connected correctly and nothing is loose. You may find connecting a portable speaker to the Muscle SpikerShield, as we do in the video above, to be helpful so you can hear your muscle activity as well.

If you didn't notice already, you're controlling the LEDs on the SpikerShield with your muscles! You should see the LEDs light up according to how hard you flex! If you feel the LEDs don't light up proportionately to your arm strength, you can adjust the sensitivity with the white button on the shield. You can also tweak the MAX constant from 4 to another value until the represented value is proportional to your strength. If the electrodes light up really easily, increase this value - if you are having a hard time making all the electrodes light up, lower it!

Your SpikerShield can also run on an external USB battery or our included 9v Battery Leash. Be sure you're plugging the battery into the barrel jack on the Arduino and not the SpikerShield. The barrel jack on the shield is to supply power to our next experiment... the Claw!

Finally, if your SpikerShield came as part of a kit (Such as the HHI or Claw Bundle), then you will want to upload code onto it which will allow the Claw and the Human-to-Human-Interface to run. HHIClawCombined.ino

Other Experiments

Now that you've got the basics covered, check out some of our other Human-Machine-Interface experiments!

This is just the first step into your new world of EMG Arduino design. Happy hacking! Let us know what you connect your EMG signals to! Let your creative mind flow and invent.

Science Fair Project Ideas

There are lots of potential devices you can interface with using the Muscle SpikerShield-what are some devices that you think would be interesting to control? Can you set up a gripper or a motor so that their strength/speed correspond to how much you're flexing? Can you get this to turn on something that delivers more force than you can?

The LEDs provide a way of showing if your muscle contraction has surpassed a certain threshold. How long can someone keep the last red LED on? How does the number of lights on correspond to the signal shown on the Spike Recorder App? Are different muscles more or less able to get all the LEDs on?

Most of what we've discussed so far are analog devices-basic motors, grippers, LEDs. As a more advanced project, can you interface and control any digital programs or devices? Can you get it to work with any other apps?