Muscle Powered Flappy Bird

1,371

13

2

Introduction: Muscle Powered Flappy Bird

You might remember when Flappy Bird took the world by storm, eventually becoming so popular the creator removed it from app stores to avoid unwanted publicity. This is Flappy Bird like you’ve never seen before; by combining a few off the shelf components you can control the eponymous Flappy Bird directly from your muscles with the power of electromyography (EMG).

If you’re interested in getting flapping with EMG, please come join our Discord and our Forum. We’d love to hear from you and we’re always around to help out if you run into issues.

Supplies

Here's everything you're going to need:

The next item is optional. The MyoWare warns against powering directly from an outlet, so you have two options: first, you can run the game on a laptop and disconnect the charger or you can run it off a battery. The nrf52840's battery connector is wired backward, so you will also have to resolder your battery's terminals which can be difficult if you don't have much experience soldering.

Step 1: Solder on the Headers

First let’s attach those headers. Even though we aren’t using all the pins on the nrf52840 breakout board it’s still easiest to solder the header into every pin. Refer to the pictures if the description is not clear enough about what goes where.

On one side of the board attach a header from VIN down to pin 2, and on the other side attach a 2 pin header on 17 and 15 and another header from pin 19 to 10.

Next we want to attach a header to your MyoWare. Place a 3 pin header on the +, -, and sig pins.

Before you turn off your soldering iron it is a good idea to double-check any soldered pins that look like they are too close to each other (as well as double-checking ground and power). You can do this by using the continuity checker option on your digital multimeter, and if you're unsure which option that is just check the labeled photo at the top of this step. Place one lead on each pin you want to test, and if you don't hear a beep you don't have to worry. If you do hear a beep, you'll want to touch up that connection to make sure the pins are no longer bridged before moving on to the next step.


Once you're done, feel free to turn off your soldering iron.

Step 2: Connect the Boards

Following the schematic and pictures, connect your components together. You should have three connections: + to VCC (power), - to GND (ground), and SIG to pin 4 (AIN2). The nrf52840 should live on a breadboard, and the MyoWare can just be left free-floating. Make sure to give the MyoWare a healthy amount of wire so that you can move it around easily. After all, it’s going to be living on your arm soon.

Step 3: Install the Necessary Software

You're going to need a couple of different software packages to make everything work. You may already have some of these installed, so just download what you need.

Step 4: Find the Right Serial Port

First, plug your board into your computer. To put software onto the nrf52840 you need to double-tap the RST button near the micro USB port. If the blue light is blinking quickly then you're ready to go. You also should have gotten a pop-up on your computer indicating you've plugged in a USB device.

Before we put firmware on the device, we need to determine which port your breakout board has been assigned, and the way we do this is platform dependent. You may already have a preferred way of doing this, and if that's the case feel free to move to the next step.

Windows

Open the device manager and look for USB Serial Device under ports. For example, in the attached photo the device is on COM3.

Mac

Open the terminal, and run `ls /dev/tty.*` and you should see the device as one of the options. If you can't tell which it is, try unplugging your board. Then run the command again and take note of which device is no longer listed, this should be the breakout board.

Ubuntu/Debian

Open the terminal and run `ls /dev/tty*`. One of these devices will be what you need, and it will likely follow one of two naming conventions: /dev/ttyS# or /dev/ttyACM#. If it's ambiguous which is your device, try unplugging it and rerunning the command to spot the difference.

Step 5: Flash the Firmware

Navigate into the folder with the firmware binary (likely named flappy-bird-demo), and run `adafruit-nrfutil --verbose dfu serial --package dfu-package.zip -p SERIAL_PORT -b 115200 --singlebank --touch 1200`. Make sure to replace SERIAL_PORT with the port you discovered in the previous step. If successful, you should see something similar to the image above, and the blinking should cease.

Step 6: Confirm That Everything Was Installed Correctly

If everything has worked thus far, this step should breeze by! Make sure that you are in the flappy-bird-demo directory, and run `python3 flappy.py`. After a short Bluetooth Low Energy connection process, you should be greeted with a wave of nostalgia.

Flappy Bird! However, we haven't completely set up the control system yet so even if you start the game you won't have any control over the flapping. Close the game for now and unplug the power cable from your board.

Step 7: Attach the EMG Electrodes

Now it's time for the part that makes this version of Flappy Bird unique: the muscle control. Right now, the only affordable option is gel electrodes, so gather 3 of them. In the example here, the 3M electrodes are a little large, so we cut one of them across the long edge so it matches the photo. Lining the cut up with the label should yield the right size.

Once they're the right size, place two of them in line on the inside of your arm above the elbow (as pictured). Then attach the MyoWare to your arm, attaching an electrode to the black dangling connector and pressing that on a bony area on your arm (also as pictured).

Step 8: Play Flappy Bird 2.0 (Seriously This Time)

Time to get Flappy! Now that the MyoWare is on your arm, make sure you have access to a non-outlet power source (either unplug your laptop or ready your battery), and power on your nrf52840 breakout board. If your MyoWare doesn't light up, make sure it is also powered on using the switch indicated in the picture.

Now you can relaunch Flappy Bird as you did before, `python3 flappy.py` and after a connection process, you will once again see the Flappy Bird launch screen. You'll need to click once on the screen to start the game, but you should now be able to squeeze your fist to flap, and then continue to squeeze your fist to jump and dodge the pipes.

Once you have it working, we'd love it if you posted some high scores (or feedback) on our forum or Discord. We're around in case you need help getting things working.

Step 9: Enjoy!

Hopefully, you enjoyed this tutorial and were able to get everything working successfully. We're working hard to build even cooler projects with this tech, and hopefully even cooler Instructables! Learn more on our website.

If you're running into trouble or frustration, no worries! We ran into our fair share of issues making it as well, so please don't hesitate to reach out to us and we're happy to spend some time helping get your muscles hooked up to your computer. You can either post a comment on the instructable, join us on Discord, post in our forum, or email us directly at hello@getfantm.com.


Thanks!

Be the First to Share

    Recommendations

    • New Year, New Skill Student Design Challenge

      New Year, New Skill Student Design Challenge
    • Raspberry Pi Contest

      Raspberry Pi Contest
    • One Board Contest

      One Board Contest

    2 Comments

    0
    randofo
    randofo

    1 year ago

    Cool EMG project! Thanks for sharing.

    0
    fantm
    fantm

    Reply 1 year ago

    Thanks! We hope to have more along similar lines soon.