Introduction: Raspberry Pi Medal Light

You love the Olympics but you don't have time to check if your country has won any medals. Using IFTTT and Ledborg on the Raspberry Pi, you can know get notified of any medal just by looking at your Pi (and then tell the whole world how proud you are) !

Step 1: The Parts

This project obviously requires a Raspberry Pi. I used the popular Ledborg as my light source, a cheap RGB LED add-on for the Pi, which also makes controlling it in Python really easy. You will also need to have a Gmail account and a IFTTT account, as those will alert the Raspberry Pi of any new medal.

Step 2: Installing the Raspberry Pi

Plugging the Ledborg in the Raspberry Pi is really easy. Just insert it on the GPIO pins, making sure that the Ledborg is not extending outside the frame of the Raspberry Pi, but rather inside. Plug your Pi, connect it to the internet, and either SSH into it or open a console window.

To install Ledborg software, enter these lines:
mkdir ~/ledborg-setup
cd ~/ledborg-setup
wget -O setup.zip http://www.piborg.org/downloads/ledborg/raspbian-2014-01-07-rev2.zip
unzip setup.zip
chmod +x install.sh
./install.sh

Step 3: The Code

The code is adapted from this post: http://talktech.info/2013/03/05/raspberrypi-plus-ledborg-plus-ifttt-com-fun-with-lights/

From the console window enter the following commands:

wget https://googledrive.com/host/0By6W2xwV2whWeDdWZjFPRWdqcTA/medal.py
chmod +x medal.py
nano medal.py


You should then be greeted with the nano screen. Just change youremail@gmail.com and password to your Gmail credential.
Press CTRL + X then y then Enter

To check if everything worked, just write sudo ./medal.py.

If you get an error, you may need to install python dependencies or check your email adress:

To install Python:
sudo apt-get install python
sudo apt-get install python-dev

sudo apt-get install python-setuptools
sudo apt-get install python-pip

sudo easy_install -U distribute
sudo pip install email


Next we need to run this code periodically
Write the following lines to have your Pi check for medals every 5 minutes:
sudo crontab -e
and add this line before saving: 
/5 * * * * sudo /path/to/medal.py

Phew, that was a lot of writing :)

Step 4: IFTTT

Go to https://ifttt.com and login/signup.

Press the Create a recipe button
Press this
Then press ESPN Olympics
Choose trigger New Olympic medal by country
Choose your favorite country
Press that
Then press Gmail and trigger Send email
Choose your Gmail adress
Press the plus sign by the Subject entry and select Summary
Save

Step 5: You're Done!

To check if the system works, either wait for your country to win a medal :) or send yourself an email with Gold, Silver or Bronze as a subject. If you have done things correctly, the LED should light up. To dismiss the light, just send an email with seen as a subject. That's it ! May your country have luck at the Olympics!

Makerlympics Contest

Participated in the
Makerlympics Contest