Picture of USB Biofeedback Game Controller
Building upon our last tutorial, which taught you how to build a muscle sensor, we've decided to give you a project that really showcases the power of our muscle (EMG) sensors. Advancer Technologies’ “USB Biofeedback Game Controller” harnesses the power of electromyography to allow players to directly control video games with their muscles. At the core of this plug-in-play controller is the powerful yet low-cost Arduino UNO microcontroller, a favorite among hobbyist and students, acting as a HID keyboard interface. Integrated with the Arduino UNO are four of our Muscle (EMG) Sensors, allowing four muscles to act independently or in combination with each other to control over four buttons. In our setup, we elected to use a six button setup with the left forearm controlling the B button (RUN/ATTACK), the right forearm controlling the A button (JUMP), the left bicep controlling the LEFT button, the right bicep controlling the RIGHT button, and combinations for UP and DOWN.

This tutorial will teach you to build a USB Biofeedback Game Controller. Use it to play any computer game (that uses keyboard inputs) using your muscles as the controller.

Check out our previous Instructable to learn how to build your own Muscle Sensor


Drop by our webstore to purchase muscle sensors, kits, cables and electrodes
Muscle Sensor Kit (now also on SparkFun)
Muscle Sensor Electrodes

Note: This sensor is not intended for use in the diagnosis of disease or other conditions, or in the cure, mitigation treatment, or prevention of disease, in a man or other animals.

About Advancer Technologies
Advancer Technologies is a company devoted to developing innovative game-changing biomedical and biomechanical technologies and applied sciences. Additionally, Advancer Technologies promotes all forms of interest and learning into biomedical technologies. To help cultivate and educate future great minds and concepts in the field, they frequently post informative instructions on some of their technologies. For more information, please visit www.AdvancerTechnologies.com .
WilliamW242 months ago
I have arduino Leonardo setup to send keypresses to my laptop via keyboard.print () and Serial.println() and it works perfectly but it doesn't work to control emulator. it allows me to assign controls with Leonardo but doesn't let me actually play the game with it.
epraveenns5 months ago

that power supply kit you have indicated is not available. is it possible to run a muscle sensor using a single battery?

ArifB6 months ago

Great idea, amazing. I am wondering if it possible to make a game controller for mobile application using arduino platform? I am thinking about the combination between google cardboard and game controller using arduino.


java.lang.ArrayIndexOutOfBoundsException: 1

just replace the:

String V3 = Serial.list()[1];

String V3 = Serial.list()[0];

Just found out!
wan xi2 years ago
hello,,im having problem with Processing sketch.when i hit the Run button the window don't pop up.It show error..it said java.lang.ArrayIndexOutOfBoundsException: 1...WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Exception in thread "main" java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1
at processing.core.PApplet.runSketch(Unknown Source)
at processing.core.PApplet.main(Unknown Source)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
at sketch_apr11a.(sketch_apr11a.java:55)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at java.lang.Class.newInstance0(Class.java:355)
at java.lang.Class.newInstance(Class.java:308)
... 2 more

...can help me.I am new with this software....
wan xi2 years ago
hello,,im having problem with Processing sketch.when i hit the Run button the window don't pop up.It show error..it said java.lang.ArrayIndexOutOfBoundsException: 1......can help me.I am new with this software
lovetronic2 years ago
when i try to run the code in processing software, it replies me "serial does not run in 64-bit mode". i'm still new in this software. please help me.
elzurdo863 years ago
Hi , I got it to funciton but only until the third phase, the fourth one is still not working. I will post my advance later today to show you what im doing to see if you can give me a hand, also I was trying to upload the NES EMG files but it does not let me it shows as a pde and it has problems with a boolean type of variable. It seems like it is a processing sketch not an Arduino one. Also I was checking the steps to updgrade the firmware. Is it mandatory to do it? by doing that would I be able to upload the .pde file to the arduino?

I will wait for your reply. Thanks
Gundanium (author)  elzurdo863 years ago

What version of Arduino's software are you using? This sketch won't work for the new release, v1.0. They moved some header files around. If I find time, I'll work on updating the sketches.

.pde was used by previous arduino files as well as processing files.

I'm not sure I understand what you are talking about in regards to the firmware.
I-m using the Arduino UNO R3 which is different than the one in the link you posted. I haven't tried to update the firmware in this one since the pictures in the link does not match with the one that I have.
Gundanium (author)  elzurdo863 years ago
Are you talking about the Arduino hardware firmware? You shouldn't have to update the hardware firmware.

The Arduino development software has changed since I posted these instructions. The hardware firmware should be the same.
So basically I just have to update the sketch for the Arduino and I should be good to go?. How do I set up the keyboard to play the nes game? . Is a special game? or can I download any NES emulator?
mahfatouh3 years ago
i downloaded the ardiuno code and when i am about to upload the code to the mcu in the verification , it gives me errors and the code cannot be upoaded. please help
elzurdo863 years ago
Hello, I'm trying to get this project going, but I'm not able to get anything from the sensors, I made this one with the arduino UNO, and I noticed that the one you have was perhaps a duemilanove? , I tried to compile and Arduino displayed the message, BYTE keyword no longer supported , instead use Serial.write. I changed all of the commands and the program didn't show any mistakes but after uploading everything to Arduino nothing happened. Can you give me a hand with this?
Gundanium (author)  elzurdo863 years ago
I've updated the Arduino and Processing code used to visualize the sensor output with the new Arduino code base. Let me know if you have any problems with it.
Gundanium (author)  elzurdo863 years ago
Nope the one I used was an UNO. They've updated the code syntax since this instructable was posted. From my quick google search, it looks like you were on the right track with replacing all .print with .write.


I'll update the code when i can find some time.

You might want to look into grabbing an oscilloscope to debug your circuits. This is the first tool I always use prior to hooking things up to a MCU.
Yes That is what I'm thinking. I will look for one and then post my results, hopefully I solved the problem . I'm pretty far away to buy another one :p
I had anorhter question , would it matter if I'm only using 1 EMG sensor for the processing sketch?

Gundanium (author)  elzurdo863 years ago
No it shouldn't matter. You might want to ground the unused analog pins on your Arduino tho. Their values will float otherwise.
ALEXANDER_F3 years ago
Wonderful idear ! But I beg one thing ,I can not downioad the zipped Arduino project in the step 13 ,is there any lovely one can mail me the zipped Arduino project ? My E-mail address : yinshi438788349@126.com .Thank you very much.
epicnoobpwn3 years ago
Or you could grow big muscles, wrap arm straps around your biceps and flex to press switch. That would be a lot easier. I'm just saying.
elzurdo863 years ago
Great!, I'm actually starting to study Biofeedback as well, I just have a question about the noise that the circuits may get, is that a lot? or the circuit is designed to leave that aside.
Greetings from Mexico
ARIrish3 years ago
Finally I have a real reason to want to build up my weak and feeble arms...
13thvulture3 years ago
that is pretty cool, but does it actually provide some kind of workout, or is it just for fun?
Cool :-)
NES Kinect! Seems like my arms would get tired after hours of Mario Bros. action.
asocial3 years ago