Build an LED Indicator with a Raspberry Pi (for Email, Weather, or Anything)

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 1

The Raspberry Pi makes a nice compact platform to attach an indicator light to for all sorts of projects—weather notification, new emails, etc. Read on as we show you how to hook up an LED module to your Pi and set up some basic notifications.

Why Do I Want to Do This?

Because it’s fun. Unlike many of our tutorials where we include a little blurb at the top outlining exactly what benefit you’ll derive from the project, the blurb is pretty short in this case because the benefit is simply having fun.

The Raspberry Pi is a perfect device to play around with, experiment with electronics, and learn some programming. Nobody needs an ambient rain indicator in their kitchen, for example, but building one is a fun exercise and a great reminder to bring your umbrella with you on potentially storm days.

What Do I Need?

To follow along with out tutorial you’ll need a few things. First, we assume that you’ve already followed our previous tutorial: The HTG Guide to Getting Started with Raspberry Pi (and thus have a the basics covered up to installing Rasbian on our Raspberry Pi).

If you’re looking to do this project on a budget, we can confidently tell you that the newest model Raspberry Pi is significant overkill for the job and we’d encourage you to blow the dust off an old Raspberry Pi you’ve got shoved in the closet or pick up a cheap used one off eBay or the like. Budget wise the long-in-the-tooth a Raspberry Pi 1 Model A  or Model B snagged off eBay for $10-15 is a perfect fit for this project over purchasing a brand new $35 current generation Pi.

In addition to having a functional Pi unit with Raspbian installed on it you’ll need the following things:

  • 1 LedBorg module (~$5.00 with $4 shipping from the UK to US, works with all Raspberry Pi models).
  • 1 Clear Raspberry Pi Case compatible with your particular Pi model like this Raspberry Pi 1 Model B case.

Note: The clear/frosted Pi case is entirely optional but if you’re currently using an opaque case then your LED indicator will be hidden inside. You’ll either need to cut a hole in your case to let the light out or use a GPIO extension cable with a breakout kit—like this one from Adafruit Industries—to tether the LedBorg to your Raspberry Pi. While using the breakout cable adds about $8 to the expense of the project it does offer more potential for customizing the end product in that you can more easily place the LED inside things or under something you want to illuminate.

Installing the LedBorg

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 2

While you could certainly build yourself a completely-from-scratch LED indicator (and a search engine inquiry will turn up plenty of people who have done so) the Piborg organization produces such a compact and inexpensive LED module, the LedBorg, that we couldn’t resist using it as the basis for our Raspberry Pi LED indicator project.

Installing the module is a snap as it’s designed to fit directly over the GPIO pins on the Pi. First, power down your Pi and open the case.

The most important part of the installation process is that you orient the module so that the LedBorg icon is closest to the RCA module on the Raspberry Pi board (and thus the edge of the LedBorg is flush with the edges of the Pi board with the overhanging portion of the LedBorg hanging over the Pi board and not off the edge). See the photograph above.

While you have the Pi board open, now would be an excellent time to cover the on-board LED indicators (next to the USB ports), especially if you’re using a clear case. You don’t want it to be confusing to read your LedBorg indicator because the power and network indicator lights are so bright.

We covered ours with a layer of white electrical tape. This dimmed them enough so that we could still reference them but they were so much dimmer than the LedBorg it was no longer distracting.

Once you have the LedBorg installed and have, optionally, covered the Pi’s LED indicators with electrical tape, it’s time to close the case back up. Boot your Pi up before moving onto the next phase of the tutorial.

Installing the LedBorg Software

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 3

PiBorg provides a great software package for the LedBorg that includes both a GUI controller as well as drivers to access the LedBorg from the command line.

Before we get started you need to make sure you’re grabbing the right package for your version of Rasbian and the revision # of your Raspberry Pi board.

If your Raspberry Pi board has no mounting holes, it is Revision 1. If your Raspberry Pi has mounting holes (located by the USB ports and between the power and HDMI port) then it is Revision 2. You also need to know the kernel version of your Rasbian installation. Open up the terminal and enter the following command to check:

uname -r

Once you have the Revision number and the kernel number, you can visit the Packages section here to grab the link for your package. In our case we’re using a Revision 1 board with the 3.6.11 kernel so we would grab the raspbian-2013-02-09-rev1.zip file.

In order to install all the goodies we need to open up the terminal on the Pi.  and then input the following commands to install the LedBorg package.

Note: You must replace the URL in the third command with the URL of the package for your board/kernel combination.

mkdir ~/ledborg-setup
cd ~/ledborg-setup
wget -O setup.zip http://www.piborg.org/downloads/ledborg/raspbian-2013-02-09-rev1.zip
unzip setup.zip
chmod +x install.sh
./install.sh

At this point you now have the GUI wrapper for the LedBorg drivers and the drivers themselves installed. On your Raspbian desktop you’ll see an icon for the GUI wrapper:

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 4

Go ahead and click on the LedBorg icon to launch the GUI wrapper. You will be treated to the color picker interface like so:

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 5

Now is the perfect time to make sure your module is functional. Pick any color, save for black, to try it out. We are going to test it by picking a few colors:

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 6

Looks good! It’s bright and the frosted plastic of the case we ordered for the project offers moderate diffusion. If you want to play with the LED module more before moving on, click Demo Mode:

build-an-led-indicator-with-a-raspberry-pi-for-email-weather-or-anything photo 7

In demo mode you can cycle through all the colors at various speeds, check out the high/low output, and otherwise put the LED module through the paces.

It’s here in the Demo Mode section that you can also turn your LedBorg into the first of many indicators. By selecting CPU in the Colours section the LED will begin changing from green to yellow to red to indicate load on the Raspberry Pi’s ARM processor. We suggest changing the Speed to Slow while you’re at it—Fast updates the LED too quickly and makes the CPU indicator distracting instead of useful.

In addition to using the GUI interface to select colors you can pick colors from the terminal using RGB values. Open up the terminal and enter the following command to turn the LED off:

echo "000" > /dev/ledborg

The way the LedBorg handles RGB values is that 0 means the channel is off, 1 means the channel is half power, and 2 means the channel is full power. So for example 001 would set the Red channel at 0%, the Green channel at 0% and the Blue channel at 50% power.

Change the value to 002 and the LED output remains blue but becomes brighter because the Blue channel is now at 100% output. Change the value to 202 and the Red and Blue at full power combine to make a magenta color.

Now that we know how to manipulate the LED manually, let’s look at using scripts to turn our LED from a simple light to an actual indicator.

Continue reading to see how to setup a rain indicator, Gmail checker, and more.

Article Build an LED Indicator with a Raspberry Pi (for Email, Weather, or Anything) compiled by Original article here

More stories

How to Save Big Money on PC Games

Thanks to the frequent sales, PC games just cost less than console games. If you’re patient and know the tricks, you can save quite a bit of money. Almost every game seems to regularly go on sale.

How to Upgrade from Windows 7 or 8 to Windows 10 (Right Now)

You’re not interested in a clean install, you don’t want to fuss with wiping your computer, you just want to take the plunge and upgrade to Windows 10. It might be a relatively straight forward process, but it’s always useful to bring a guide. Read on as we walk you through the upgrade process.

How to Restore In-App Purchases on an iPhone or iPad

This only applies to purchases you make within apps. If you purchased a paid app from the App Store, you can just revisit the App Store and reinstall the app. As long as you’re signed in with the same Apple ID you purchased the app with, you’ll be able to install it again on any device.

Remote Desktop Roundup: TeamViewer vs. Splashtop vs. Windows RDP

There are a plethora of remote desktop solutions on the market, and it can be tricky to pick the right one for your needs. Don’t worry though, we’ve done the legwork for you, cataloging and comparing the most popular remote desktop solutions so you can easily pick the right one.

Make Your Own Windows 8 Start Button with Zero Memory Usage

After using Windows 8 for a while, I’ve come to the conclusion that removing the Start button from the Taskbar was a huge mistake. Here’s how to make your own “Start” button that brings up the Metro Start screen—but doesn’t waste any memory at all.

What Are “ZigBee” and “Z-Wave” Smarthome Products?

As you research new smarthome products to put in your home of the future, you’ll come across a lot of terms and categories that seem completely foreign. At the top of the list: “ZigBee” and “Z-Wave” products. What does this mean, and what’s the difference between the two?

Beginner Geek: How to Use Bookmarklets on Any Device

Web browser bookmarklets allow you to perform actions on the current page with just a click or tap. They’re a lightweight alternative to browser extensions. They even work on mobile browsers that don’t support traditional extensions.