Mr. Data Converter

Mr. Data Converter is your friend. It’s a conversion tool to take tab or comma delimited data and convert it to a variety of formats: XML, JSON, ActionScript, PHP, you name it. Mighty handy if you have to take stuff from one place and move it to another.

Thanks to James Tu for the link.

Blog Housekeeping

I’m making some changes to this blog. I’ve been unhappy about the fact that all the code is static, not the code I use every day. Instead, I want a nice code repository, so whatever I write on my machine can be published directly, and if I update it, the updates end up here. I would also like syntactical highlighting of the code. And now, ta dah! It’s all done. Here’s what I did, for your reference and my own, because I’ll forget next time I need to update it.

So from now on, new code on this blog will look like this:

[include file="../../code/Arduino/helloTom/helloTom.pde" start="3" clean="true"]

And it’ll all be updated whenever I make changes.  Exciting, isn’t it?

Continue reading “Blog Housekeeping”

Traceroute scraper in Processing

There are many web-based interfaces to traceroute available, including a nice list at traceroute.org.  Here’s a Processing sketch that retrieves the raw HTML from one of them and separates the traceroute lines into time taken, hop IP, and hop name.

This sketch can be modified to scrape other web-based traceroute apps, but you’d need to change the last two methods, parseHop() and printHopList(), depending on how your particular app formats the results. You’d also need to change the global variables at the top that pertain to the site being used.

One caveat: the traceroute takes some time.

To see the full output of the HTML call, change debug to true.

Continue reading “Traceroute scraper in Processing”

Chat Server in Processing

Here’s a basic chat server written in Processing.  It’s a bit more complex than the basic test server.  This server keeps track of all the clients who log into it in an ArrayList.  Using an ArrayList is useful when you need to do more complex things with the clients, as in my pong server from Making Things Talk. This is the most minimal server I could come up with that keeps a list of its clients.

Continue reading “Chat Server in Processing”

A Tale of Two (three) Pongs

Created 2 April 2009, updated 1 Nov 2020

When I start learning a new  platform, I have a simple rule: If you don’t know what to do with it, make pong. What I love about pong is that it’s a simple rule set, easy to understand, and implementable on just about anything with a pixel display.  You can generally implement it in a day or less on any platform. And it’s a great example of engaging interaction.  People understand what’s going on right away, and, when implemented well, it’s just challenging enough to keep you engaged for several minutes at least.  That’s good interaction, to me.

I’m a big believer in starting with the application rather than the platform.  I think you do better work when the tools serve the need rather than the other way around.  But sometimes you get stuck with the assignment to learn a particular platform or tool, and you have to make up a project on the spot.  When that happens, make pong.

As an example of this, I built pong for two platforms yesterday [1 April 2009]: an Arduino Mega with 2 8×8 LED matrices (based on my earlier post), and Processing.  Since Arduino’s programming syntax was based closely on Processing’s, I figured it should be possible to port the code from one to the other pretty quickly. It took about ten minutes to go from Arduino to Processing.  In 2020, I updated this exercise to write the program in p5.js as well. Following, I’ll describe the thought process of putting the game together for all three, as a hopeful aid to beginning programmers.

Continue reading “A Tale of Two (three) Pongs”

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 “RFID to Web Interface”

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 “Arduino-based RFID reader”

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 “Writing to Mifare RFID tags”