New Email Notification Light

by Aleator777 in Circuits > Raspberry Pi

80718 Views, 448 Favorites, 0 Comments

New Email Notification Light

NewMailMain.bmp


In this Instructable we will build a fun desk gadget to alert you when a new email arrives in your inbox.

New to Raspberry Pi? If this Ible is a bit over your head, or you need a quick refresher on Raspberry Pi, I recently authored a Raspberry Pi guide to help you get up to speed before you have a crack at this project!

Materials

IMG_0517.JPG

Materials:

Raspberry Pi (RadioShack #277-196)

protoboard (RadioShack #276-168)

(5x) 220 ohm resistor (RadioShack #271-1111)

(5x) white LEDs (RadioShack #276-017)

n-channel MOSFET (RadioShack #276-2072)

10K resistor (RadioShack # 271-1126)

Micro USB cable (RadioShack #26-2738)

2A USB AC power supply (RadioShack #55075817) web only

22 gauge wire (RadioShack #278-1218)

5mm thick Plywood

3mm thick Plywood

(4x) 1.5" 8/32 machine screw

(4x) 8/32 nut

(2x) 4/40 nut

(2x) .75" 4/40 machine screw

various paints

hot melt glue


Knowledge:

Read a schematic

Solder a simple circuit

Modify a program (no actual programming required)

Setting Up the Raspberry Pi: OS and Networking

IMG_0180.jpg

We'll need to configure the Raspberry Pi before we get things up and running. I'll be making several web-connected Pi projects using the Netgear Wi-Fi adapter, so I've created a brief companion guide for setting up the wireless connection and links to properly setting up the Pi. Follow along here:

Connect the Raspberry Pi to the NetGear G54/N150

Setting Up the Raspberry Pi: Updating and Downloads

IMG_0179.jpg

We'll need to download a few more things in order for Python to be able to properly check our inbox and use the GPIO.

Enter into the terminal:

sudo apt-get install python-dev

sudo apt-get install python-pip

sudo pip install feedparser

sudo easy_install -U distribute

sudo apt-get install python-rpi.gpio

Setting Up the Raspberry Pi: Python Code

300px-Python.bmp

Before we can use the device, we'll need to edit the Python code so it's linked to an email account. First, download the attached program 'elights.py' and open it up in a text editor. You can copy it over to the Pi with a flash drive, but if you're new to Python, typing it manually will help you become familiar with the syntax.

Start up the GUI on the Pi with:

startx

Once the desktop environment has loaded, open up IDLE (not IDLE 3). Once the shell starts up, create a new window under File->New. Copy or type the program into the editor. You'll need to edit two lines of the program to contain your credentials. Where the red comments point to USERNAME and PASSWORD, change the default quoted words to match your information. USERNAME will just be the part of your email address before the @.

Hit ctrl-s to save the file. Be sure to keep the name as elight.py, as it needs to be exact for the next steps to work.

Once you've properly saved the file, open up the terminal (LX terminal program on the desktop). Type in:

sudo chmod +x email_light.py

This will turn our python program into an executable.

Downloads

Set Up the Raspberry Pi: Final Touches

IMG_0298.jpg

Now that we've got the program, we'll need to have the Pi run it automatically. To do this, we'll be editing one of the initialization files so that our program will run as soon as the Pi boots up and without having to log in.

Enter the following into the terminal:

sudo nano /etc/rc.local

You'll see a bunch of commented out text (prefixed by '#') explaining the file. Skip to the end of the text and type in:

sudo python home/pi/email_light.py &

Hit 'ctrl+x' followed by 'y' to save and confirm your edited file

This will run our python program when the Pi boots up. The ampersand at the end will make it run in the background.

Safely shutdown the Pi with:

sudo shutdown -h now

Build the Circuit: Layout

EmailLEDS.bmp
IMG_0153.jpg

To illuminate our little sign, we'll be using several LEDs in parallel. Since the output pins on the Raspberry Pi can only supply a few mA of current, we'll be using a power MOSFET as a switch to power them directly from the 5V source pin. We're using the IRF510, which is an N-Channel MOSFET, so when the Pi sends a logic HIGH signal to the MOSFET will connect all of the LEDs to ground.

Build the Circuit: Resistors

IMG_0155.jpg

Place the five 220 ohm resistors spaced evenly across the board. Before clipping, bend the leads of the resistors that are towards the edge of the board so that they all connect and solder them in place.

Place the one 10K ohm resistor on the third column in and connecting to the power rail.

Build the Circuit: LEDs and MOSFET

IMG_0157.jpg
IMG_0162.jpg

Place the LEDs with the anodes towards the resistors and the cathodes on the inner power rail.

Place the MOSFET in the upper right with the 10K resistor on it's leftmost pin.

Build the Circuit: Wires and Heat Shrink

IMG_0163.jpg
IMG_0164.jpg
IMG_0166.jpg
IMG_0204.jpg
IMG_0168.jpg
IMG_0169.jpg
IMG_0201.jpg
IMG_0202.jpg
IMG_0205.jpg
IMG_0174.jpg
IMG_0171.jpg

Using some of the clipped leads of the LEDs, bend two pieces into tiny jumpers.Place one leading from the inner power rail (connected to the LEDs) to the middle pin of the MOSFET. Place the other leading from the other power rail to the rightmost pin of the MOSFET.

Cut a 10 inch length of red, yellow, and black wire.

Solder the yellow wire in the same row as the 10K resistor and the leftmost MOSFET pin.

Solder the black wire in the outer power rail closest to the MOSFET.

Solder the red wire to one of the LED anodes.

Cut three small lengths of heat shrink tubing and slide them down the wires.

Cut the two female jumpers in half and solder one end to each of the three wires.

Slide the tubing down and heat it in place for a strong connection.

Build the Frame: Design

mailboxDesign.bmp

I designed the case for the New Email Notification light in Adobe Illustrator and cut it out on and Epilog 120 watt laser. The entire frame was cut from 1/4 inch plywood.

For the next steps you'll need to have downloaded and cut out the attached file "mailboxComplete."

Downloads

Build the Frame: Base

IMG_0185.jpg
IMG_0186.jpg
IMG_0189.jpg
IMG_0223.jpg

Align the RasPi over the two offset holes in the middle of the base.

While holding the Pi in place, flip the two pieces over and slide the two 4/40 screws through the holes.

Switch to holding the screws, and then flip the board back over.

Place the nuts onto the screws and tighten.

Build the Frame: Stand

IMG_0190.jpg
IMG_0192.jpg

Slide the two stand pieces together.

Build the Frame: Mailbox

IMG_0193.jpg
IMG_0181.jpg
IMG_0183.jpg
IMG_0195.jpg
IMG_0198.jpg
IMG_0199.jpg
IMG_0203.jpg
IMG_0200.jpg
IMG_0206.jpg
IMG_0207.jpg
IMG_0208.jpg
IMG_0210.jpg
IMG_0211.jpg
IMG_0212.jpg
IMG_0216.jpg
IMG_0220.jpg
IMG_0217.jpg
IMG_0218.jpg
IMG_0219.jpg

Print and cut out the attached template for the window. The text can be easily modified to whatever you like.

Place the cut out over the inside of the window and hold it in place with a few pieces of masking tape.

Take the assembled circuit and place it along the inside of the large backside piece of the mailbox. Put a few dabs of hot glue on the back of the circuit board and place it centered, making sure not to overlap the tabs.

Fish the wires through the eyelet in the mailbox and down through the eyelet on the top baseplate.

Slide the four side panels into the slots on the bottom piece of the mailbox.

Place the top panel of the mailbox and slide it onto the tabs.

Put the square peg piece into the flag and slide it into the hole on the back of the box.

Build the Frame: Final Assembly

IMG_0222.jpg
IMG_0224.jpg
IMG_0225.jpg
IMG_0226.jpg
IMG_0227.jpg
IMG_0229.jpg
IMG_0230.jpg
IMG_0231.jpg

Turn the mailbox sideways and put the long 6/32 screws through the four holes.

Slide four wooden spacers onto each screw.

Plug the red wire into pin 2 of the RasPi GPIO headers.

Plug the black wire into pin 6.

Plug the yellow wire into pin 7.

Align the base plate with the Raspberry Pi with the four screws.

Slide the base plate onto the screws and attach the 6/32 nuts to the underside.

Plug the Lenmar USB power supply in to the wall and the micro USB into one of the ports.

Plug the other end of the micro USB into the Raspberry Pi.

Going Further

IMG_0233.jpg
IMG_0234.jpg
NewMailBack.bmp

You're done! I decided to give my box a coat of black paint, but it would look equally great in any color.

The miniature inbox notification system is functional and fun, but that doesn't mean it can't be made better!

Possible Upgrades:

Sound effects: with the addition of a small amplified speaker, it wouldn't be too much work to have the Python program play a notification chime or noise of your choosing.

Text-to-speech: maybe not for every single email, but it would be cool to hear the Raspberry Pi tell you how many emails are in your inbox, or perhaps even read them aloud!