loading
The idea behind the eMail Light project is to indicate the presence of emails that are currently on my email server with a flashing LED. I am often not right at my desk and I would like to know if I have email. Or I am near my desk, but my screen saver has kicked in while I’m working on something that doesn’t involve a constant mouse wiggle. By making a little black box with LEDs that can be controlled by USB through a mail monitoring program, I can be alerted to the presence of email on my server.

Step 1: Mail Light Parts

The eMail Light hardware will be made from:
  • a USBmicro U421 USB interface
  • a ULN2803 driver
  • a bit of circuit board
  • 8 LEDs
  • 8 330 ohm resistors
  • a small plastic box
  • 8 LED mounting rings (optional)
  • wire-wrap wire for point-to-point circuit connections
  • a small 4-40 machine screw
  • an aluminum bar
  • solder, solder flux
Sources: http://www.circuitgizmos.com (first 5 parts), RadioShack (box), hardware store.

Various tools are appropriate and include (but are not limited to):
  • a screwdriver
  • a nutdriver (for the connection to the back of the monitor)
  • a soldering iron
  • a 4-40 tap (if you tap the bar - optionally use a nut)
  • a vise with a brake for bending
  • drill and bits for plastic box holes and hole in bar
  • flush cutter
You might notice in one of the pictures that I used a micro bar clamp. Not absolutely necessary, but convenient.

Step 2: Plastic Box

I chose a small plastic box with a black finish. Four LEDs will be mounted on one side visible from my position seated at my desk. These LEDs are bright, but not blindingly so. On the other side of this box are four very bright LEDs. These bright LEDs will be visible from my lab. I will be able to just glance into my office and see if I have email.

Step 3: Inside of Box

The inside of the box has enough room for the U421 and other parts. There will be a slot for the USB cable to exit the box. Eight 1/4″ holes will be drilled for the LEDs. The inside of the box has a little bit of extra plastic in the way.

Step 4: Altering the Plastic Box

I removed the extra plastic with the same tool I use to flush-cut component leads (flush cutter, or wire snip) on soldered boards. Then I removed the bits of plastic that remained with a small chisel.

The idea is to get that bit of plastic out of the way. Snipping it off was rough, but worked well. The the rough remainder was carefully sliced away.

Step 5: Drilling Holes

Each side of the box will have four LEDs. I drilled four pilot holes for the LEDs. After that I enlarged the holes to be one quarter inch to accommodate the LEDs in their mounting rings.

Mounting rings are optional. The LED's holes can be sized right to work without the rings.

Step 6: Printed Circuit Board (PCB)

I used the type of printed circuit board for this project that I frequently use for prototyping things. This board is a grid of holes spaced .1″ apart.

Step 7: Cleaning the PCB Copper

On the bottom of the board are isolated copper rings – donuts. The copper should be cleaned until shiny. I used a metal brush and scrubbed in two or three directions until the copper is shiny. Then I coated the copper with liquid flux and applied solder to completely cover the exposed copper.

Step 8: Cut the PCB to Fit

Before applying solder, I cut the board to fit the little box. To cut, you can score the printed circuit board with a knife, and snap the board. Some cleanup with a file might be considered.

Step 9: Adding Components

The USBmicro U421 USB interface can drive one or two low-current LEDs directly. But several of the LEDs I chose are not low current, and using a driver to pump a little more current through the LEDs will make the bright ones very visible from way over in my lab. The U421 provides 5V from the USB port. In the photo below the U421 was mounted on the PCB along with the ULN2803. Resistors will be mounted and connections will be made on the bottom of the board.

Step 10: PCB From Under

The bottom of the board with the U421 and ULN2803 in place will be mounted to the shell of the box that has the LEDs.

The LEDs that I picked for the project are each a unique color. I’ll assign an email account to an LED that will flash on each side of the box.

The LEDs are easy to mount in a 1/4″ hole when these little mounting rings are correctly employed.

Step 11: LEDs Mounted in Box

Eight LEDs are placed on one half of the box with the leads bent toward where the PCB will be. It was an adventure poking all 16 leads through the printed circuit board.

With the LEDs in place, and the PCB navigated onto all of the LED leads, the LEDs are then soldered in place.

Step 12: Soldering Connections

The connections for the components are made on the bottom of the board with wire-wrap wire. A soldered-in-place component on the top of the board leaves a small pyramid of solder on the component leads. When wire-wrap wire is used for making point to point circuit connections, a very small bit of the wire insulation is removed from the ends of the connecting wire. The “pyramid” of solder is melted and the wire wrap wire end is poked into the melted solder.

The USBmicro site had a guideline for driving an LED from the output pin of a U401 or U421. Extending that to use a ULN2803 for this project was easy. One of the app notes at USBmicro also has a ULN2803 driving LEDs and relays. Both schematic fragments are pictured below to serve as a guide.

Step 13: Testing the Electronics

One 8-bit port of the U421 is used. Each of those 8 lines leads to an input of the ULN2803. The outputs of the ULN2803 connect to each of the LEDs through a 330 ohm resistor. The anodes of the LEDs connect to the 5V line on the U421. Ground on the ULN2803 connects to the U421 ground pin.

The finished eMail Light electrical hardware is assembled and tested with the output test application from USBmicro.com.

Step 14: Mointing the Mail Light

The eMail Light will mount on the back of one of my LCD displays. I modified a straight stock aluminum bar for this.

The bar needed a short 1″ section bent. This I did by putting the bar in a vise brake.

The bent section of the aluminum bar will be screwed to the plastic box.

On the bent 1″ section of the bar I tapped a #4-40 hole. One half of the plastic box – the half without parts – will have a little hole in it for the screw. I also drilled holes of appropriate size and spacing on the long part of the aluminum bar for mounting on the back of my LCD monitor.

The plastic box half was tightly attached to the aluminum bracket and then the box was reassembled.

Mounted under my monitor and plugged in to USB, I was able to use the USBmicro output test application to verify that the regular LEDs were visible from a sitting position at my desk, and that the super-bright LEDs facing “back” were easily visible in my lab.

Step 15: REALBasic Software Development

The REALbasic development environment REAL Software is used for this development since it made the email code (pop protocol) very easy.

The goal of the software that I created was to connect to four different email accounts and monitor them for the presence of email. If email was found, a specific LED associated with that account should blink. The LED blinking rate should be changeable, the rate at which the email accounts are polled should be changeable, and the program should hide as a tray icon until needed.

Each of the four accounts has a quarter of the main window with a few text areas for account information. The quarter is pictured below.

Step 16: Software Details

Note: The compiled software is available for free from the CircuitGizmos blog.

Each account has a connect button for enabling that account. When connected, the email account is scanned for email. To the right of the connect button is a visual indicator that will blink in unison with the LED. To the right of that is a text field that shows the number of messages that are on the server of that account.

The box marked “server” should contain the server address. Something like “pop.flintstone.com”. This would need to be the right server for your email account. Below that is the name that you use to log in to your account. It might be “fred” or it might need to be “fred@flintstone.com”. Under that is the box for your password. It is a field that shows up as asterisks. My password happens to be: ******* :-)

Under the password field is a box that contains the rate, in minutes, that the email address is queried. Below that are two connection status boxes.

The other three email addresses are repeated.

To the lower right of the main window there is a box for the blink rate in 1/100 of a second. A value of 50 is a 1/2 second blink rate. Above that is a button to exit the program.

On the upper right of the main window is a button to hide the main window. A double-click on the program’s tray icon will expose this main window again. Everything keeps running with the main window hidden.

When the program is run, it needs to build up a tray icon and set that tray icon to a graphic (in this case called cg4) that is included with the project: (see pic)

When the program is closed, that icon needs to be removed from the tray: (see pic)

The app tray object itself has only the task of making the main window visible when the user double-clicks on the tray icon: (see pic)

The hide button on the main window just makes the main window not visible: (see pic)

When the main form is made visible for the first time that the program is run, the U421 USB interface is discovered and the defaults for the program are loaded. Communication with the U421 is done through a DLL that is opened by REALbasic when the function inside that DLL is defined. The code first declares the three functions needed (and creates a return value for the function call) before using the functions: (see pic)

USBm_FindDevices is the first call to USBm.dll. It searches the PC’s USB bus for U401 and U421 devices. In this simplified example code the true/false return code is not used. Non example code would want to process the return values for error. Port A of the U421 is set to output with this call: USBm_DirectionA(0, &HFF, &HFF). The 0 assumes that there is only 1 (indexed to 0) USBmicro device on the bus. If there were more, then additional code would be necessary to address the correct device. See the USBmicro information in the On-line Development Notebook (ODN) for all of the port direction command information.

Once the direction is set to output, all lines are turned off (0) to disable the LEDs: (see pic)

After that a file called “maildata.txt” in the same folder/directory as the executable maillight.exe is searched for. Again, in a program other than example code, more code should exist to handle errors such as the file not being found.

The file contains text information that is read into the text boxes in the main window. The first line of the file should contain the server name for Email 1, the second line should have the user name, etc. The last line has the LED blink rate. The comments in the code show the format: (see pic)

The file is opened and each line read into appropriate text boxes: (see pic)

The LED blink rate is the last of the edit field elements that are loaded on start up by loading this file. Changing the values in the text fields after the file is loaded is also possible by editing those boxes.

Step 17: Intermission

This is how the core routines were implemented. The core routines revolve around a timer that flashed the LEDs, four timers that check for email at a certain rate, and the REALbasic objects that manage the pop connection.

Step 18: More Software

Again, remember - This software can be downloaded for free from the CircuitGizmos blog.

The simplest component is the timer that goes out to get mail every couple of minutes. There is a timer for each of the four mail accounts. When the timer times out, it simply calls the pop3 object and tells it to connect:

After the connection is established, the pop3 object prints that status in the first status box. After it connects, then a login is attempted. When the login is successful, the number of messages that are on the server is counted:

The pop3 object counts the number of messages on the server and displays that number. If the number is 0, then a boolean variable is set to false. If there is 1 or more messages, then that variable is set. That variable determines that the LED will be blinking. After counting the number of messages, the pop3 object disconnects and clears the status text:

The timer that checks for mail doesn’t run until the connection is made for the fist time with the press of the connect button. When the button is pushed, the server, user name, and other data is passed to the pop3 object and a connection invoked. The timer is started (for next email checking time) and the button is changed from a connect button to a disconnect button:

If that same button is clicked after it has been toggled to be a disconnect button, then the pop3 object is disconnected from the server (if still connected), the timer is turned off, status cleared, the LED blinking is disabled, and the button again becomes a connect button:

This isn’t an email program – you don’t get to read the email that you have with this program – you are just notified that you have email waiting on your server. After you are notified that you have email, you would go get those emails with your email program. The LED will likely still be blinking after you get the email with the other program. Clicking the button to disconnect and reconnect will start another check and discover that your email had been cleared.

The LED blinking routine is actually the longest of all of these functions. When the blink timer times out, the USBmicro DLL stuff is defined. The value for the LED port of the U421 (port A) is set to 0 before accumulating the status of the email accounts:

The blink timer toggles the graphic indicator (and eventually the LED) on and off every other time that the timer times out. A boolean variable is flipped from true to false every other time. When false, the indicator is off. When true the indicator is on if there has been a message detected. And if the indicator is on, then LEDval is set to turn on a bit for turning on a specific LED:

The first LED on the front and the first LED on the back are turned on with the value of &H11. The 2nd LEDs with the value of &H22, the third with a value of &H44, the 4th with &H88.

Once these values are all combined, then the value is sent to port A ov the U421:

Download the REALbasic project and the executable code: eMailLights Project and program.

To set this up for your email, edit the maildata.txt file to include your four (or fewer) email settings. When you run the program, these settings are loaded. You can leave the password as a blank line if you don’t like having a password in this file.

Click connect on all of the accounts that you will use to start the mail checking process. Click hide to hide the window to the tray icon. Recover the main window by double clicking on the tray icon.

When the program discovers an email in the accounts that it checks, the visual indicator will flash. If you have built the Mail Light hardware, then you will see flashing LEDS.

There is a lot of flexibility in the LEDs/lights that you can put together for this project. Originally I had planned to put a stack of ping pong balls on the top of my monitor to light up with some LEDs. This looked great in a dimly lit room and in the evening. But with my office window open, the ping pong balls just were not light enough against the open window to see from my lab.

Code could be changed to do more than just light LEDs. You could attach an LCD display to the U421 that would display, in text, the number of emails that are in each account. The U421 could directly drive a pair of seven-segment LED displays. You could use multiple U421 with a combination of hardware designs.

Step 19: Enjoy!

Enjoy this project. I have found that it is a very useful device just in the week that I have been using it on my PC. It will be a permanent part of my PC sertup now. If I make improvements to the code I will share it here. You are free to make improvements, suggest features, and port the code to other development environments. Or you can just build the hardware and use the software freely to drive your own eMail Light. Share pictures of your email light and experiences building. :-)
Can someone make this for me where it would check my webmail and alert me of new mail in a certain folder? How much $?
wget the page. grep for the folder. wget the folder. grep for the email. wget the email. make computer go "bing".
That would require a Linux based controller... Perhaps a Raspberry Pi model A? <br> <br>If you insist on using Arduino, you could use the Ethernet libs and use raw socket writes to fetch the file off the server and chop through substrings to parse the desired info out...
you don't need a linux based controller. just install wget &amp; grep on the windows computer.
I'm talking about those who want to make a standalone piece without a host computer... If you want to go with the simple indicator hooked up to another machine that must be running in order to get notifications there are a hundred ways you can scrape the proper info off the web to do that...
When I try to run the maillights.exe, a window pops and says there is a runtime error. how do i fix this.
Do you have the USBm.dll in the same directory as the maillights.exe?
I got it working, but it isn't able to connect to my gmail account.
Is gmail accessible with pop3?
Yes, gmail says it is.
Gmail says this:<br> <br> Enabling POP<br> <br> You can retrieve your Gmail messages with a client or device that supports POP, like Microsoft Outlook or Netscape Mail.<br> <br> To enable POP in Gmail:<br> <br> 1. Sign in to Gmail.<br> <br> 2. Click Settings at the top of any Gmail page.<br> <br> 3. Click Forwarding and POP/IMAP.<br> <br> 4. Select Enable POP for all mail or Enable POP for mail that arrives from now on.<br> <br> 5. Choose what to do with your messages after they're accessed with your POP client or device.<br> <br> 6. Configure your POP client* and click Save Changes.<br> <br>
I already made sure to enable it. When I click connect on the main email lights window, it says &quot;connected&quot; in the first text box, but it stays there instead of disappearing. And the text box with the number of messages doesn't display &quot;0&quot; like it does when it connects to my comcast account.
I am having trouble connecting to Gmail, too, but also with a regular mail client as well (Thunderbird)...
I have my led's with (680ohm resisters) hooked directly to the parallel port.
The nte2013 can be substituted for the uln2803.
Great minds think alike! Lol. I was going to enter this contest with a project of mine that does the same thing, although I'm using a basic stamp and a c# program that I wrote to poll from the system tray. Mine also uses two 7 segment displays to tell you exactly how many unread emails you have. Summer has been too busy and I haven't had time to document it so I missed the deadline. Oh well. Congrats on your entry being selected as a finalist! John
Hey, thanks!<br> <br> The U421 will easily drive a character-based LCD display and <em>that </em>was <em>my</em> first choice.&nbsp; But the LCD can't be read from across the room.<br>
Great idea, I would also like to do something similar, however I use the Linux operating system, would this project work with Linux? And would it be possible to find the equipment in a shop rather than on the internet?
The software is compiled for Win, but all of the hardware will work with Linux (and OSX). There are examples for Linux in the Circuitgizmos.com blog, and some Linux turn-on-an-LED examples from USBmicro.com. Build one device and it can move from Win to OSX to Linux. But the application software would have to be made for Linux. For Linux it might be some command-line and shell-script work.
Great. I am not so expert in electronics but the circuit seems rather easy. If I could only have the parts I might just make it (if the total cost is not too high). I will first want to find the examples you mentioned above before, anyhow. By the way, how much was the total cost? And is it only possible to find the equipment on the internet (never bought anything on the internet yet!) ?
The circuits are pretty straight-forward. The U421 is on sale at circuitgizmos where you can also get LEDs, resistors, the PCB, and the ULN2803. $28.55 for that.<br /> <br /> The slim case was found at RadioShack for a couple bucks. Other cases can be used. You can be pretty creative there.<br /> <br /> Circuitgizmos accepts PayPal transfers, and accepts credit cards, too. Don't be worried about purchasing through CG.<br /> <br /> Feel free to ask any questions about getting the hardware to work for you.<br />
okay, I might as well ask you, if I do decide to do something similar, what do you think is better for me, the U421 or the U451 relay board? One of the things I am planning to do with the board is control electrical devices with it. However, I heard that the U4x1 can be used also to send data to the computer, and this also sounds interesting. And the outputs, you said, can drive also transistors, and thus, relays instead of the ULN2803? Also how do I send data to the computer from an electronic circuit? I'd have to connect one of the U4x1 pins to 5V? And also, I couldn't find many examples for Linux on the circuitgizmos.com site or usbmicro.com, where are they hidden? :) Finally, I live outside of the US (most of the time in Asia), and CircuitGizmos gives HUGE prices for shipping there (5,000 USD), right now I am in Europe and the shipping price is around 14 USD, but I am leaving here in about 1 month, how much does the shipping take? Thanks a lot for your help till now anyway!
CircuitGizmos lists the countries that it will ship to. If yours is not listed you can get the U401, U421, U451 devices through Dontronics.com, too. Perhaps some of the other stuff, too. Or order while you are in a listed country.<br /> <br /> The U451 has the ULN2803 built in PLUS two relays. It is <em>very </em>easy to just add LEDs and a series resistor between +5V and the outputs. The U541 could then give you two relays that switch higher (mains) voltages, six outputs that pull to ground (drive LEDs, more relays) and 8 lines that can be used as input/output.<br /> <br /> The circuitgizmos.com site has an email address to ask about Linux examples.<br /> <br /> Shipping to Europe is <em>typically </em>about two weeks.<br />
I think I will buy the u451. Now this question might sound a bit weird, but I want to clear a doubt, I sent an e-mail to robert@usbmicro.com to inquire about Linux and they sent me an application for output control in Linux, but before I make the purchase, do you have any idea if they are really honest?, I mean is that application probably REAL or could it be just something that shows &quot;Couldn't find u4xx!&quot; ? I am also running out of time and need to make the purchase tomorrow in case, so I'd have to decide a bit quickly. Sorry for bothering.
The source code is on line and available for the asking.
Okay, so most probably that code in C on the usbmicro.com site is most probably the source of that application. Thanks for the answer. I ordered the U451 and I hope it will reach on time, I am leaving in about two weeks, so the arrival time is a bit tight.
real basic can make windows, Linux and OSX binaries
I once built something similar to one of these using an arduino and a uber simple python script. Your setup is much more professional. Great job!
Thanks!
In step 4 you say<em> &quot;I removed the extra plastic with the same tool I use to flush-cut component leads on a soldered board.&quot; </em>What is this tool? In step 8 how did you cut the board to size? Can you please add a supply list of everything you will need to do this 'ible. Great idea of course - we all spend too much time wiggling that mouse.
The tool? That one over there. *points* See?<br /> <br /> I use a flush-cut tool. I think the Make blog had posted a picture of the things and asked &quot;what do you call this&quot; and there were a lot of different names for it.<br /> <br /> After using that tool, I used a knife to trim the bits of remaining plastic.<br /> <br /> The board was cut to size by scoring the board and snapping along that score. I commonly use a metal straight edge to guide my cut, and an ordinary &quot;box cutter&quot; as the knife.<br /> <br /> Step 1 does have the parts list:<br /> <br /> USBmicro U421 USB interface<br /> ULN2803 driver<br /> circuit board<br /> 8 LEDs<br /> 8 330 ohm resistors<br /> <br /> (Obtained from <a href="http://www.circuitgizmos.com" rel="nofollow">http://www.circuitgizmos.com</a>)<br /> <br /> 8 LED mounting rings<br /> a small plastic box<br /> wire-wrap wire for point-to-point circuit connections<br /> <br /> Not listed was the aluminum bar and screw from a hardware store.<br /> <br /> I don't recall where I got the LED mounting rings, but the holes in the box could be drilled out the same size as the LEDs and the rings would not be needed. The box I believe I had picked up at RadioShack - they may or may not still carry them.<br />
I have those, thanks. I had no idea you could just score the plastic and snap it, again thanks.
Thanks for your good suggestions. I changed the list of parts to be a bullet list and also listed suggested tools.<br />
Can you like edit it to blink if you have a new post in facebook or only check email? Anyway great instructables, you have my vote :)
Thanks, Blastboy!<br /> <br /> Well, Facebook posts. Interesting idea. I personally have a specific account for my Facebook stuff, so even the default free software would work for that. Just set up one of the accounts and associated LEDs for your facebook email account, if that is the case.<br /> <br /> Otherwise the default software doesn't do anything too specific. But it is within the capability of programming (in REALbacic in this example, or VB, VC, Java, etc) to look for a specific &quot;from&quot; address to blink the lights.<br />
-poke- how much did this cost to make?
$25 for the USBmicro U421 (on sale) at CircuitGizmos.com Under $10 for the rest of the parts. There can be variations on a theme. The software and U421 can drive transistors as easily as the ULN2803, the LEDs can be encased in anything. If you want a BIG light, a U451 relay board can be substituted for the U421 and drive a good old hot 100 watt light bulb.
Enjoy this! I know every time I have email by the blinkenlights :-) I can see them from across the room. Funny, too, in the morning walking in and seeing all 4 flash in unison. Poke me if you have any questions.

About This Instructable

35,861views

94favorites

License:

More by indestructable:Storing 72 Bras Servo Tester with Graphic LCD Room Temperature Gauge with a servo 
Add instructable to: