TINI & 1-Wire

Building Binaries
Example Servlets

  • NEW TINI is Online!

    I've been wanting to have a TINI to play with online for a while, and recently I came across a 2x40 character LCD display, so I hooked it up and found a decent project box for the socket board and put it on the net. I whipped up a quick and dirty servlet to display messages on the LCD, so now you can send a message to the TINI LCD using the form below, go for it! Grafiti in the 21st Century!

    Send A Message to the TINI LCD





    Message Log

    WEBCAM! - See your message on the TINI - here is a completely abused philips webcam which will show pictures of the TINI LCD when the wind is in the right direction.

    There are also working versions of the example servlets below, which may or may not be hooked up to 1-Wire devices connected to weird and wonderful thing here in the lab, depending on what I'm up to. These servlets are served by the superb TiniHttpServer which is easy to set up, works a charm and is released under the GPL. Yay!

    You can click here to access the TINI board and have a play

  • TINI - Tiny Internet Interface - Very cool little fellows these, Java VM, TCP/IP, 1-Wire, ethernet, serial, CAN, etc. all on a 72 pin SIMM form factor. I'm finding my way around it and posting anything I think might be useful here.

      


    Get the latest TINI software from ftp://ftp.dalsemi.com/pub/tini/

    Don Loomis' book, The TINI Specification and Developers Guide is an invaluable companion to get started developing with the TINI.

    Turn your TINI into a fully servlet enabled HTTP server using TiniHTTPServer from Smart Software Consulting.

    The revision A TINI socket board has the solder pads in place for connecting an alphanumeric LCD module to TINIs bus. I just got mine hooked up and working, here's how.

  • 1-Wire - Dalsemi/Maxim produce a range of chips for various purposes such as temperature measurement, A/D conversion and switching that can communicate with TINI (or any enabled host) over a 1-wire network. The one wire network only requires one data connection and ground with each device on the network being identified using a unique 64-bit address.

    These little chips can be used to really bring TINI to life interacting with the outside world switching devices and monitoring conditions.

  • They also manufacture a range of devices called ibuttons. These are 1-wire enabled devices enclosed in durable metal cans about the size of a few stacked pennies. There are devices for a variety of aplications such as electronic tagging, temperature monitoring and cryptographic applications. Very cool.
    Programming for 1-Wire devices is a pretty pleasant experience thanks to the Java 1-Wire API provided by Dallas, which incorporates a set of device containers that expose the functionality of each of the 1-wire device families.

    1-Wire products and datasheets can be found here.

Building TINI Binaries

Once you have compiled Java classes from their source, they need to be converted to TINI's binary format before they can be used. Dallas provide two utilities for creating binaries - TINIConvertor and BuildDependancy.
These are well documented in the files Building_Applications.txt and BuildDependency_README.txt included in the TINI distribution.

Basically TINIConvertor is used to build the TINI binary and can be used directly if your program does not depend on any classes that are not included in the standard TINI API.

Make sure that tini.jar from the TINI SDK is in your class path and then the syntax is:

java TINIConvertor -f <class file> -o <output file> -d <TINI install dir>/path/to/tini.db

If your program depends on classes that do not make up part of the TINI API, such as OneWire containers then BuildDependency must be used. This builds in extra dependencies before calling TINIConvertor to build the binary.

Again with tini.jar in the classpath, the syntax is:

java BuildDependency -f <class file> -o <output file> -d /path/to/tini.db -add <dependency list> [-x <dependency file>] [-p <dependency location(s)>]

Where dependency list is a colon seperated list of dependencies to include, e.g. OneWireContainer04;OneWireContainer21

Here are a few shell scripts to keep the typing to a minimum...


However, a far better way of automating the build process of TINI applications is to use TiniAnt, which is an extention to Apache Ant *the* cross platform build tool. TiniAnt adds a new task type, <tini> to ant that really takes the pain out of building large TINI projects with complex dependencies.

1-Wire Example Code

The source for some sample servlets using the 1-Wire API to control and monitor several devices can be downloaded below. These work fine on TINI in conjunction with
TINIHttpServer, but note that the code has not been optimised for TINI's JVM. They will also work on other platforms that support Java and 1-Wire such as a PC equipped with a DS9097U serial to 1-wire adapter and running a suitable servlet container such as Jakarta Tomcat.

  • DS2406Servlet - The DS2406 (Family code 0x12) is a dual addressable switch with 1K-Bit of onboard EPROM. This servlet locates any DS2406s on the default adapter and reads the state of the port pins and output latches for both channels. It also allows the state of the output latches to be changed at the push of a button.

  • DS18B20Servlet - The DS18B20 (Family Code 0x28) is a programmable resolution digital thermometer. This servlet locates any family code 0x28 devices on the default adapter and displays the current temperature reading. It also allows the resolution to be set, shows the alarm status and allows the high and low alarms to be set if present.

  • DS2450Servlet - The DS2450 (Family Code 0x20) is a quad A/D convertor. Pins not used as inputs can be controlled as outputs. The device features programmable range, resolution and alarms. This servlet locates each family code 0x20 device connected to the default adapter and deisplays the raw voltage level at each of the input pins. It also allows setting of the range, resolution, alarms and output latch state of each pin.

  • DS2890Servlet - The DS2890 (Family Code 0x2C) is a linear taper digitally controlled potentiometer. This servlet locates each family code 0x2C device on the default adapter and allows the wiper position to be set.

  • DS2404Servlet - The DS2404 (Family Code 0x04) is a real time clock/calendar with 4096 bits of non-volatile memory. This servlet simply locates each family code 0x04 device on the default adapter, checks that the clock is running and displays the current time and date. Some quick and dirty code to set the DS2404's time to the current system time can be found here.

To build the servlets into TINIHttpServer, the build.properties file in the source distribution must be modified. Specifically, alter the servlet.src property to reflct the locations of the servlet source and the onewire.deps property to include any dependencies. I found it easier to alter onewire.deps to a colon separated list of dependencies rather than using THS_ALL ro THS_MIN as this gives more control as to what is compiled in.

Systronix do a nice line in TINI accessories, and also a bunch of other cool embedded Java stuff. The 8x1 Wire I/O board is a good for getting started with 1-Wire as it has four DS2406s to give 8 bidirectional I/O ports. It also has a push switches, LEDs and a buzzer jumpered to the I/O ports.

The source for a little quick and dirty program to test the 2406s on the Systronix board is here