SQL RESTian example in PHP

Here’s a PHP script that reads and writes from a SQL database. This example assumes you’ve got a SQL database account on the same machine that the script is running on. It also assumes you’re using a .htaccess file that looks something like this:

RewriteEngine On
RewriteBase /directoryname/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ sqlRestDatalog.php

Continue reading “SQL RESTian example in PHP”

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”

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:


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:


Continue reading “Arduino-based RFID reader”

Sensorbase datalogger

Sensorbase.org is an open data repository run by the Center for Embedded Networked Sensing at UCLA. It’s a database of sensor databases. You can upload datasets to it, and you can browse other datasets as well. If you’ve never set up a database before but are interested in logging sensor data, it’s a good tool to get started. If you know what you’re doing already and you need to log a lot of sensor data, or compare it to similar work from others, it’s a convenient tool.

Since I like working with sensors and microcontrollers connected directly to the Internet, I thought it would be useful to be able to put data directly into Sensorbase from sensors connected to a microcontroller, without a personal computer in between.

Continue reading “Sensorbase datalogger”