logo
Published on IPv6style (http://www.ipv6style.jp)

The Making of IPv6 Module for Electric Blocks

By admin
作成日時 2003-10-29 00:00
The Making of IPv6 Module for Electric Blocks (2003.10.29)

Hiroyuki Inoue
Internet Research Institute (IRI)




25 years ago, a Japanese company Gakken started selling a product series called Denshi Burokku (Electric Blocks). It had transistors, resistors or other electrical parts in blocks. Various electric circuits, such as a radio and an amplifier could be made by placing these blocks in the right positions in a frame like a puzzle. Last year, Gakken re-launched EX-150 of the Denshi Block product series as part of Otona No Kagaku (Science for Adults) series. I decided to make an IPv6 communication module as a functional block for EX-150. I managed to make one, and I would like to tell you about it.


How I decided to make an IPv6 module

Electric Blocks and its revival edition are explained in detail on the Web of Gakken [1] (only in Japanese). Electric Blocks series was launched in 1976. You must be over 30 years old if you feel familiar with the series. I was one of those boys who could not convince their parents to buy one. I played with it at my friend's home. That's why I made a reservation and bought this kit on the day of re-launch.

Although I finally got the kit I once dreamed of, I was not that curious kid any more. It was'nt that fun playing with it, and I gave it to my child. But in July 2003, Gakken released an “Extension Kit [2]” as an option for the Electric Blocks EX-150. This kit contained a full-color LED, a photo transistor, a timer IC and other more recent electric parts, enabling a variety of experiments not possible with the original Electric Blocks. Then I heard that entry deadline for IPv6 Appli Contest [3] Implementation award for the first phase was approaching. I was beginning to think that it would be fun to come up with an IPv6 communication module for Electric Blocks.

I decided to make an IPv6 module with the following characteristics:
Choosing a Controller and Sensors

A controller (embedded CPU board and an OS to run it) is necessary to connect Electric Blocks to IPv6 network. I also had to consider how I could enable necessary input and output with the limited wiring flexibility and the number of contacts with Electric Blocks. At first, I considered using a business-card sized CPU board that can run embedded Linux, but I couldn't find a good one (I had financial limitation, too). For sensors, I thought of using 1-Wire Interface [4] devices by Maxim Integrated Products (now the parent company of Dallas Semiconductor). 1-Wire is a simple electrical bus for connecting temperature sensors, digital/analog I/O sensors and other functional ICs. Two or three wires are all that are needed to connect these sensors, including electric supply (simply put, it is a bi-directional data communication with one signal line and one ground line). It is a bus, so two or more sensors can be connected in parallel to one wire. The device is small enough to be made into a block. I decided to use this for sensors.

For the controller, I decided to use “IPv6 electric appliance controller [5]”, which I got when I participated in a past IPv6 field trial. This device has TINI CPU board [6] by Maxim, with 1-Wire interface and Web server functionality. It also came with IPv6 stack by Yokogawa Electric [7], which I thought would accelerate the development process. In fact, I had thought all along that I might be able to use this device, but I looked for other alternatives because the board was too large. But I couldn't find a good controller, so I went back to this device, disassembled it and looked at the board. Then I thought, “Maybe I could get this in the Electric Block if I trimmed unnecessary part of the board.” I looked closely at TINI circuit diagram, determined where I thought was unnecessary, and cut those parts off. Fortunately, the board did work despite the trimming work. But still it was large for Electric Blocks frame, leaving only one row (eight blocks) of room for other blocks. Later, this gave me a real headache what circuit I could build for demonstration purpose.

The next thing to do was to incorporate this board in a “block” so that it can fit in Electric Blocks frame, and give it contact points to connect to other blocks. It was not so hard. I bought an acryl board and copper board for contacts, and assembled a block as large as 40 normal blocks (8 by 5). For Ethernet connector and serial port, I thought of placing them on the upper face of this self-created block. But space consideration made me decide to pull the cables out of the block outside. The original Electric Blocks get 6-volt electric supply from four 1.5-volt AAA batteries. But the controller I used accepted only 5 volt. I decided to give Electric Blocks AC supply, to make it ready for long hours of operation, too. I got DC 5 Volt AC adapter, placed an AC adapter connector in an open space of Electric Blocks and connected to wiring inside. That was the end of hardware development.

Electric Blocks with IPv6 module [7] Appearance of IPv6 module [7]
Electric Blocks with IPv6 module Appearance of IPv6 module


Application Circuit

With IPv6 module in the Electric Blocks frame, there was only eight blocks of space left. I had to think of an interesting application circuit within this limitation. I wanted to get some signals from a sensor block in order to display the information to Web browser through IPv6 network, as well as perhaps let users control sounds and lights through the browser. For the input, I decided to measure the (atomospheric) temperature. For output, I didn't like a simple switching on/off of LEDs, so I decided to use “Melody IC Block” and amplifier available outside the frame in Electric Blocks kit, for switching on/off of melody by digital output (1 or 0). Melody IC Block came with the expansion kit.

As for 1-Wire devices to be used as sensors, I got temperature sensor IC (DS18B20 [8]) with three terminals, and digital I/O IC (DS2406 [9]) also with three terminals. These ICs were incorporated in electric blocks unused for this project. I gave the block an LED to know digital output and input.

Appearances of modified block and overall diagram are shown below. I managed to build the application circuit in eight blocks. However, signal terminals of the IPv6 module were positioned for this specific application circuit.

Temperature sensor block Digital I/O block with LED
Temperature sensor block Digital I/O block with LED

Overall diagram [9]
Overall diagram



Control Program

Computer clients at the other end of IPv6 network don't need anything special for displaying information and remote control. The IPv6 module controller needs to run a program to talk with 1-Wire sensor IC and hand the output in HTML to the Web server. IPv6 protocol stack is available on the controller, so programs don't have to care about it except for addressing.

HTML-parsing program on the controller was built in cgi-bin, as it had to produce dynamic pages to show real-time information from the sensor. TINI board used as the controller is equipped with Java virtual machine, so Java language had to be used for programming communication with sensors and HTML parsing. Let me show you a part of the program, although it has little to do with IPv6. In the program section below is for communicating with temperature sensor through 1-Wire, getting the information fed from it and produce a HTML page. Maxim has made 1-Wire communication library available, so the functions from this library are used. I think you can imagine what is done by function and method names.

Java Program Example (part of information input routine from temperature sensor IC)
/* get current temperature from sensor */
dsport = OneWireAccessProvider.getDefaultAdapter();
OneWireContainer owc = dsport.getDeviceContainer();
String devname = owc.getName();
try {
  tc = (TemperatureContainer) owc;
  if (tc != null) {
    sowrite(sock, "‹img src=\"/images/temp-block.jpg\" alt=\"Temp. block\" height=\"66\" width=\"44\"›");
    sowrite(sock, " font size=\"+2\"›Temperature Sensor Block (" + devname + ")‹/font›‹br›\n");
    byte[] state = tc.readDevice();
    try {
      tc.doTemperatureConvert(state);
    }
    catch (Exception e) {
      sowrite(sock, "Temperature conversion failed.\n");
    }
    state = tc.readDevice();
    double temp = tc.getTemperature(state);
    sowrite(sock, "‹font color=\"red\"›");
    sowrite(sock, " Current Temperature: " + temp + " C‹br›\n");
    sowrite(sock, "‹/font›");
    sowrite(sock, "‹A href=\"/cgi-bin/main\"›‹img src=\"/images/refresh-button.gif\" alt=\"refresh\""
      + " align=\"middle\" border=\"0\" height=\"22\" width=\"91\"›‹/A›\n");
    sowrite(sock, "<- Refresh temperature reading‹BR›");
    sowrite(sock, "hr›\n");
  }
}
catch (Exception e) {
  tc = null;
}
		  
It is easy for me to explain the program easily now, but I had to do a lot of learning when I started programming for this project. I read all the sample programs on Maxim Web pages and tried them in a typical trial and error. It was the first experience for me to write such a long program in Java, so I had to check each function and method on the Web while programming.

Below is the main page produced by Java program running on the controller. Here, you can read information from sensors, or configure some parameters.

Web interface for IPv6 module [9]
Web interface for IPv6 module



I could do more

The CPU board I used is not manufactured anymore. It is too large anyway, so I am thinking of making another module with smaller CPU board with embedded Linux with IPv6 stack. The controller needs to be smaller than 5 by 3 blocks in order to be used with water level sensor, siren or other application circuits.

There are a variety of 1-Wire devices [10], including EEPROMs, and analog input or analog output ICs. An EEPROM can be used to store static IPv6 address, to configure the IPv6 address of the entire IPv6 module just by connecting the block.

The actual IPv6 module is currently displayed at GALLERIA v6 Marunouchi [11], an IPv6 showroom in Tokyo. Please have a look if you are interested.


この記事のトラックバックURL

http://www.ipv6style.jp/trackback/606

Source URL:
http://www.ipv6style.jp/en/apps/20031029/index.shtml