RFID to Web Interface

This tutorial introduces a Processing interface sketch provides a GUI for the command-line interface written into the Arduino RFID example. You should read that tutorial first. The sketch shown here also allows you to upload tags it reads to O’Reilly’s Emerging Technology Conference attendee portal, and retrieves the resulting profile. The API for this was written by Edd Dumbill. The Processing sketch retrieves RFID tags from the Arduino reader serially, then  passes the tag via a HTTP request to a PHP script on a remote server, shown below,  that adds an authorized login to the O’Reilly site.

Caveat: this tutorial was written specifically for the RFID workshop at Etech 2009.  If you’re doing this on your own, the uploader won’t work because your tags won’t be associated with records in the O’Reilly database, and the PHP script that it calls probably won’t be active on my site anymore.  But you could build your own version on your own server. The PHP code that follows below gives you a start on that process, and the Processing code below can make a HTTP call to any web address you give it.

The entire sketch can be downloaded here:

rfid_uploader_0002

Continue reading

Posted in arduino/wiring, PHP, Processing | Tagged , , , | Leave a comment

Arduino-based RFID reader

This tutorial shows how to make an Arduino-based RFID reader that reads Mifare tags and stores them in EEPROM. It is a modification of Alex Zivanovic‘s code on Tinker.it. Thanks to Alex and Massimo Banzi for the reference. Once you’ve got it running, go on to the RFID to Web example, which provides a Processing interface sketch provides a GUI for the command-line interface written into the Arduino code.

The entire sketch can be downloaded here:

arduino_rfid_reader_0001

Continue reading

Posted in arduino/wiring, PHP, Processing | Tagged , , , | 1 Comment

Writing to Mifare RFID tags

Mifare RFID tags, like other RFID tags, contain a serial number that can be read using an RFID reader, but they also have a limited amount of memory space that you can write data to, and read back from.  This can be handy if you want to do something like keep a user’s account balance or name directly on the RFID tag.

This tutorial shows a number of the functions of my sonMicroReader  library for Processing, including how to write to the memory on tags.  It uses the same circuit as the SM130 reader example. The entire sketch can be downloaded here:

sonmicro_writer_0001

Continue reading

Posted in Processing | Tagged , , , , | 1 Comment

Reading Mifare RFID Tags

This tutorial explains how to read from Mifare RFID tags from your computer using a Sonmicro SM130 read/write module. The sketch below is written in Processing using my SonmicroReader library. The SM130 has a TTL serial interface that you can connect to a micocontroller, or to a personal computer through a USB-to-serial interface.  Using the latter, it’s pretty simple to send serial commands to it and receive the data back. The entire Processing sketch can be downloaded here: rfid_simple_0001.

Continue reading

Posted in Processing | Tagged , , , , | 1 Comment

Sonmicro RFID Reader Library for Processing

Last year, I worked with Timo Arnall and Einar Martinussen and Jørn Knutsen on a Processing library to read and write to Mifare RFID tags using the Sonmicro SM130 read/write module.  Here it is, with a few improvements and bug fixes.

SonMicroReader.zip

To use the library, unzip it and copy the folder to your Processing libraries folder.  Then restart Processing.  There are two example sketches, a simple reader that seeks new tags, and a full read/write example.

For more details, see the datasheet for the module. Code examples will follow in this blog.

Continue reading

Posted in Processing | Tagged , , | 1 Comment

Clock

Here’s a quick digital clock in Processing. It also sends the time out a serial port. I use this for testing when I need for a microcontroller or other serial device to receive a string.

/*
  Clock

 Draws a digital clock in the center of the screen
 and sends the string out the serial port.

 created 7 Oct 2008
 by Tom Igoe
 */

import processing.serial.*;

Serial myPort;    // instance of the serial library

void setup() {
  // open the applet window:
  size(300, 200);
  // initialize the font for text display:
  PFont myFont = createFont(PFont.list()[0], 24);
  textFont(myFont);
  // align all text center:
  textAlign(CENTER);
  // open a serial port:
  myPort = new Serial(this, Serial.list()[0], 9600);
}

void draw(){
  // clear the screen:
  background(0);
  // make a string of hour: minute:second.  Use nf()
  // to format the numbers in two digits each:
  String theTime = nf(hour(), 2) + ":" + nf(minute(), 2) + ":"+ nf(second(), 2);
  // draw it in the middle of the screen:
  text(theTime, width/2, height/2);
  // send it out the serial port:
  myPort.write(theTime + "\n");
  // wait one second before doing it again:
  delay(1000);
}
Posted in Processing | Tagged | Leave a comment

Multiple time stamp checks on a microcontroller

Sometimes you need to manage multiple events with a microcontroller that all require different timing.  For example, you might want to control a servomotor (which requires a 20 millisecond delay), blink an LED once a second, and read some sensors (which should be read as frequently as possible.  One way to handle this is to keep track of a time stamp for each event.  You constantly read the millis() and if enough time has elapsed since the last time a particular event occured, you do it again.

Continue reading

Posted in arduino/wiring | Tagged , , , , | Leave a comment

Fading an LED from a switch

This example uses a digital input to control a fading LED. The LED turns on when the switch goes from off to on, then fades slowly to black.  It illustrates two principles:  the idea of edge detection or state change detection, and the idea of time delay without using delay().

Continue reading

Posted in arduino/wiring | Leave a comment

Using an Accelerometer to Sense Which Way Is Up

ITP just got some nifty flat panel mounts that can rotate 360 degrees. They’re very easy to move, it takes only one hand. When I saw them, I thought, “what good is a rotating mount if the content on the screen can’t rotate too?” So I came up with a little system to sense the screen’s rotation. Here’s how to turn those screens into a very big iPhone. Thanks to Michael Dory for his help in coding this and Dan O’Sullivan for the final clue.

The screens have a mac mini mounted on the back to display digital content. I added an Arduino with an accelerometer mounted on it to sense the angle of the screen’s rotation, then sent that data into Processing.  This example doesn’t do much, but the code can be re-used for any Processing application that needs to know the screen’s rotation.

Rory Nugent modified my existing code and made it much better.  I’ve incorporated his changes here, thanks Rory.

Continue reading

Posted in arduino/wiring, circuits | Tagged , , , , | 6 Comments

Lantronix Analog Sender

Here’s a short Wiring/Arduino program that waits for a connection to the microcontroller via a Lantronix device, and sends out an analog reading when it’s got a connection.

The Lantronix device is in connectMode D4, and the TX is connected to the Arduino’s RX and vice versa.

Continue reading

Posted in arduino/wiring, Lantronix | Tagged | Leave a comment