Introduction: Simple Internet Gizmo

Picture of Simple Internet Gizmo
Recently I published an instructable called the "Arduino Internet Gizmo" which combines a RFID card reader, an Arduino, and a bunch of LEDs and other components to create a device that uses RFID cards to display favorite web pages in a web browser.  It's a cool instructable but  its construction requires laser cutting of acrylic sheets, lots of parts, soldering, and wiring.  This instructable shows how to build a very simple of version of the Gizmo that can be constructed in less than an hour.

The gizmo works by placing a RFID tag on the top of the gizmo.  The gizmo then 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 to display the web page.

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

This video demonstrates the Simple Internet Gizmo:


I made this at TechShop.

Step 1: How It Works

Picture of How It Works

The Simple Internet Gizmo consists of a Sparkfun RFID card reader mounted in a plastic single gang electrical outlet box connected to a PC using a USB cable as shown in the diagram.  When a RFID card when it is placed near the reader, the reader sends the unique tag number on the card to the PC via USB.  On the PC, a Python program is running in a loop waiting for data from the RFID card reader.  When it receives the RFID card id from the reader, 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. 

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

Step 2: Parts

Picture of Parts
The following parts are needed to build the Simple Internet Gizmo:
  • Sparkfun RFID Card Reader (Sparkfun part number RTL-09875)
  • 3 foot or longer USB cable with type A male plug and a mini-USB male plug on the ends.
  • Single gang plastic electrical outlet box (I used a Carlon 1 Gang Handy Box B112HBR from Home Depot)
  • Electrical plastic outlet box cover that matches the outlet box (I used a Carlon 1 Gang Handy Box Cover HB1BL from Home Depot)
  • Four #4-40 1.5" machine screws
  • Twelve #4-40 nuts
  • Eight #4 washers
  • Bunch of 50mm round RFID tags (Parallax part 28142)
  • Self adhesive labels suitable for use in a color printer
Tools needed:
  • Phillips head screw driver
  • Flat head screw driver
  • Scissors
  • Color printer (laser or inkjet)
  • Goo Gone or similar adhesive remover
  • Electric drill
  • 7/64" Drill bit
  • 7/32" Drill bit
  • Hammer
  • Sharpie permanent marker

Step 3: Prepare the RFID Reader

Picture of Prepare the RFID Reader
The first step is to prepare the RFID reader for mounting inside the box.
  1. The Sparkfun RFID reader comes with packaged with the board and the RFID reader chip as two components as shown in the first photo.
  2. Carefully plug the chip into the board as shown in the second and third photos.
  3. Put the four #4-40 machine bolts into the mounting holes on RFID reader board and secure with the #4-40 nuts as shown in the third photo.

Step 4: Mount the RFID Reader

Picture of Mount the RFID Reader
The RFID card reader is mounted on the top of the outlet box cover as follows:
  1. Place the RFID card reader on the top of the box cover and mark where the machine screws touch the cover with a marker as shown in the first photo.  The RFID card reader should be mounted so that the chip will be right under the knock-out hole in the outlet/switch box.
  2. Using a 7/64" drill bit drill holes at the marked places on the cover as shown in the second photo.
  3. Put nuts on each of the machine screws approximately 1/4" from the end as shown in the third photo.
  4. Place the RFID reader on the cover using washers between the nuts and the cover as shown in the fourth and fifth photos. Make sure the USB plug on the reader is facing inwards. 
  5. Secure the RFID reader to the bottom of the base using washers and nuts as shown in the last photo.

Step 5: Prepare the Top of the Case

Picture of Prepare the Top of the Case
The outlet box needs to be prepared as follows:
  1. Using a flat head screw driver and a hammer carefully break the tabs holding the knock-out plug in place on the top of the outlet box as shown in the first photo.
  2. Remove any stickers on the box.  Goo Gone (or a similar product) may be needed to remove any residue adhesive from the box to make it look nice and neat like the second photo.
  3. Using a 7/32" drill bit, drill holes in the box on the opposite end of the knock-out hole to make an opening as shown in the third and fourth photos.  This hole will be used for the USB cable. 

Step 6: Prepare the USB Cable

Picture of Prepare the USB Cable

Tie a knot in the USB cable as shown in the second photo.  The knot will prevent the USB cable from coming unplugged from the reader if the cable is pulled too hard.

Step 7: Assemble the Gizmo

Picture of Assemble the Gizmo
This is the final assembly step:
  1. Plug the USB cable into the reader as shown in the first photo.
  2. Carefully place the cover onto the base as shown in the second photo.  Make sure the knot in the USB cable is inside the outlet box and the cable is aligned with the drilled hole in the end of the box.
  3. Secure the outlet box to the bottom using the screws that came with the bottom cover as shown in the third photo.
Voila!  You now have completed constructing the Simple Internet Gizmo! 

Step 8: Label the RFID Tags

Picture of Label the RFID Tags
For this step, you will need a bunch of 50mm round RFID tags that are compatible with 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 9: Install the Software

Picture of Install the Software
The following software will need to be installed on your computer:  Python, the Python pySerial library, 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 Sparkfun RFID card reader 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 Simple 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
Download the "simple_internet_gizmo_v1.py" file to "c:\Python27" folder. 

Note: this program was written for the Sparkfun RFID card reader.  If you are building a Simple Internet Gizmo using the Parallax USB RFID card reader, you should use the python program "simple-internet-gizmo v1 for Parallax.py" attached to this step.  The Sparkfun RFID card reader only sends tag information once when the tag is in range.  The Parallax reader will send tag information multiple times when the tag is in range so additional logic is needed in the program to eliminate the duplicate readings.

Step 10: How the Software Works

Picture of How the Software Works
The Python gizmo program runs on the PC and loops waiting for data to be sent by the RFID card reader over the USB connection.  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 of an error message is shown in the last image.  The program is shown in the first four diagrams.  An overview of program follows:
  • Lines 15 - 17 import the libraries for creating and writing to files, communicating with the RFID reader, parsing the data sent from the RFID reader, and controlling the web browser.
  • Lines 22 - 36 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 39 defines what COM port the program will use to communicate with the RFID reader.  You should change this to match your system.  The Quickstart guide for RFID reader on the Sparkfun site shows to determine what COM port is being used by the RFID reader.
  • Line 44 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 47 - 55 use the pySerial library to connect to the RFID reader.  Messages will be displayed in the Python window indicating whether the connection was made or not.
  • Line 58 checks to see whether the connection was successful. If the connection was made, processing will continue otherwise the program will end.
  • Lines 62 - 63 use the "pySerial" library to read the data from the RFID reader.
  • Line 66 checks to see if data has been read.
  • Line 68 extracts just the RFID tag number from the data that was read. The Sparkfun RFID reader sends a few bytes of additional data that need to be removed.
  • Line 69 prints the tag number just read in the python command window.
  • Line 72-73 calls 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 76 - 77 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 79 uses the "webbrowser" library to start the browser if not running and then open a new tab for the web site.
  • Lines 82 - 95 are the function that is used to lookup the web sites associated with the tag ID:
    • Line 84 checks to see if the tag ID is in the dictionary
    • Line 85 returns the web site if the tag ID was in the dictionary.
    • Lines 89 - 91 build the HTML for the error message for the unknown tag.
    • Lines 92 - 94 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 95 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 98 - 102 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.
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 11: Operating the Gizmo

Picture of Operating the Gizmo
Using the Simple Internet Gizmo is easy:

Plug the USB cable from the Gizmo into your PC.  If you get messages about the driver not being found, follow the instructions at the Sparkfun web site here

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 simple_internet_gizmo_v1.py
  4. The program will connect to the gizmo and you should see the messages indicating the Sparkfun RFID reader 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.  The Quickstart guide for RFID reader on the Sparkfun site shows to determine what COM port is being used by the RFID reader. 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 39 in the program or specify the COM port when you run the program like this: python.exe simple_internet_gizmo_v1.py COM6
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 for the changes to take effect.
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 RFID reader and the second line is the tag and associated web site. 

Enjoy your Simple Internet Gizmo!

Comments

Clankatronic (author)2016-06-03

Thank you! I have been messing around with my rfid reader for days trying to write a python program that can read them, i had problems stripping of that extra data before and after the actual tag number. Your code helped me a lot.

nerd7473 (author)2013-12-10

Can this be made to work for raspberry pi

nerd7473 (author)nerd74732013-12-10

?

nerd7473 (author)2013-12-10

Can you make it to where it hooks up to a raspberry pi?

lafnbear (author)2012-06-12

My instructional/elearning bent made me think: This would be a great just-in-time learning tool for a shop or manufacturing environment. Make a picture/nametag card for each tool, production station, etc. in the shop, with an RFID tag on the back, and hang them on a pegboard next to an internet-connected computer. Each tag's ID would be set in the table to go to a webpage (internal or external) with operating instructions, important specs, safety warnings, etc. about that tool or production station.

talk2bruce (author)lafnbear2012-06-14

This is a really great idea!

jschrempp (author)2012-06-11

Bruce, great Instructable. You really simplified the project. Congrats!
Jim

About This Instructable

5,437views

18favorites

License:

More by talk2bruce:Raspberry Pi Internet MonitorLaser Cut Raspberry Pi LCD CaseRaspberry Pi Motion Sensitive Camera
Add instructable to: