International Keyboard Mapping Fun

I’ve had requests from folks outside the US asking how to get the arcane keyboard commands needed for the screen program in OSX. For those who’ve used screen commands, you know that to get out of a screen session, you hit control-A followed by control-\ and then respond Y when it asks if you want to close all screen windows. On the Norwegian keyboard mapping of OSX, we could find no way to get control-\. So we found a workaround. Change the keyboard layout to the US keyboard, like so:

Continue reading “International Keyboard Mapping Fun”

Sending Mail from Processing

Here’s a piece of code to send mail from Processing. It uses the net library. Warning: your mail server may not use port 25.

/* mail_client
 by Tom Igoe
 
  A simple mail sender client
 Created 21 January 2006
 */

import processing.net.*; 
Client myClient; 
int clicks;
String reply = null;
boolean sent = false;
void setup() { 
  // Connect:
  myClient = new Client(this, "echonyc.com", 25); 
  delay(300);

} 


void draw() { 
  if(!sent) {
    waitForReply();
    myClient.write("HELO echonyc.com\n");
    waitForReply();
    myClient.write("MAIL FROM:tigoe@echonyc.com\n");
    waitForReply();
    myClient.write("RCPT TO:tigoe@echonyc.com\n");
    waitForReply();
    myClient.write("DATA\n");
    waitForReply();
    myClient.write("Subject:Noodles\n");
    myClient.write("From:tigoe@echonyc.com\n");
    myClient.write("To:tigoe@tigoe.net\n");
    myClient.write("\rHere's the body\n.\n");
    waitForReply();
    myClient.write("QUIT\n\r");
    waitForReply();
  }
  sent = true;
} 


void waitForReply() {
  int newChar = 0;
  while (newChar != 10) {
    if(myClient.available() > 0) {
      newChar = myClient.read();
      reply += (char)newChar;
    }
  }
  println(reply); 
}

RFID Reader and Image Display

This program reads ID Innovations ID-12 RFID readers and matches the tags against a list of known tags. It’s an illustration of how to use an RFID reader to associate data with a set of tags.

/*
  RFID Reader and image display
  Language: Processing
  
  This program reads ID Innovations ID-12 RFID readers rom two serial ports.
  It matches the tags against a list of known tags, and uses the match to 
  associate a name with the tag.  It also scans the sketch's data directory
  to load an image associated with the name.
  
  Created 12 Mar 2008
  by Tom Igoe and the interaction design class at AHO, Spring 2008
  directory reading and image scanning based on an example from Marius Watts

*/

Continue reading “RFID Reader and Image Display”

Reading Multiple Serial Ports in Processing

This program reads multiple serial ports and lets you know when data comes from one port or the other. The two ports in this example are attached to ID Innovations ID-12 RFID readers. The ID-12 readers send a string that ends with a byte whose value is 0x03.

/*
   Multiple Serial Ports
   Language: Processing

   This program reads multiple serial ports and lets you know when data comes 
   from one port or the other. The two ports in this example are attached to 
   ID Innovations ID-12 RFID readers. The ID-12 readers send a string that ends 
   with a byte whose value is 0x03.
   
   Created 12 Mar 2008
   by Tom Igoe
*/

Continue reading “Reading Multiple Serial Ports in Processing”

XBee Library graphing and logging application

Here’s a program that uses Rob Faludi and Dan Shiffman’s XBee library for processing to read three analog sensors from multiple remote XBee radios and graph them. It also saves the data to a comma-delimited file. It also makes sounds when the value exceeds a given threshold. For this application, you need two or more XBee series 1 radios. One is attached to the serial port of the computer, and the other is remote, broadcasting three analog values.

This also uses the ControlP5 library by Andreas Schlegel and the Ess library by Krister Olsson.

Continue reading “XBee Library graphing and logging application”

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”