Instructables
Picture of The Arduino Internet Gizmo
The Arduino Internet Gizmo is a USB, Arduino, and RFID device for web surfing.  The gizmo works by placing an RFID tag on the top of the gizmo.  The gizmo reads the RFID tag and sends the tag number via USB to a program running on a PC. The program looks up the tag number and the associated web site and then invokes the default web browser to open a new tab for the web site.  The gizmo consists of an Arduino Uno, a Parallax serial RFID tag reader, an assortment of LEDs, and a few other parts packaged inside a ATX power supply case recycled from an old PC.  The software components of the gizmo consist of a small program running on the Arduino and a small Python program running on the PC or laptop.

The Arduino Internet Gizmo is fun to use and makes an excellent desk toy and sure beats using a mouse and keyboard to load your favorite web sites.

This video demonstrates the Arduino Internet Gizmo:


I made this at TechShop.
 
Remove these adsRemove these ads by Signing Up

Step 1: How it works

Picture of How it works
1 - 2 - Arduino Internet Gizmo.png
1 - 3 - Arduino Internet Gizmo Unknown Tag.png
The Arduino Internet Gizmo consists of an Arduino, a RFID card reader, a bunch of LEDs and other components mounted in a recycled PC power supply case connected to a PC as shown in the first diagram.  The Arduino is running software that will read an RFID card when it is placed near the reader.  When a card is read, the Arduino makes the LEDs on the top of the gizmo light up in sequence and appear to race around in circles. The RFID card's ID is then sent to the PC via a USB cable that connects the Arduino and the PC.  On the PC, a Python program is running in a loop waiting for data from the Arduino.  When it receives the RFID card id from the Arduino, it looks up the RFID card ID in a table to see what web site is associated with that card.  If it finds the card in the table, it opens a new tab in the default web browser for the computer and loads the web site.  If the RFID card ID is not in the table, the Python program creates a simple HTML page with an error message and the RFID card ID and displays the information in a new tab in the browser (as shown in the third image).  When the Arduino Internet Gizmo is powered on, it illuminates a set of red-green-blue color changing LEDs to indicate that the gizmo is operational.

The second figure and the attached PDF file show the circuit schematic for the Arduino Internet Gizmo.  The RFID card reader is connected the Arduino pins 3 and 4.  Pin 3 is used for sending the RFID card data to the Arduino and pin 4 is used to enable or disable reading.  Arduino pins 6 - 13 are used to control the illumination of the LEDs on top of the gizmo.  Arduino pin 5 is used to turn on the red-green-blue LED color changing circuit.  Pin 5 connects to an optocoupler that turns the color changing LED circuit on and off.  I used the optocoupler circuit rather than connect the color changing LEDs directly to the Arduino because the color changing LEDs draw varying amounts of current as they change color and with five of them, I wasn't sure what effect that would have on the Arduino, so I felt it was better to use the optocoupler and power the color changing LEDs independently.

Details on how the software works is covered in step 20.

More information on how the RFID card reader works can be found in the data sheet for the Parallax serial RFID card reader.

Step 2: Prepare the case

Picture of Prepare the case
In this step, we will prepare the case for the Arduino Internet Gizmo.  You will need the following for this step:
  • Power supply from a PC (I used a non-working ATX power supply)
  • Screwdrivers
  • Wire cutters
  • Goo Gone (or similar solvent to remove adhesive)
  • 4 Vinyl bumpers (rubber feet)
Follow these steps to prepare the case:
  1. Remove the screws holding the power supply case together as shown in the second photo.  Save these screws: you'll need them to put the case back together.
  2. Remove all of the guts from the power supply as shown in the third photo.  You'll need to remove screws and cuts wires to get everything out.  Save the parts for some future project (there's a wealth of good stuff inside the power supply) or responsibly dispose of the innards as e-waste.
  3. Remove all the labels and stickers on the outside of the case.  I found that my finger nails did the best to scrape them off without scratching the case.  Use Goo-Gone or a similar product to remove any remaining adhesive.
  4. Apply the vinyl bumpers to the bottom of the case (see fourth and fifth photos).

Step 3: Assemble the color changing LED circuit

In this step, we will assemble the color changing LED circuit.  This circuit is "on" whenever the Arduino Internet Gizmo is powered on and operational.  It's purpose is decorative and to make the gizmo look cool!  You will need the following parts and tools for this step:
  • 5 Red-Green-Blue color changing LEDs (You probably won't find these in your local electronics store.  If you search on eBay for "5mm led rainbow rgb" you'll find them.  They cost approximately $13 for 100.)
  • 5 100 ohm 1/4 watt resistors (Radio Shack 271-1311)
  • 1 4-Pin Lite-On LTV-817 Optocoupler (Jameco part number 878243)
  • Screw terminal (Jameco part number 2094485)
  • Adafruit Perma-Proto Quarter-Sized Breadboard Printed Circuit Board (part number 589)
  • 4 1/4" Round nylon #4 spacers
  • Wire
  • Soldering iron and solder
  • Wire strippers and wire cutters
Follow these steps to assemble the circuit:
  1. Solder the resistors and jumper wires as shown in the first photo.  Use the labels for the pins in the photo as a guide to make sure you're placing everything correctly (note: the numbers 1 to 15 along the top and A to J along the sides)
  2. Solder the optocoupler as shown in the second photo. The alignment of the chip is critical: the round dot on the chip indicating "pin 1" should be in the lower left hand corner (hole E2)
  3. Bend the LED wires as shown the third photo.
  4. Solder three of the LEDs as shown in the fourth and fifth photo.  Note that the longer lead on the LED (the positive side) goes in the hole in the same column as the orange wires (6, 10, 14).
  5. Put two nylon spacers on each of the LEDs leads as shown in the sixth and seventh photos.
  6. Solder the LEDs to the circuit board as shown in the eighth, ninth, and tenth photos.  Note that the longer (positive) LED lead goes into the holes in the same columns as the orange wires (8 and 12).
  7. Solder the screw terminal to the circuit board as shown in the eleventh photo (note: this photo shows a red and black wire attached the the circuit board - you don't need to attach anything there in this step - I had those attached so I could test the board).
When powered up, the LEDs will change colors as shown in the last three photos.  When enclosed in the case, the color changing LED circuit will look like this:


Step 4: Assemble USB power cord for color changing circuit

The color changing LED circuit is powered separately from the Arduino: the power comes from a USB-AC adapter.  In this step, we will construct the power cable.  You will need the following parts and tools for this step:
  • USB Cable with a type A connector on one end
  • USB Power Adapter
  • Soldering iron and solder
  • Wire strippers/cutters
  • Knife
Follow these steps to make the cable:
  1. Cut off the non-type A connector as shown in the first photo.
  2. Using a knife, gently cut off about a quarter inch of the outer insulation as shown in the second photo.
  3. Cut off the outer wire braid and then strip the ends of the red and black (power) wires as shown in the third photo.
  4. Cut off the green and white (data) wires as shown in the fourth photo.
  5. Solder the red and black wires to the circuit board as shown in the fifth and sixth photos.
  6. Attach your USB power adapter to the end of the USB cable (see last photo).  I used an Apple USB power adapter because of it's small size.

Step 5: Cut acrylic for the two inner platforms

In this step, we will cut the acrylic for two platforms that hold all of the electronic components.  The upper platform holds the RFID card reader and the top LEDs.  The lower platform holds the Arduino, the color changing LED circuit, and a terminal strip for all the ground connections.  The design for the lower platform includes some engraving to mark where the components are placed. 

You will need the following parts and tools for this step:
  • Two 6" x 6" sheets of 1/8" thick acrylic.  I used transparent blue for the upper platform and fluorescent transparent red for the lower platform.
  • CorelDraw, Adobe Illustrator, or similar software if you need to modify the design to fit your power supply case.
  • Epilog Laser Cutter
For those without a laser cutter: you can use a saw and a drill to cut the acrylic.  The only tricky part would be the design on the upper level that sits above the RFID reader.  If you're doing this without a laser cutter, I'd recommend you drill a number of large holes where the pie cutouts would be.  That would have the same effect and could look pretty cool.

Attached to this step are PDF files with the designs for those that do not have software that can open CorelDraw files.

Use the laser cutter to cut the platforms.  "Lower Platform v10.cdr" and "Upper Platform v10.cdr" are used to cut the lower and upper platforms, respectively.  I used a 60 watt Epilog Helix laser cutter and used these settings:
  • Vector: Speed 10, Power 90, Frequency 2500
  • Engrave: Speed 50, Power 80
The resulting parts will look the attached photos.

Important note: Different brand power supplies have their mounting holes and cutouts in different places: you may need to tweak the designs for the mounting platforms to match the case you have.

Step 6: Contruct and mount terminal strip for ground connections

Picture of Contruct and mount terminal strip for ground connections
6 - 2 - Ground Bus.JPG
6 - 3 - Ground Bus.JPG
6 - 4 - Ground Bus.JPG
6 - 5 - Ground Bus.JPG
As you can see in the schematic for the Arduino Internet Gizmo, there are many parts that need to connect to "ground."  There are more parts to connect to ground than there are ground pins on the Arduino.  To deal with this, most of the ground wires will connect to a terminal strip and the terminal strip will connect to one of the Arduino ground pins.  In this step, we will assemble the terminal strip and mount it to the lower platform. 

You will need the following parts and tools for this step:
  • 4-Position Dual Row Barrier Strip (Radio Shack part number 274-658)
  • Two #6-32 x 1/2" Round head machine Screws
  • Two #6-32 Nuts
  • 4" of solid core wire (I used #24 AWG)
  • Wire strippers/cutters
  • Screw driver
  • Small pliers
Follow these steps:
  1. Strip all the insulation off the wire as shown in the second photo.
  2. Bend the wire around all the screws on one side of the terminal strip and tighten the screws as shown in the third photo. This wire connects all the terminals together electrically.
  3. Place the terminal strip on lower platform as shown in the last two figures.  Keep the side with the wire aligned towards the inside. This will make it easier for you to attach all the ground wires to the strip in a later step.
  4. Gently tighten the screws with the screw driver and pliers but be very careful not to over-tighten and crack the acrylic.

Step 7: Mount the Arduino to the lower platform

Picture of Mount the Arduino to the lower platform
7 - 1 - Mount Arduino.JPG
7 - 2 - Mount Arduino.JPG
7 - 3 - Mount Arduino.JPG
In this step, we will mount the Arduino to the lower platform.  You will need the following parts and tools:
  • Arduino (I used an Arduino Uno)
  • Screwshield kit for Arduino (Solarbotics part number 51865)
  • Four 1/4" round nylon #4 spacers.
  • Four #4-40 x 3/4" machine screws
  • Four #4-40 nuts
  • Screwdriver
  • Small pliers
  • Soldering iron and solder (needed to assemble the ScrewShield)
Follow these steps:
  1. Mount the Arduino to the board using the machine screws, nylon spacers, and nuts as shown in the second and third photos.  Gently tighten the screws using the screwdriver while holding the nuts with pliers.  Do not over-tightened or the acrylic will crack.
  2. Assemble the ScrewShield according to the instructions that come with the kit.
  3. Attach the ScrewShield to the Arduino as shown in last photo.  It's important to use the ScrewShield and not insert all the connecting the wires into the connector strips on the Arduino: using the ScrewShield for connecting all the wires to the Arduino will ensure that all connections are held tight and will not come undone after you've assembled the gizmo.

Step 8: Mount the color changing LED circuit to the lower platform

Picture of Mount the color changing LED circuit to the lower platform
8 - 1 - Mount RGB LED PCB.JPG
8 - 2 - Mount RGB LED PCB.JPG
8 - 3 - Mount RGB LED PCB.JPG
In this step we will attach the color changing LED circuit board to the lower platform.  In addition to the circuit board, you will need:
  • #4-40 x 3/4" Round head machine screw
  • #4-40 Nut
  • 1/4" Round nylon #4 spacer
  • 7" solid core black wire (I used #24 AWG)
  • 4.5" solid core green wire (I used #24 AWG)
  • Wire strippers/cutters
  • Screwdriver
  • Small pliers
Follow these steps:
  1. Attach the board to the lower platform as shown in the second and third photos.  Only one screw is needed to hold the board in position.  Gently tighten the screw and nut using the screwdriver and pliers.  To avoid cracking the acrylic do not over tighten.
  2. Strip the ends of both wires.
  3. Attach one end of the green and black wires to the color changing LED circuit as shown in the fourth photo.
  4. Connect the other end of the black wire to the terminal strip and the other end of the green wire to pin 5 on the Arduino ScrewShield also shown in the fourth photo.

Step 9: Assemble LEDs for upper platform

There are eight large red LEDs on the upper platform that race around in circles when an RFID tag is read.  In this step you will attach the LEDs to their current limiting resistors and long wires that in an upcoming step will be attached to the Arduino and Terminal Strip.  You will need the following parts and tools for this step:
  • 6" 3/32" black heat shrink tubing
  • 6" 1/16" blue heat shrink tubing
  • 8 360 ohm 1/4 watt resistors (Radio Shack part 271-1315)
  • 8 Large red LEDs (T2-1/2 LHR3930 Jameco part 119634)
  • 8 6" lengths of thin black stranded wire (I used #26 AWG)
  • 8 6" lengths of thin blue stranded wire (I used #26 AWG)
  • Wire cutters/strippers
  • Soldering iron and solder
  • Heat gun or other source of directed heat
Follow these instructions for each of the eight LEDs:
  1. For the blue wires:
    1. Strip approximately 1/4" of insulation off one end of each wire.  Using the soldering iron and solder, tin the end of the wire. This will make it easier to insert the wire into the ScrewShield.
    2. Strip 1/2" of insulation off of the other end - do not tin this end.
  2. For the black wires:
    1. Strip 1/2" of insulation off both ends.  Tin one end and leave the other end as is.
    2. Wrap the untinned end of the black wire around the resistor as shown in the first photo.
  3. Solder the black wire to the resistor and the resistor to shorter lead on one of the LEDs.  Cut off excess wire from the resistor. See the second and third photos.
  4. Cut a length of black heat shrink tubing that will cover the exposed wire and resistor.  Slip the tubing onto the wire and cover the exposed areas as shown in the fourth and fifth photos.
  5. Apply heat using a heat gun or other source of heat to the tubing to shrink it around the wire and resistor as shown in the sixth photo.
  6. Wrap the untinned end of the blue wire around the long lead on the LED as shown in the seventh photo.
  7. Solder the wire to the LED as shown in the eighth photo.
  8. Cut a length of blue heat shrink tubing sufficient to cover the exposed wire as shown in the ninth photo.
  9. Slip the heat shrink tubing onto the wire (see tenth photo) and apply heat to shrink the tubing as shown in the eleventh photo.

Step 10: Glue LEDs to upper platform

It's time to glue the LEDs to upper platform.  In addition to the upper platform and LED assemblies you made in the previous steps, you'll need 5 minute epoxy and something to apply it with (I used a small screwdriver that I wiped off after applying the epoxy.)
  1. Mix a very small amount of the epoxy according the directions that come with it.
  2. Apply the epoxy to the sides of the LED that will come into contact with the sides of the holes in the platform.
  3. Place the LED into the mounting hole on the upper platform and hold it in place for 5 minutes.  This is tedious and time consuming but if you don't hold it in the proper position until the epoxy sets, the LEDs will be at odd angles and your gizmo won't look good.  A glued LED is shown in the third photo.
  4. Repeat for each LED.  This will process will take about 40-50 minutes in total.
The platform with all of the LEDs glued will look like the remaining photos.

One additional step after the epoxy has completely bonded.  Identify the LED that will be almost covered by the RFID reader and bend the wires as shown in the fifth photo.  By bending the wires as shown you will not have any problem mounting the RFID reader.

Step 11: Install the RFID Reader

In this step, we will install the RFID reader on the upper platform.  For this step, the following parts and tools are required:
  • Serial RFID card reader (Parallax part number 28140)
  • Four #6-32 x 1/2" Round head machine Screws
  • Eight #6-32 Nuts
  • Four 12" Male-Female Jumper wires (Sparkfun part PRT-09385).  You'll need a red, black, yellow, and green.
  • Screwdriver
  • Small pliers
Follow these steps:
  1. Place each of the machine screws in the holes on the top of the upper platform and secure with nuts as shown in the second photo. Use the screwdriver and pliers to ensure the screws and nuts are tight but do not over-tighten.
  2. Place the RFID card reader onto the screws as shown in the third photo.  Make sure to place it so the components on the card are facing down: that way you will be able to see the the "enable" LED on the reader change from red to green and back as the gizmo is working.
  3. Secure the RFID card reader with the remaining four nuts as shown in the fourth photo.  Use the pliers to tighten the nut but don't over-tighten.  The RFID card reader and upper platform will look like the fifth and sixth photos.
  4. Slide the female ends of the jumpers onto the pins on the RFID card reader.  It is very important to follow the color coding - if you don't, at best the reader won't work, at worst you will damage or destroy it.  See the last photo.
  • Red - VCC (positive)
  • Yellow - Enable
  • Green - SOUT (serial output)
  • Black - GND (ground)

Step 12: Install RFID upper platform in case

In this step, the upper platform with the RFID card reader will be mounted into the case.  You will the following parts and tools for this step:
  • Four #10-32 x 3" round head machine screws
  • Sixteen #10-32 nuts
  • Sixteen #10 flat washers
  • Phillips head screwdriver
  • Small pliers
Follow these steps:
  1. Install each of the machine screws in the case and lock in place with nuts as shown in the second photo.  Tighten the nuts.
  2. Place washers on top of the nuts as shown in the third photo.
  3. Slide the upper platform onto the machine screws as shown in the fourth photo.
  4. Add a washer to each machine screw, add a nut and tighten as shown in the fifth photo.  A top view of the upper platform in place looks like the sixth and seventh photos.
  5. Place nuts onto each machine screw approximately 3/4" from the bottom of the screw as shown in the eight photo.
  6. Add washers as shown in the ninth photo.

Step 13: Attach LED wires to Arduino and ground terminal strip

Picture of Attach LED wires to Arduino and ground terminal strip
13 - 2 - Wire LEDs.JPG
13 - 3 - Wire LEDs.JPG
13 - 4 - Wire LEDs.JPG
13 - 5 - Upper Platform LED Wiring Diagram.png
It's time to start connecting the wires to all the right places.  In this step, the wires for the LEDs on the upper platform will be connected to the ground terminal strip and the Arduino.  You'll need a very small screwdriver for this step - the head of the screwdriver needs to be able to turn the small screws on the Screw Shield.
  1. Place the lower platform and the enclosure on your workbench as shown in the first photo.  This will allow you connect all the wires and at a later step easy lift the lower platform, flip it and lower it on to the case machine screws.
  2. Now turn the case on its side as shown in the second photo.
  3. Attach all the black wires from the LEDs to the terminal block as shown in the fourth photo.  It doesn't matter which screw you attach them to but it'll be easier if you attach no more than two per screw.
  4. Now attach the blue wires from the LEDs to Arduino pins 6 to 13 by inserting them into the Screw Shield and tightening the screws. The order is important or the LEDs will not light in sequence.  You should attach them as shown in the diagram.  It doesn't really matter which one LED you start with for pin 6: what matters is that they are attached in a consecutive sequence (6, 7, 8, ...) not some random order.

Step 14: Attach RFID card reader wires to the Arduino

Picture of Attach RFID card reader wires to the Arduino
14 - 2 - Wire RFID Reader.JPG
14 - 3 - Wire RFID Reader.JPG
In this step, the wires from the RFID card reader will be attached to the Arduino.  You'll need the fine tip screwdriver from the last step for this step.
  1. Insert the red (power) and black (ground) wires to the 5V and GND connections on the Screw Shield and tighten the screws as shown in the first photo.
  2. Insert the green SOUT (serial out) wire to the pin 3 on the Arduino Screw Shield and tighten the screw as shown in the second photo.
  3. Insert the yellow Enable wire to pin 4 on the Arduino Screw Shield and tighten the screw also shown in the second photo.
With the exception of the Arduino's USB cable, all the wiring is now complete and should look like the last photo.

Step 15: Attach USB cable to the Arduino

Picture of Attach USB cable to the Arduino
Attach a USB cable (Male A plug with male B plug) into the Arduino's USB port as shown in the diagram below.

Congratulations!  All wiring is now complete!

Step 16: Install Arduino board and lower platform in the case

Almost done!  Time to put the lower platform into the case and lock it in place.
  1. Carefully and gently turn over the lower platform and set it into the four machine screws attached to the case.
  2. Place washers on each of the screws and thread the nuts onto the screws and tighten.  Do not over-tighten. See the first two photos.
  3. Gently push the wires into the body of the case.  Be careful not block the color changing LEDs or have any wires poking out the top of the case.  See the second two photos.

Step 17: Close and seal the case

This is the last assembly step for the hardware. You'll need a screwdriver, needle nose pliers, and two four inch plastic wire ties for this step.
  1. Place the bottom piece of the case on the top piece.  Make sure that the two USB cables are positioned in the cutout on the back of case (see second photo.)  Be careful not snag any wires in the process. Don't pull on the USB cable for the color changing LED circuit - it's soldered but you could easily damage it and then you'd have to take it apart to repair it. 
  2. Attach the bottom and top of the case together using the screws you saved from the first step.  The sealed case should look like the first four photos.
  3. Now attach the wire ties to the cables and the case as shown in the last two photos.  To get the wire ties in and out of the case, I slipped one end of the tie into the case and used a small needle nose plier to grab the end and pull it out.  These wire ties will prevent damage to the gizmo from pulling on the cables.
Voila!  The hardware for the Arduino Internet Gizmo is now complete!  Now on to the RFID tags and the software!

Step 18: Label the RFID tags

Picture of Label the RFID tags
18 - 2 - Prepare RFID Tags.JPG
For this step, you will need a bunch of 50mm Round RFID tags that match the RFID card reader (Parallax part 28142): these are EM4100 family tags that have a 125 kHz activating frequency.  You will also need a color printer (inkjet or laser), self adhesive labels suitable for use in a printer, scissors, and of course artwork.
  1. Find artwork that you want to use to represent the web site you want to associate with tag.
  2. Using your favorite software, print the artwork onto the labels (I used Avery labels and their online label printing software.)
  3. Cut out the labels and stick them on the tags as shown in the second photo.  You can put the sticker on either side of the tag.
In a subsequent step, the process for updating the program to recognize the tag will be described.

Step 19: Installing the software

Picture of Installing the software
19 - 2 - pyserial.png
19 - 3 - 7-Zip.png
19 - 4 - Arduino.png
The following software will need to be installed on your computer:  Python, the Python pySerial library, Arduino development software, and a utility called 7-Zip.  I developed the gizmo's software on a computer running Windows 7.  All of this software will run on Windows XP, Windows Vista, and Linux. 
  1. Python is used to run the program that will monitor the USB port for data from the Arduino in the gizmo.  I used Python version 2.7.2 for this program. Any version of Python 2.7.x should work fine.  I have not tested the Arduino Internet Gizmo on Python 3.2.x.
    1. To install Python 2.7.x, download the Python 2.7.x Windows installer software from http://www.python.org/download/
    2. After the download is complete, run the installer.  The installer asks where you want to install Python - I had it install it at c:\Python27.  All of the following instructions assume that's where it's installed.  You can install it in a different folder, but you will need to adjust the instructions accordingly.
  2. pySerial is a library for Python that allows it communicate over a serial communication link like USB.  Install pySerial as follows:
    1. Download pySerial from http://pypi.python.org/pypi/pyserial - click on pyserial-2.6.tar.gz to download the library. 
    2. Download and install 7-Zip from http://www.7-zip.org/.  This software is required to open the pyserial tar.gz file. 
    3. Run 7-Zip (Start -> All Programs -> 7-Zip -> 7-Zip File Manager). 
    4. Open the pyserial-2.6.tar.gz file with 7-Zip (File -> Open). 
    5. Double click the "dist" folder.
    6. Single click on the "pyserial-2.6.tar" file and click the "Extract" button at the top of the window.  When asked where to put the file, specify c:\Python27\Lib\site-packages\pyserial-2.6
    7. Exit from 7-Zip
  3. Now that you have downloaded pySerial, install it:
    1. Open a command window (Start -> All Programs -> Accessories -> Command Prompt) and type into the command line: cd c:\Python27\Lib\site-packages-\pyserial-2.6 
    2. Install pySerial by typing this command: c:\Python27\python.exe setup.py install
  4. Download and run the Arduino development software installer from http://arduino.cc/en/Main/Software.
Now download the Arduino Internet Gizmo program files attached to this step:
  1. Download the "arduino-internet-gizmo v1.py" file to "c:\Python27" folder.
  2. Download the "arduino_internet_gizmo_v1.ino" to a folder of your choice.

Step 20: How the software works

The Arduino gizmo software turns on the color changing LEDs, then goes into a loop reading RFID tags, making the LEDs on top of gizmo race in circles when a tag is read, and then sends the data to the PC.  An overview of of the sections of the programs follows - there are detailed comments in the code that explain each line.  The program is shown in the first three diagrams.
  • Line 8 allows the program to use the SoftwareSerial library that the program uses to communicate with the RFID reader
  • Lines 10 - 16 define the Arduino pins used by the program
  • Lines 18 - 23 define the variables used by the program
  • Lines 28 - 36 are run when the Arduino is first powered on or reset.  This code turns on the color changing LED circuit, initializes the connection to the PC and the RFID card reader, and initializes the LEDs on top of the gizmo.
  • Lines 41 - 71 are the main loop for the program.  This loop will run until the Arduino is powered off or reset.  The first thing done in the loop is to check whether the RFID reader has read any data and whether the data read indicates the beginning of a tag.  If so:
    • Lines 44 - 53 read data from the RFID reader until the tag has been completely read.
    • Lines 55 - 63 send the data to the PC.  Three datum are sent: the count of tags read so far, the time that the tag was read, and the tag ID that was read.  The count and time are not used by the program on the PC but are there for debugging purposes and are useful if you want to use this code for other Arduino RFID projects.
    • Lines 64 - 68 temporarily turns the RFID card reader off, makes the LEDs on top of the gizmo race around, and then sleeps for a short time.  The RFID reader is turned back on and the program loops back to the top.
  • Lines 74 - 88 are a subroutine that makes the LEDs on top of gizmo illuminate in sequence and appear to race around in circles. The input to the subroutine is the number of times to race around and the the number of milliseconds to keep each LED illuminated.
  • Lines 90 - 98 are a subroutine that initializes the pins for the LEDs and sets them to be output pins.
The Python gizmo program runs on the PC and loops waiting for data to be sent by the Arduino.  When data is received, the program looks up the tag ID in a table to find the associated web site.  If the tag ID is in the table, the program uses a Python library called "webbrowser" to open a new tab in the default browser on the PC and load the web page.  If the browser isn't running, "webbrowser" will start it.  If the tag ID is not in the table, the programs creates a HTML file with an error message with the tag ID and displays that in a new tab in the browser.  An example is shown in the last image.  The program is shown in fourth, fifth, sixth, and seventh diagrams.  An overview of program follows:
  • Lines 12 - 15 import the libraries for creating and writing to files, communicating with the Arduino, parsing the data sent from the Arduino, and controlling the web browser.
  • Lines 20 - 34 are the table (dictionary in Python terms) used to associate the tag IDs with web sites.  Each line has the ten character RFID tag ID and a HTTP link to the web site.  Note that the first tag has "quit" for the web address.  If this tag is read, then the program will end.  New tags can be added by duplicating the last line and replacing the tag ID with the new tag and putting in the web site you want for the tag.
  • Line 37 defines what COM port the program will use to communicate with the Arduino.  This is the same COM part that is used by the Arduino development software to load the compiled program into the Arduino.  You should change this to match your system.
  • Line 42 is the name of the file that the program creates when an unknown tag is read.  This file is created in the directory where you installed Python.  In my case, it was "c:\Python27". 
  • Lines 45 - 54 use the pySerial library to connect to the Arduino.  Messages will be displayed in the Python window indicating whether the connection was made or not. 
  • Line 56 checks to see whether the connection was successful. If the connection was made, processing will continue otherwise the program will end.
  • Line 58 sets a variable that is used to determine whether a duplicate tag has been read.  The idea is to prevent the same web site from being opened in the browser if the RFID reader happens to read the tag more than once when it placed over the reader.
  • Lines 62 - 63 use the "pySerial" library to read the data from the Arduino.
  • Line 66 checks to see if data has been read.
  • Lines 68 - 74 use the "shlex" library to break the data from Arduino into three parts: the count, the time, and the tag ID.
  • Lines 76 - 78 call a function to lookup the web site based on the tag ID. The tag ID and web site in the Python are displayed in the Python console window for debugging purposes.
  • Lines 81 - 82 check to see if this is the special tag used to stop the program and if so, the program exits the loop and the program ends.
  • Line 86 checks to see if the tag just read is the same as the previous one.  If so, it loops back to the top.
  • Line 87 uses the "webbrowser" library to start the browser if not running and then open a new tab for the web site.
  • Line 88 saves the tag just read to prevent duplicate sites from being displayed.  The program then loops back to wait for another tag.
  • Lines 90 - 104 are the function that is used to lookup the web sites associated with the tag ID:
    • Line 93 checks to see if the tag ID is in the dictionary
    • Line 94 returns the web site if the tag ID was in the dictionary.
    • Lines 98 - 100 build the HTML for the error message for the unknown tag.
    • Lines 101 - 103 use the "sys" library to create a HTML file, write the HTML to the file, and close the file.  If the file happens to already exist, the HTML in the file is overwritten with the new HTML.
    • Line 104 returns the name of the file.  Back in the main program, the web browser will open this file rather than a web site and display the error message.
  • Lines 107 - 111 allow you run this program from the command line and pass in the name of the COM port as a parameter rather than modifying the program.  See the next step for details on how to use this.
I've tested the software with a variety of web browsers: the "webbrowser" library works fine with Firefox, Safari, and Internet Explorer.  It does not work properly with Opera.

Step 21: Operating the Arduino Internet Gizmo

Picture of Operating the Arduino Internet Gizmo
21 - 2 - Arduino Internet Gizmo Unknown Tag.png
21 - 3 - Gizmo Python Window.png
The first step to operating the Arduino Internet Gizmo is to compile and download the gizmo's program to the Arduino. 
  1. Navigate to the folder where you installed the Arduino development software and start the program (arduino.exe).
  2. Plug the USB power adapter for the gizmo into a power outlet.
  3. Plug the gizmo's USB cable in to your computer.  If you get error messages about drivers not found, see the documentation on the Arduino web site.
  4. Load the gizmo's software: File->Open, go to the folder where you stored it, and open "arduino_internet_gizmo_v1.ino"
  5. Set the board to Arduino Uno: Tools -> Board -> Arduino Uno (or what version of Arduino you are using)
  6. Set the COM port: Tools -> Serial Port -> COM6  (this was the setting for my system, the Arduino software documentation will show you how to find what port your to which your Arduino is connected.
  7. Click the upload button (the circle with the arrow) right below the edit button in Arduino development software window.
  8. The program will compile and download.  You'll see one of the LEDs on the top of gizmo flash a few times as the software is being loaded.
  9. The red-blue-green color changing LEDs behind the grill should illuminate and start changing colors.  This is your indication that the gizmo is now operational.
You only need to download the software to the gizmo once.  You can power the gizmo off and on again and the program in the Arduino will remember the gizmo program and will start automatically.

Next, start the Python program on the PC:
  1. Open a command prompt: Start -> All Programs -> Accessories -> Command Prompt
  2. Change the directory to the Python directory: type cd c:\Python27 
  3. Start the program by typing: python.exe arduino_internet_gizmo_v1.py
  4. The program will connect to the gizmo and you should see the messages indicating the Arduino was connected like in the first photo.  If you get an error message that the program can't connect, you are most likely using the wrong COM port.  Double check and try again.  If you're using a different COM port than the one in the Python program, you can either change line 37 in the program or specify the COM port when you run the program like this: python.exe simple_internet_gizmo_v1.py COM7
Now that you're connected, you can start reading tags.  Of course, since this is the first time you're using the gizmo, none of your tags will be in the table.  So, here's what you need to do:
  1. Read a tag and when you get the error message in the browser about an unknown tag, copy the tag ID, paste it into the table in the python program and update the associated web site.  The second photo shows an example of an unknown tag error page.
  2. Repeat this for all of your tags.  Don't forget to use one of your tags as the "quit" tag.
  3. Restart the python program and you'll be ready to have the gizmo bring up web sites on your command! 
You can repeat this process as many times as you want to add new tags.  Note: since all RFID tags have unique IDs, the tags I have listed in the program will work for me but not for you - you should delete my entries and replace them with ones for your tags.

The third photo shows what is displayed by the Python program in the command window when tags are read.  The first line for each tag is the data read from Arduino and the second line is the tag and associated web site.  Note that sometimes the RFID reader will read a tag multiple times when it's placed by the reader - that's why the Python code looks for duplicates and ignores them.

Enjoy your Arduino Internet Gizmo!

Step 22: Complete Parts List

Picture of Complete Parts List
Each step in this instructable lists the parts and tools required.  This step contains a consolidated list of all of the parts, tools, and software required to make the Arduino Internet Gizmo.

Electronic/Electrical Parts:
  • 1 Arduino (I used an Arduino Uno)
  • 1 Arduino Screwshield kit (Solarbotics part 51865)
  • 1 Serial RFID card reader (Parallax part 28140)
  • Bunch of 50mm round RFID tags (Parallax part 28142)
  • 5 Red Blue Green color changing LEDs
  • 8 Large red LEDs (T2-1/2 LHR3930 Jameco part 119634)
  • 5 Resistors - 100 ohm 1/4 watt (Radio Shack 271-1311)
  • 8 Resistors - 360 ohm 1/4 watt (Radio Shack 271-1315)
  • 1 4-Pin optcoupler Lite-On LTV-817 (Jameco 878243)
  • 1 Screw terminal (Jameco 2094485)
  • 1 Adafruit Perma-Proto Quarter-sized Breadboard Printed Circuit Board (Adafruit PRT-589)
  • 1 4-Position dual row barrier strip (Radio Shack 274-658)
  • 1 USB cable with a male type A connector on one end
  • 1 USB AC power adapter
  • 4 12" Male-Female jumper wires (Sparkfun PRT-09385) - red, black, yellow, and green
  • 48" Stranded black wire (#26 AWG)
  • 48" Stranded blue wire (#26 AWG)
  • 7" Solid core black wire (#24 AWG)
  • 4.5" Solid core green sire (#24 AWG)
  • 18" Solid core any color  (#24 AWG)
  • 6" 3/32" Diameter heat shrink tubing - black
  • 6" 1/16" Diameter heat shrink tubing - blue
Hardware
  • 9 1/4" round nylon #4 spacers
  • 6 #6-32 x 1/2" Round head machine screws
  • 10 #6-32 Nuts
  • 5 #4-40 x 3/4" Round head machine screws
  • 5 #4-40 Nuts
  • 4 #10-32 Round head machine screws
  • 16 #10-32 Nuts
  • 16 #10 Flat washers
Miscellaneous Parts
  • Power supply from a PC (preferably an ATX case)
  • 4 Vinyl bumpers (rubber feet)
  • 2 4" plastic wire ties
  • 2 6" x 6" 1/8" thick sheets of acrylic (I used transparent blue and fluorescent red)
  • Self adhesive labels suitable for use in a color printer
  • 5 Minute Epoxy
  • Goo Gone or similar adhesive remover
Tools
  • Soldering iron and solder
  • Phillips head screwdrivers
  • Precision (fine tip) flat head screwdriver
  • Wire strippers
  • Wire cutters
  • Small pliers
  • Needle nose pliers
  • Small knife or box cutter
  • Heat gun or other suitable heat source for heat shrink tubing
  • Epilog laser cutter or saw and drill for cutting acrylic
  • Color printer (laser or inkjet)
  • CorelDraw or Adobe Illustrator (optional)
megaduty2 years ago
I b lov'n your project! Nice ible!
IAmButAnEgg2 years ago
This is so cool! And I love that it exists mostly to be a fun gizmo - just for the joy of it. Voted for it!
Turtlepwr2 years ago
Nice artistic flare
jschrempp2 years ago
Wow, fantastic project Bruce. You put a lot of details into the steps, which is great. The box is a thing of beauty!
talk2bruce (author)  jschrempp2 years ago
Thanks! I had a lot of fun with this one. I was surprised how long it took to document it compared to making it! :-)
This is pretty awesome, voting for you!
talk2bruce (author)  Collin Amedee2 years ago
Thanks!
Cool.