Sunday, May 27, 2012

Week 4: Local Server, PHP, and Enclosure Design

This week was very exciting, and I was able to get very far on the project.  I was able to finish getting my Apache server up and running, and early on this week had a PHP script running well.  Since I had this done so early, I decided to move ahead and begin designing my enclosure along with acquiring the parts that I'd need!

Here, you can see a model of what the end product will look like that I threw together in 3DS Max.  Pretty simple, right?  But what does the inside look like?




Well, the cube itself will be semi-transparent once it's built.  But as you can see here, it pulls apart quite easily to reveal the insides.  They are also simple.  This is my first project like this, after all!




Here is a closeup of the arduino board and it's circuit.  Of course there will be holes cut in the enclosure for cables, too.  The connectors on the board will butt right up against the wall of the enclosure, so all I have to cut in the enclosure's wall are squares large enough to allow the cables' heads.


So what's with the stupid box enclosure?  Why do those LED's have four pins stemming from them?  Why does it look like there are two arduino boards in that last picture?!  Relax, I'll explain now.

So what's with the stupid box enclosure?:
The cube itself is going to be an acrylic box which, as you can see, is made up of two pieces with three sides each.  This box was something I found at Hobby Lobby and was originally supposed to be a clear case inside of which you could put six photos (one on each side).  I've purchased some craft paper, which is more like a plastic, which is very diffused, yet light is able to travel through it well.  Basically, I will be covering the inside of each box wall with this plastic so that any light on the inside of the box will dissipate and spread out across all of the walls, making it look much cooler!  But why a box?  Well, to be frank, I think it will look mysterious and ominous.  When you see a random acrylic box serving NO purpose in the corner of a room with an ethernet and power cord sticking out of them, you almost HAVE to ask what it does.  This is exactly the type of gadget I like, and want to have lounging around my apartment/office space.

Why does it look like there are two arduino boards?:
The circuit looks a bit stranger in that last picture because I added a second board.  What this actually is is the Arduino Uno board on the bottom, and an ethernet shield for it on top with the LED's plugged into it.  Since my device will need to be connected to the internet, an ethernet shield will be needed!

Why do those LED's have four pins stemming from them?:
The LED's have four pins because they are actually RGB LED's.  What does that mean?  Well, it basically means that they have the correct chemicals inside to create any color of light within the color spectrum, or at least very close!  There is a pin for powering the LED, along with a pin for Red input, Blue input, and Green input.  It's very cool, and each time I get an email, I plan on lighting them up and having them ambiently moving through the entire RGB color spectrum.  Pretty cool, right?!



Aside from designing the thing, I've also rounded up all of the necessary parts, including solder for the LED's and hot glue for a few of the connections, just to keep them steady.  Hopefully by next week, I can show you how the final product actually looks!

Sunday, May 20, 2012

Week 3: Framework Code Completed

This week has been mighty productive.  I've managed to gain a further understanding of the code I'd be needing to run this project, and I've gotten it fully working (to my knowledge), and implemented!  Although I can't fully test the code at this point, I've already begun looking into how to set up a local server which is capable of running PHP so that I'll be able to finish up some PHP scripts for next week.  Once I'm able to run my PHP scripts, I should be able to test the code I've written this week to see if it actually pings my GMail account correctly.  Right now, it works like this:

- I have two LED's on my board.  One will light up each time I ping the server, which is based upon my delay time set of five seconds.  Essentially, every five seconds, I will call upon my PHP script and obtain the result.

- The script called will gather the total amount of emails in my inbox, as that is all I truly know how to do at this point.

- That integer value will be stored as 'num' in my code.

- I will then test to see if the PREVIOUS number I got (on the last GMail ping) is higher or lower than my current number, and then set the current number to prevNum.

- If the new number is higher, I turn on the other LED to indicate a new EMail in the inbox.  If the count goes down, I'll turn the light off.

Viola!


However, I do spot a problem with this.  The only way to turn my light off will be by deleting an email.  What if I receive an important email?  I may not want to necessarily delete it.  Well, I've recently found a PHP script which the owner claims, with a little modification towards your own setup, will gather only the count of emails with a "U" flag on them, or an unread flag.  This would be useful, as I could turn my light off after simply opening the email rather than having to delete it.  I would also only have to keep track of one integer pulled from the script, rather than two.  I'll be looking into this this week, and should have a fully-working example next week!

Sunday, May 13, 2012

Week 2: A General Understanding

I have spent most of this past week studying what, exactly, I'll need to be doing each week to get this project up and running smoothly.  I've watched at least a hundred videos showcasing what people have done with the Arduino line of microcontrollers and am very excited to get things started!

Besides looking at overall projects, I've also begun to look into the code for the boards.  Apart from some minor details, the idea of the programming environment, commands, and code as a whole, are all very familiar to me.  The C-like language is very understandable to me, and I've gotten many of the examples delivered with the development environment to work well with my Uno board, and even some examples to work well with my ethernet shield for the board.

So, here's what I've learned:
     - I'm going to need to learn some PHP.  This is one thing that is going to be VERY hard for me, and jumps out at me almost immediately.  I've never worked with any kind of web programming before, so I'll just need to set up a local server on my laptop capable of running a PHP script when I call it from my board, the main client.

     - I'll have a limited amount of pins on my board, so I have to figure out which pins are capable of what.  Remember, I'm a game programming student.  Microcontroller hardware is something VERY new to me and thank goodness I can get some help from a few students at my school.

     - It may be a challenge getting my local server to work with this project.  I am not considering setting up the server as a major goal of this project, because I've already found a program which will install an Apache server AND give it PHP capabilities all in one go, called WAMP.  The real trouble is figuring out how it all works!  However, I have heard that people tend to have problems when running this type of server wirelessly and allowing their ethernet-connected Arduino to connect with it.  I'm sure I'll be able to get it up and running.


Overall, I think I'm ready to begin programming for the microcontroller itself!  Hopefully I will be able to show that it's completed in next week's post!

Project Plan

I will be creating a separate post for overall work completed this week.  This is a post simply meant to demonstrate my general project plan for this project.  Enjoy!



Project Plan
Tate Marske
May 13th, 2012
Email Notifier


1.       Project Overview:

The Email Notifier is a project which is set to be completed in a total of eight weeks.  For the purposes of this document, the timeframe for completed aspects of this project have been split into increments of 1 week.  This document will provide guidelines as to how the project shall progress to become a complete, prototyped product within these eight weeks of development.


2.       Project Development Management

2.1   Organization and Resources

By structuring the project so that each week will have a clear-cut and reachable goal in the development process, I have eliminated the need for back-tracking or reconfiguration of product implementations and assets.  Each week, I will be completing a major portion of the project based on sturdy and reasonable milestones.


2.2   Personnel

In the case of this project, I am the only person who will be working on the Email Notifier.  Therefore, I will be responsible for all of the physical assembly of the product as well as the programming required to serve as the framework for this product.  Thankfully, I am following a general tutorial to help me set this project up and implement the code.


3.       Schedule and Milestones

Week 1:  Internal Hardware must be acquired. 
START – W1        END – W1

Week 2:  Internal Hardware studied, and programming language mostly understood. 
START – W1        END – W2

Week 3:  Framework code completed. 
START – W2        END – W3

Week 4:  PHP code completed and running on local server. 
START – W3        END – W4

Week 5:  Enclosure and external hardware acquired. 
START – W4        END – W5

Week 6:  Enclosure functional and all code working properly.
START – W5        END – W6

Week 7:  Bug tested and fully functioning code and hardware. 
START – W6        END – W7

Week 8:  Full product ready to present and all bugs worked out. 
START – W7        END – W8

Tuesday, May 8, 2012

Week 1 - Gathering both Knowledge and Materials

It's the end of week 1, and after having a bit of time to bounce back from some holdbacks I've had all week, I've at least been able to research a bit more about my project and figure out what products I need to get to start it off.

I've gone to RadioShack to pick up an Arduino board, and a shield for it.  I decided on the Arduino Uno Rev 3 model board for my base.  This board is simple, and has no more than I need.  I've also noticed that it has the largest consumer base, and so I know I can get more help for this board than any other online.  I also grabbed the Ethernet Shield for this board.  This will allow the Arduino board to communicate over the internet.  I'm going to need this if I'm going to be pinging my GMail account!  Other than these boards, I've also picked up some different LED's that I feel like I may need for testing.

I think I've got everything I need to get the ball rolling with this project, and over the course of this next week I can learn how to set up a local server which I can use!

About this Project

     This project will be some sort of physical product which will alert me immediately when I receive new emails.  Essentially, I will be building a rather simple-looking box with some kind of light fixture attached to it.  Each time I get a new email, I will have the light on the box light up for a certain amount of time.  This will all be controlled with an Arduino board.  As I am sure I can give the Arduino internet capabilities, it should be simple enough to learn how to communicate with a local web server I'll have to set up which will ping my email account.  This way if I am not near my computer and my phone is charging while I'm home (which it often is, in the next room), I will still receive some sort of notification when I have received an email!

     Many of you may be saying "Hey!  I've heard of something like this before!" Well, you're not crazy, it's been thought of and executed before.  Matt Richardson, a MakeZine blogger who has concocted many gadgets, did this with Christmas tree lights!  And he wasn't even the first to think of the idea -- others have done similar projects.  However, in the case of Matt's project, he was using a PowerStrip tail which he was able to connect to his Arduino board.  This allowed him to control the current between the wall and the light, turning it on or off.  I plan on making a smaller product, which will more than likely light up a small bulb or an LED.  This will keep the project much less costly, and a bit less build-heavy than if I used a full light fixture.

In essence, I'm going to have to:
     Gather all of the materials necessary, namely the Arduino board and its ethernet shield
     Figure out how to set up a local server
     Learn how to execute PHP scripts on said server
     Learn how Matt was able to ping his GMail account with a PHP script
     Learn to program for the arduino boards themselves, so that I can understand Matt's code
     Build the encasement for the product and actually put the thing together.

     I plan on logging my progress at least once per week, wish me luck!