Thursday, March 17, 2011

New HomeNet Blog

I've started a new blog dedicated to HomeNet over at

Thursday, February 3, 2011

The Virtual Home

Everything these days is being virtualized so that we can interact with them through our electronic devices. We have virtualized the art of letter writing into email and opening an encyclopedia into searching Wikipedia. We have virtualized ourselves on Facebook, creating a digital representation of ourselves on the internet. We post what we like and dislike about our lives. We list our attributes, what we do, where we live and where we go to school. It's a database of our friends and a history of our lives. In video games we create 3d Avatars that represent our selves as we interact in the virtual world.

It's only logical to think that one day architecture is going to be virtualized into an electronic form. What will this look like? How do we interact with our home virtually? Who is going to design it?

These are questions I've been trying to answer over the last few weeks as I start working on building the user interface for HomeNet. Currently, I'm taking the Facebook approach, building a website that allows you to create a virtual profile of your home. The HomeNet website will allow you to create a detailed profile of your home listing all of it's rooms and properties and allow you to view and control all of the smart HomeNet devices you have. You will be able to personalize each page with photos of your house creating a unique personal link to your home.

I think that the future architect needs to not only design how one physically interacts with the building but also how one interacts with all the electronics and technology the future home will contain. The virtual world is currently dominated by Engineers and Graphic Designers. I think that architects need to get involved so that people have the same quality experience in the virtual building as the do in the physical building. I'm not sure if it's the architects role to design the virtual building but I think that the architect needs to represent the owners interests in it's construction the same way an architect works with a contractor to build a physical building.

Tuesday, January 18, 2011

Arduino: The Documentary

This is a great video on the history of the Arduino project.

Arduino The Documentary (2010) English HD from gnd on Vimeo.

It's hard to believe that arduino didn't exist yet when I graduated high school and now it's the key piece I'm using in my Master's Project

Friday, December 17, 2010

Half way

Well my thesis has officially reach the half way point with the end of Master Project 1. I presented my work to the school and had a great presentation. I had 11 demo's up and running, 8 based on JeeNode hardware and additional 3 running on Arduino (because I ran out of JeeNodes). In the coming days I'll work on posting photos, details and code demos.

Currently I'm spending a week relaxing after some stressful finals and working on fixing some minor issues. This week I added better support of interrupts and started experimenting with implementing a sleep cycle to conserve battery. Next up comes rewriting the processing script to match the updated modular Arduino code.

Tuesday, November 30, 2010

Google Code Setup

Well I finally made the jump and got and my code setup on Google code to start sharing my HomeNet Code. You can also find some documentation on how it all works 1800 lines of code and growing...

Google Code: HomeNet

Tuesday, November 23, 2010

Even More Modular

My last code post simplified things, but many things were hard coded in. These weekend I modularized things so you can choose which network adapters you needs as well as what devices are connected.
#include <ports.>h>
//#include <portslcd.h>
#include <rf12.>h>
#include <homenet.>h>
//#include <homenetdevices.h>
#include <homenetdevicelcd.>h>

//Start HomeNet Packet Stack
HomeNet stack(0x04);//0x01 is RF12 base station //0xFF is PC uplink

//Setup Network Adapters
//HomeNetPortSerial portSerial(PORT_SERIAL, stack);  //PORT_SERIAL tells the adpater which serial serial port to use (for future support of the arduino mega)
HomeNetPortRF12   portRF12(stack);

//Setup attached devices
HomeNetDeviceStatusLights statusLights(stack);
//HomeNetDeviceTMP37 tmp37(stack);
//HomeNetDeviceLight light(stack);
HomeNetDeviceLCD lcd(stack);

//package the setup info in a nice neat arrays
 HomeNetPort*  ports[] = {&portRF12};//,&portSerial}; 
 HomeNetDevice*  devices[] = {&statusLights,  &lcd};// &light , &tmp37};

MilliTimer sendTimer;

void setup() {
  //initize home net with the setup info
  stack.init(ports, 1, devices, 2); 
  stack.registerStatusLights(statusLights); //setup status lights

void loop() {
  //receive incoming packets
  if (sendTimer.poll(10000)){
   // PayloadBuffer buffer;
   // buffer.print("TEST NODE 3");
   // stack.addUdpPacket(0, 2, 0, CMD_STRING, buffer.payload());
    //stack.schedule(2,255,0); //type, toNode, toDevice
  //process packets in the stack- send packets that ready


Thursday, November 18, 2010

More Code

So the code finally reached a tipping it's time to package the code up into a library. I'm calling it HomeNet because it describes its perfectly it's a new home net work and amazingly enough, there isn't anything going by the name yet.

Compared to the long mess of code posted before, Moving most of the code to a library really simplified things:

#include <ports.h>
#include <rf12.h>
#include <homenet.h>

HomeNet stack(0x04);//start stack with a node id
MilliTimer sendTimer;

void setup() {
  // put your setup code here, to run once:


void loop() {
  // put your main code here, to run repeatedly: 
  if (sendTimer.poll(2000)){
    PayloadBuffer buffer;
    stack.addUdpPacket(0, 255, 2, CMD_BYTE, buffer.payload());

and the processing sketch using the library
import processing.serial.*;
import xmlrpclib.*;
import org.apache.commons.codec.binary.Base64; //part of the xmlrpclib

XmlrpcClient homeNetXmlrpcClient = new XmlrpcClient("");
XmlrpcServer homeNetXmlrpcServer = new XmlrpcServer(8081);

final int  NODE_ID = 255;
final int PACKET_TIMEOUT = 150;
PacketStack stack = new PacketStack(NODE_ID);

Serial myPort;  // The serial port

XMLElement xmlConfig;

XMLElement commands[];
XMLElement devices[];

String findXMLid(XMLElement[] xml , int value, String rAttribute){
  String rValue = ""; 
  for(int a = 0; aif(unhex(commands[a].getAttribute("id")) == value){
      return commands[a].getAttribute(rAttribute);
  return rValue;

void setup() {
  size(600, 400);  // Stage size
  //noStroke();      // No border on the next thing drawn
  homeNetXmlrpcServer.add("testserver", this); //setup server
  println("HomeNet XML-RPC Server started at " + homeNetXmlrpcServer.ip()+":8081/RPC2"); // Note that /RPC2 is hard-coded to URI in the Apache Library.
  textFont(createFont("Consolas", 14));
  xmlConfig = new XMLElement(this, "config.txt");
  devices = xmlConfig.getChildren("devices/device");
  commands = xmlConfig.getChildren("commands/command");
  //load the above as hash table from my sevrer.
  // Print a list of the serial ports, for debugging purposes:
  String portName = Serial.list()[1];
  myPort = new Serial(this, portName, 115200);

boolean arduinoBoot = false;
int count = 0;
long sendTimer;
void draw() {
  if(arduinoBoot == false){
    sendTimer = millis();
    arduinoBoot = true;;
  if((millis() - sendTimer) > 2000){
    //DataPacket packet = build_udp_packet(NODE_ID,0,3,2,CMD_STRING,str_to_payload("Hello "+count));
    //packet.status = STATUS_READY;

  stack.tempSerialCheck(myPort); //this is temp until I add support for multiple serial ports, and pass a list of ports to the packetStack
void packetEvent(DataPacket packet){
  packet.status = STATUS_CLEAR;
  Hashtable send = new Hashtable();
  String packetBase64 = new String(Base64.encodeBase64(packet.payload));
  send.put("packet", packetBase64);
  println("Server Reply: "+homeNetXmlrpcClient.execute("HomeNet.addPacket", send));

void serialEvent(Serial port) {
Much easier to use now!