Introduction: Flappy Bird Hat

Flappy Bird is a mobile game (developed in 2013) whose goal is to have the user navigate an animated bird to fly between green pipes without hitting them. The higher the score, the more pipes the bird has passed through and the "better" the gamer has done.

Capitalizing on the fact that this game reached a high level of popularity in 2014, we designed a wearable device where kids could play this game and get their daily exercise at the same time!

If you have some (limited to beginner level) experience with Arduino, Arduino C, and bluetooth devices this should be fairly simple to make yourself.

Let's get started!!

Step 1: Acquire Parts

For the electronic components, you will need...

  • 1 Breadboard with accompanying wires as well as an XBee Breakout Board OR you will need to custom-make your own PCBs. We will talk about this in step 3.
  • 1 RN42-XV Bluetooth Module from Roving Networks
  • 1 minIMU-9 IMU from Pololu, either v2 or v3, whichever is cheaper and in stock
  • 1 Teensy 3.1
    • We soldered our own pins, therefor we used this version, without the pins
    • If you are going to use a breadboard, we suggest the use of the pre-soldred Teensy with Pins
  • If you are going to use an external battery, we suggest you order a Li-Ion battery

Non-Electrical Components Include...

  • A hat
  • You need a PC. This does not work with OSX or Linux (at least not Ubuntu 13.10)
  • You will need a rubber band
  • You will need some elastic, or some other way to secure the hat to your head.

Step 2: Connecting Your Components

Before we start this section, it is important to note that...

  • You MUST solder the pins onto the minIMU-9. Having loose pins will cause the connection to the i2c bus to fail.
  • Add the Pololu libraries for the minIMU to your install location of the Arduino software
  • Please go through the "Getting Started" steps at the PJRC Website.
    • You will need to install Teensyduino, which will install all of the necessary files that you will need to use, namely...
      • the HID profile stack
      • the Virtual Serial Driver
      • the actual Teensy software
    • We advise that you actually walk though at least a few of the example programs at the PJRC website.

Great. Lets (actually) get started!

If you are on a breadboard, follow the directions below and skip the next step. If you want to use a customized PCB, the next step will provide you with the files for getting your own PCBs made.

  • Teensy 3.3V connects to pin 1 on the Bluetooth module
  • Teensy Pin 7 (RX3) Connects to pin 2 on the Bluetooth module
  • Teensy Pin 8 (TX3) connects to pin 3 on the Bluetooth module
  • Teensy GND connects to pin 10 on the Bluetooth module

Bluetooth Module is done, time for the IMU!

  • Teensy 3.3V connects to VDD on the minIMU-9
  • Teensy GND connects to GND on the minIMU-9
  • Teensy Pin 19 (SCL) connects to SCL on the minIMU-9
  • Teensy Pin 18 (SDA) connects to SDA on the minIMU-9
  • Leave the Vdd pin on the minIMU-9 unused. If you happen to be using a power source greater than 3.3 volts, you would need to put that here. We are not, since this is connected to the Teensy's 3.3V supply pin.

If you want to use a battery...

  • Connect one leg of the JST connector to the Vin, and the other to the GND on the Teensy. You will need to look carefully at the connections coming from the battery to make sure that you do not cross your GND and Vin.
  • The JST connector does actually fit in a normal breadboard, but the connection is a bit iffy. We were able to take some stranded wire and insert it with the pins at the same time to help the connection.

Step 3: Creating a PCB

We did not originally design this on a breadboard. We actually designed all of circuit in Fritzing, an open-source circuit design software. It is interesting in that it allows for the user to auto-route and export the PCB design as a Gerber file, which can then be sent to a site such as OSH Park to be turned into a PCB. This design costs right around 20 dollars for three boards, which isn't bad considering the quality is great.


However, there were some... challenges with designing our own board.

  • The JST connector doesn't fit/ is backwards
  • The Teensy3.1 model (at the time) only had space for 12 of the 14 pins (thus we soldered our own)
  • You will need to solder your own female headers for each component you want to add if you want your components to be removable.
    • .1" Female shrouds can be found here
    • The XBee socket headers can be found here
  • Do not expect a quick turn around. These boards took somewhere around a month to get back. However, the price is quite good. The purple has also grown on us.

Step 4: Download the Code

Simply load up this file in Arduino, make sure that you have the libraries from Pololu installed, and you should be set!

However.... you may not be. Initially, our Bluetooth module was not configured to be a keyboard. Below are the steps you can use to set it as a keyboard, along with some resources.

Put the Bluetooth Module on the XBee explorer. You should be able to use a software such as CoolTerm or HyperTerm to connect to and program the Bluetooth Module. You will need to select 115200 as the baudrate. Press enter after every command, you should get AOK back.

$$$ //should put you in command mode

SM, 4 //Set Auto-connect mode

SA, 4 //Set the authentication mode

GH //Should return 0200

SN, <what you want to name it> //Our is called Flappy Hat, don't include the <> signs.

S~, 6 //Changes to HID mode, ie makes it a keyboard

--- //exit command mode

You should be set. Plug it back into your breadboard/ PCB and you should be set.

The Arduino C code is easily downloadable below. If it looks a little too simple, don't worry, it is!

Useful Resources:

If you think of yourself as a beginner with Teensy or Bluetooth devices and connections, you may want to familiarize yourself with the background of their I/O before putting this system together. In particular we suggest...

If you are still having problems, make sure that you connected your RX and TX pins correctly. Also, make sure that the Bluetooth Module maches the shape of the house on the board.

Step 5: Creating Your Wearable

Now if you're confident that the code is uploaded to your system, it's time to integrate it with the physical system. We used a rubber band to secure all the parts (they can be a little finicky when jumping).

If you purchased the hat shown here, the inside seam opens easily and the board can be placed inside. If you went with a different hat, simply create a small sewable pocket or tape it on the inner side. You will want to place it somewhere where its fairly easily to remove due to the battery.

Creating the strap: The easiest way to create a strap is to re-use a bike helmet strap (an old backpack strap will also work but will most likely need to be trimmed if it's too long). With a needle and thread, sow each end of the strap into the inside of the hat.

Step 6: Time to Try It Out!!

  1. Click on this link: http://ellisonleao.github.io/clumsy-bird/ to visualize the flappy bird game.
  2. To connect the Bluetooth device, you may have to install the Bluetooth driver on your PC and sync it. It will not connect the first 2 times, but it will on the third. This is because Windows wants you to type in a password on the keyboard to authenticate. However, this is a hat, not a keyboard, and therefor can not type numbers! Instead, on the third try, Windows will let you put in a pin number. By default, this pin number is 1234, and just needs to be typed into your normal keyboard to authenticate the hat.
  3. Put the hat on, make sure the strap is secure, and start jumping!!

Below is a video of our team trying it out.

Safety Tips:

  • Make sure an 8 X 8 space is cleared. Jumping can actually get pretty vigorous and it's much better to be safe than sorry. We may or may not have seriously injured ourselves and knocked over a table.
  • You will get sweaty. Yes, we know its "just" flappy bird, but the truth is that jumping is great exercise. Wear something that you can get sweaty in.

Step 7: Further Ideas to Try

We had two main ideas that this project could be extended to: 

1.  Wearable Extension: Instead of a hat, you could also make this into a full costume. (Link: http://www.amazon.com/Child-Length-Costume-Accessory-Parrot/dp/B005E0LB4A) 

             Since we had some problems with being able to jump fast and coordinating the bluetooth delay (as mentioned before), a wing                costume may give you better results. When we tried our system independently of the hat, we were able to get further along in                  the game--which would make it both more fun and give you more exercise. 

2.  Conceptual Extension:  This could perhaps be combined or used with other popular mobile games today such as Pacman and 2048. (essentially all movements are transferred through the accelerometer). An interesting new creative idea that just recently surfaced only last week, was a game that combined Flappy Hat and 2048--called Flappy48.  To see a demo of it, click here: http://techcrunch.com/2014/04/23/meet-flappy48-the-clone-game-to-end-clone-games/ 

Arduino Contest

Participated in the
Arduino Contest

Sensors Contest

Participated in the
Sensors Contest

Gadget Hacking and Accessories Contest

Participated in the
Gadget Hacking and Accessories Contest