Building hardware is exciting because you get to interact with the “real world”. In this project you will use the LightBlue Bean to receive notifications from Facebook and Twitter (and any other sources!) and pop up a notification flag using a servo. It’s a fun, physical indicator for your Twitter mentions or Facebook messages! Best of all, you clear the notification by just putting the flag back down, just like an old-fashioned mailbox.

The LightBlue Bean is a fun little Arduino compatible platform that you interact with over Bluetooth Low Energy. It’s like a normal Arduino, but you’ll never have to plug it in–you program it wirelessly. The Bean is what we’ll use to receive the notifications and move the servo.


Project Steps

Customize your Bean

First we have to make a couple modifications to our [Bean]( to add a battery pack and servo connector. All the parts are available in the Maker Kit.

Solder the battery pack on the pins labeled BAT and GND. The Red wire goes to BAT and black to GND. This will provide the additional power needed to move the [servo](

Solder the [servo]( connector to the proto-board on the [Bean]( Note the pinout; the yellow wire from the [servo]( cable is the signal pin. It should go to the pin labeled “0” on the [Bean]( (digital IO zero). The red wire from the [servo]( is power, connect it to VCC on the [Bean]( The black wire on the [servo]( cable is ground, connect it to GND on the [Bean](

Fly your Facebook flag high

Cut out your flag from a sturdy material like foam core or cardboard.

Print out whatever icon you would like. Our graphics for the icons and dials used are available here. Or get creative and print or draw your own!

Glue the icon onto your card-stock or foam core base. You can either use rubber cement or superglue to glue the flag onto the servo arm that comes with your [servo](

Install the Bean Software

Currently you must run OS X 10.9 Mavericks to program the [Bean]( We will be releasing other platforms soon and you can track our progress [here](

[Install the Bean Software by following these directions](

Arduino Goodness

All of the code is [available on github](

Open the Sketch and hit Build. If you have [LightBlue Bean]( selected it will open the Bean Loader Application.

Connect to your Bean using the Loader App, and program the sketch.

We will use a virtual serial port to send the Facebook / Twitter notifications. Right Click on the Bean and select ‘Use for Virtual Serial’.

Get the Notifications Ready

We will use Python (an easy scripting language) to pull email notifications using the gmail module, check if the sender is Facebook or Twitter, and then send them using the pyserial module.

If you haven’t already, download the code, [available on github]( and install the gmail and pyserial modules. This is easily done by running `pip install requirements.txt` in the root directory of the repo.

I recommend creating a new [Gmail]( account to receive notifications. This prevents you from needing to store your password credentials to your main account in your Python code.

Set up Facebook and Twitter to send email notifications to your new email address. If you like, you can forward them back to your main account as well.

Run the Python code in terminal by browsing to the directory and typing `python`

Form a Servo Mount

You can use Sugru or Thermoplastic to form a nice holder for your [servo]( It should hold the [servo]( so it can be mounted securely to your monitor, or wherever you want to place it.

Which way is up

You may have to do a bit of calibration to get your Flag to sit straight up after a notification. If you send an email to your account with the subject “test”, the flag will go to it’s upright position. If that doesn’t suit your set up, you can pop off the [servo]( arm, and remount it any angle you wish. Alternatively, you can edit `FACEBOOK_SERVO_NOTIFY_POSITION` in the Arduino sketch to whatever value you want.

Get Socializin'

Alright, you’re all set! Go post this project on your Facebook page, or Tweet it, and wait for the comments to roll in. When you get a notification email, your Flag will pop up. When you want to clear the notification, just push the flag back down.

Like the [Punch Through facebook page]( and trigger a flag in our office!

The Arduino sketch disables the [servo]( after moving it into position, so you won’t hear any annoying buzzing sounds.

Go one step further!

Ready for more? We have some ideas on how to extend the project. Create a San Francisco summer weather indicator! We have one image listed to get you started. [Icon credit](

Or, add another servo to track Facebook and Twitter notifications. You could track other things like sports scores, page visits, or [earthquake activity](!