US Home
Automation

(Last updated: Sat. Sept. 5, 2009)
Google
 

IO24 - Elexol EtherIO24 Groovy/Java Package

Note: I'm still putting this page together so no source code yet.

As many may be aware I have an interest in Home Automation. I'm currently thinking of creating my own HA package similar to Mr. House. Instead of Perl I want to use Java/Groovy. I have various ideas but I need to work on them (big time).

This is my first attempt at writing a package (Java or Groovy). Last time I learned Java in a classroom setting was back in 2003. To be honest the class was good but really didn't teach me Java and it's change so much since then. Now I'm sitting down and relearn Java (my God ... it's full of TLAs).

Elexol IO24

The EtherIO24 is an easy device to interface with. It has 24 digital I/O ports.

The EtherI/O24R module is a UDP/IP controlled digital Input/Output module. The module features three 8-bit ports with 5V level signal lines. Each of the 24 lines can be independently programmed as either an input or output.

    import com.linuxha.elexol.*;

    eth = new EIO24("etherio24.uucp");

    eth.send("IO24");

    arr = eth.receive(8+4); // "IO24" + 6 byte mac addr + 2 byte version

    str = '';

    // Translate the first four to ASCII
    arr[0..3].each { str += String.format("%c", it) };

    // Translate the next 8 to hex
    arr[4..11].each { str += String.format(" %02x", it) };

    println("FROM SERVER :${str}");
    // IO24 00 11 ba 01 02 03 01 04

    // Just some info
    // MAC: 00.11:ba.01:02.03
    // Ver: 0104

    // Just screwing around to understand format
    str = String.format("%1\$c%2\$c%3\$c%4\$c", arr);
    println("${str}");

    str = String.format('%1$c%2$c%3$c%4$c', arr);
    println("${str}");

    eth.close();
 

Future - USBIO24

Elexol also makes a USB version of the IO24 board. I also have this board and I'll extend the package to support that board. At the moment I need to really think the class through so I won't have to rewrite the class and it's methods.

    import com.linuxha.elexol.*;

    u = new UIO24("/dev/ttyUSB0");

    u.send("IO24");

    arr = u.receive(8+4); // "IO24" + 6 byte mac addr + 2 byte version

    str = '';

    // Translate the first four to ASCII
    arr[0..3].each { str += String.format("%c", it) };

    // Translate the next 8 to hex
    arr[4..11].each { str += String.format(" %02x", it) };

    println("FROM SERVER :${str}");
    // IO24 00 11 ba 01 02 03 01 04

    // Just some info
    // MAC: 00.11:ba.01:02.03
    // Ver: 0104

    // Just screwing around to understand format
    str = String.format("%1\$c%2\$c%3\$c%4\$c", arr);
    println("${str}");

    str = String.format('%1$c%2$c%3$c%4$c', arr);
    println("${str}");

    u.close();
  • UIO24 source (unavailable)