User Tools

Site Tools


Facebook Notifier using Intel Galileo

You can easily build a device that will notify you when you have a Facebook Notification using Wyliodrin and Intel Galileo. I will show you how.

What you need?

  • one led
  • one resistance
  • some wires
  • Intel Galileo board.

We will use Python language for this application because it is perfect for what we need. So, let's create a new project in Wyliodrin and name it FacebookNotifier. Erase all the auto-generated code and start coding from scratch.

The program is split in 3 submodules:

  1. Initializing input / output ports
  2. Set the led on and off
  3. Asking Facebook for new notifications

1. Initializing input and output ports

You can interact with the Galileo's pins using the Linux sys interface. You can set pin direction (output or input) and value (high or low) using simple shell commands. More details here.

We can do anything we like with Galileo's pins by writing or reading from files so almost any programming language can be used for this task.

We said that we need a function to initialize de pins so here it is:

def pins_init(): 
// 1 
		pin_export = open("/sys/class/gpio/export","w") 
	except IOError: 
		print "GPIO already exists" 
// 2 
gpio = open("/sys/class/gpio/gpio27/direction","w") 
  1. we declared that we will use GPIO pin number 27 which is pin number 7 on Intel Galileo board. More info here about pin mapping.
  2. The pin direction is ouput because we need to write 1 when we have a notification and 0 when we have none.

2. Set the led on and off

Setting a value on a pin is as simple as writing to a file:

def write_led(value): 
	f = open("/sys/class/gpio/gpio27/value","w") 

The variable “value” we'll be 0 or 1.

3. Asking Facebook for new notifications

For this, we will use Facebook Graph. Click here.

You will need to generate an Acess Token. Click on “Get Access Token”, then “Extended Permissions” and select “manage_notification”. Using this access token you can make request at URL:

This will return you some information in JSON format. The only field that we are interested in is “summary” at the end of the JSON. When you have a new unread notification, “summary” length will not be zero.

while True:      
    r = urllib2.urlopen('') 
    html = 
    data = json.loads(html); 
    if len(data['summary']) == 0: 

Now you have your own Notifier and you will never miss a Facebook Notification again.
You can go further with this project and add a Buzzer that will make noise when you receive a new notification and an LCD that will show the latest notification.

Thank you and good luck!

projects/facebook.notifier.txt · Last modified: 2014/03/27 13:09 by bogdan.vlad