In this Instructable we will build a fun desk gadget to alert you when a new email arrives in your inbox.This Instructable is the recreation of “New-Email-Notification-Light’ by Aleator777 except the use of a breadboard is used. The materials are similar but less soldering is required due to the characteristics of a breadboard. Also the code and steps are also by him.
Step 1: Gather the Materials
Step 1: Gather Materials
(5x) 330 ohm resistor
(5x) Red LEDs
Micro USB cable
2A USB AC power supply
22 gauge wire
5mm thick cardboard
(4x) 1.5" 8/32 machine screw
(4x) 8/32 nut
(2x) 4/40 nut
(2x) .75" 4/40 machine screw
hot melt glue
Step 2: Setting Up the Raspberry Pi: Updating and Downloads
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
Note: If installing feedparser is already installed, test in the python terminal if it works. If the module is not found,
simply it had no read or write permission for group and other, and they were owned by root. This means that only the root user could access them, and so any user that tried to run a Python script that used any of these modules got an import error:So I granted read permission on the files and search permission on the subdirectories for group and other like so:
$ sudo chmod -R go+rX /usr/local/lib/python2.7/dist-packages
Step 3: Setting Up the Raspberry Pi: Python Code
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:
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.
Step 4: Set Up the Raspberry Pi: Final Touches
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
Step 5: Building the Circuit
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.
Step 6: Build the Circuit: Resistors
Place the five 3300 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. The power rail will connect all the resistor together.
Place the one 10K ohm resistor on the 1st column in and connecting to the opposing power rail.
Step 7: Build the Circuit: LEDs and MOSFET
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 rightmost pin.
Step 8: Build the Circuit: Wires
Connect the LEDs to the other power rail using green wire.
Using some of the red wires, bend them into small connecters..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.
Connect the yellow wire in the same row as the 10K resistor and the leftmost MOSFET pin.
Connect the black wire in the outer power rail closest to the MOSFET.
Connect the red wire to one of the LED anodes.
Cut the two female jumpers in half and solder one end to each of the three wires.
Cut three small lengths of electrical wire and slide them down the wires.
Step 9: Build the Frame: Design
Aleator777 designed the case for the New Email Notification light in Adobe Illustrator and cut it out on and Trotech 120 watt laser. The entire frame was cut from 1/4 inch cardboard.
For the next steps you'll need to have downloaded and cut out the attached file "mailboxComplete."
Step 10: Build the Frame: Base
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.
Step 11: Build the Frame: Stand
Slide the two stand pieces together.
Step 12: Build the Frame: Mailbox
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.
Step 13: Build the Frame: Final Assembly
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.