News and Happenings from the Japanese Linux Pioneer

Wednesday, October 29, 2008

Plat'Home MicroServer in O'Reilly hardware hacks book

The Plat'Home OpenBlockS is featured prominently in the O'Reilly book "Small Form Factor PCs" by Matthew Weaver and Duane Wessels (of squid proxy fame).

The book's chapter 7 describes in detail how to configure the OpenBlockS as a small, carry-everywhere firewall to hook between a PC and the Internet. A handy example they mention is when installing new Windows machines: Between the first connection to the Internet and the time all patches are installed, the machine is vulnerable to attacks. A handy tool for everyone in onsite first-level support.

The explanations are detailed and hands-on. Even though it's filled to the brim with shell commands and console output the text is informative and easy to read. There is even a guide how to solder a cable to power the unit from a USB port (no, this is not covered by our warranty).

As the guide was written in 2006, it mentiones that all documentation is only available in Japanese. Even though the author claims it was fun to figure it all out, we want to make your life a little easier.
You don't have to worry about Japanese anymore, everything you need is available in English now: firmware, manuals, FAQ and support.

We're glad that the authors discovered our MicroServer and we wholeheartedly recommend this book. If you have a hacking streak and need a small firewall box to carry everywhere, this is for you!

Get your own OpenBlockS at the SysKey Web Shop, and the book at O'Reilly: "Small Form Factor PCs"

I'd like to thank Matt Sarrel for pointing the book out to me.

Tuesday, October 21, 2008

Final Results: Chicken Sitter

Gordon Smith of Lakewood, CO, talks about protecting his chickens from raccoons:

The Story

As a practitioner of the software arts, my lack of electronics knowledge has always bothered me. I've browsed a few books and tinkered a bit, but aside from that could I find a useful project to bring on some learning fun?

I pondered that question one night while gazing at the moon. It was bright enough to see raccoons high in a tree next door, which sent me briefly into a panic trying to remember if I had shut the door on the chicken coop. Four small spring chickens have little to protect them at night - aside from someone or something remembering to close the coop door. Perhaps something could remember better than someone to close the door? Would a silicon "Chicken Sitter" be a feasible project?

Feasible or not, a chicken sitter would need a brain. At least enough of one to observe and count the chickens as they come into the coop in the evening, and then close the door.

The Brain


While cruising the intertubes in search of a small computer to use in the project, the Plat'Home OpenMicroServer made an appearance. In a tidy little box, it had USB and serial ports, and a few digital I/O (DIO) ports. More importantly, there was no fan or disk drive to get choked up with dust. And to top it all off, the Plat'Home "Will Linux Work?" contest was looking to give one away to a lucky contestant with the most appealing idea of how to test the server's mettle in a mildly abusive but productive situation.

Luckily for the Chicken Sitter project, Plat'Home generously provided a server to four different projects and the Chicken Sitter was just popular enough to win the fourth server.



As seen above, the server is little larger than two CD cases. It is a MIPS based unit that comes preinstalled with a specialized Linux distribution (SSD/Linux) that is a breeze to configure and update. SSD/Linux is also easily installed on a separate i386 machine to provide a cross compilation environment.

The Plan


The plan is to use an inexpensive webcam with IR capability to see in the dark, along with a computer vision library to count the chickens. To determine when dusk occurs, the server will run SNTP (simple network time protocol) and query another server to determine when sundown occurs each day. A document scanner has been sacrificed to provide a stepper motor controller and power supply to open and close the coop door.


The software required includes the Linux drivers for the webcam and the network adapter, the SNTP client, the OpenCV computer vision library and an application to tie everything together.

Current Progress

The webcam with IR has been installed and used successfully on a centOS Linux system.

A colleague is "assisting with" (i.e. doing) the stepper motor electronics. The motor has been manually run using a quadrature encoding circuit. The OMS can interface to the quadrature circuit to drive the motor or produce the quadrature encoding itself to drive the motor controller directly.

The drivers and software await a working cross compile environment. Issues are being worked, so far due primarily to operator error. There is a decent amount of documentation on SSD/Linux on the Plat'Home web site to help with this.

Conclusion Before the Fact

The Plat'Home OpenMicroServer is an ideal fit to accomplish the Chicken Sitter task. It fits unobtrusively and quietly in a corner of the chicken coop and has the hardware and software capability to accomplish the required tasks. The chickens will be very fortunate to have such a capable attendant.

Final Results: Home Utility Support System

Martin Ewing of Branford, CT, gives seriously awesome detail on building his Home Utility Support System:

Scope of Project

Prototype development of a system to monitor and control home heating and hot water systems with the objective of providing engineering and economic analysis to allow the homeowner to minimize costs and increase the effectiveness of the home's utility systems. The system is to be based on the Linux-based Plat'Home Open Micro Server to be supported by additional open-source software solutions.

Hardware System
  • OMS 400 server, 128 MB RAM
  • Compact Flash Card, 2 GB (SanDisk Versa II)
  • DLP Design DLP-IO8-G USB-Based 8-channel data acquisition module
  • Maxim DS18B20+ temperature sensors (2) for ambient and hot water monitors
  • Encore ENRXWI-G Wireless LAN Extender
  • Custom built interfaces for oil furnace, heating zone and domestic hot water circulators

Software Tools
  • Plat'Home SSD/Linux, version 0.4-20080727/2.6.16.
  • SSD packages for Apache (web server), Python 2.4, ssh, vim
  • Graphics support via gnuplot
  • All code developed in Python




Discussion
In its current stage, the application monitors the outdoor temperature and the temperature of the outlet pipe of our hot water heat exchanger. (Our domestic hot water is generated by flowing hot water from the furnace “boiler” through a heat exchanger by means of a circulator pump. Temperature at the outlet port depends on current hot water demand, as well as the water thermostat set point.) We also sample the state (on/off) of the furnace oil burner, the hot water circulator, and the three house heating “zones”. The operating cost of our system is proportional to the “on” time of the burner. Our objective, after analysis, is to minimize that cost, subject to weather conditions, etc.

The initial phase of the project was completed in about 3 weeks' elapsed time, demonstrating the rapid prototyping capabilities of the OMS device supporting the powerful Linux environment combined with the Python system. Several days of data acquisition have been run. A sample data display generated by gnuplot is shown in Figure 3. Plots like this will be available on demand via the OMS Apache web server, along with statistical summaries of collected data. Full analysis will required extended operation over the heating season.

It will be possible to operate the application, once fully debugged, though remote web access, thus being available to any authorized computer on the Internet, for example, to the homeowner who is traveling.


Comments on the Plat'Home OpenMicroServer

Hardware


The OMS-AL400/128 is a powerful and well-packaged system based on a 400 MHz RMI Alchemy au1550 (MIPS architecture). The data logging (in production mode) requires well under 1% of CPU capacity. The great benefit of the system is in the development environment (a full version of Linux) that supports advanced networking and language tools, such as the powerful rapid development language Python. Having substantial CPU and RAM availability permits intensive analysis and display options that are being put to use in CGI-driven web displays, supported by the powerful Apache web server.

SSD/Linux, provided by Plat'Home, has an advanced USB capability that auto-recognizes our DLP data acquisition module, saving a lot of development effort. It was only a matter of minutes to connect our Python application to real-world analog input, digital in/out, and temperature readings.

The physical package is suitable for installation in moderately unfriendly environments such as a typical home basement. Its small size, low power, and wide operating temperature range are also well suited to our environment.

Plat'Home's documentation discusses the issues involved in using Compact Flash memory as a solid state disk. In some applications, lifetime (maximum number of write operations) can be a problem. Our application is not particularly strenuous in this regard. Using an inexpensive CF card as a disk substitute is a big plus in our semi-industrial environment. Nearly unlimited RAM and/or hard drive capacity may be attached through the USB or Ethernet ports, thanks to the versatile networking support.

If the current application were to be produced commercially, it could be made to fit entirely in the 128 MB RAM without CF support. There is little need to do so at this point, since we make good use of the development tools, and CF is not particularly expensive. Nonvolatile storage, like CF, is desirable to protect logs against power outages.

Software


The OMS 400 is supported by the Plat'Home SSD/Linux distribution, which offers a selection of the most widely used Linux tools. Plat'Home provides a file repository for downloading software packages as required. There is also an option to install the Debian Linux distribution, which offers an even wider spectrum of tools and applications, along with frequent software updates.

We have taken advantage of many common Linux-based tools for this project, including gcc, Python, vim, gnuplot, ssh, and Apache. A live Internet connection (via Ethernet and a WiFi bridge) also permits real time clock synchronization via ntp, along with web and ssh access.

Software developed for this project will be made available as Open Source, under terms of the GPL v 3.0.

Areas for Improvement in the OMS 400 product

While the OMS device has been great to work with overall, there are naturally some problems that arose in the course of our work. This is a list of some of these:
  • The Alchemy au1550 processor works very well, and potentially can be supported by cross-compilation on an x86 Linux platform. However, an x86-compatible chip would be somewhat more convenient for development, other things being equal.
  • For an application like ours, it would be handy to have more DIO, A/D, and D/A capability on board, comparable to the DLP device we are using. Or, perhaps, a empty space where a customer supplied interface could be installed. However, external USB connected devices are not a great problem.
  • The limitations on CF write cycles are still a bit mysterious. It would be helpful if there were a monitor that could tell us the actual number of physical writes that an application creates over time. (Perhaps this exists in Linux already.)
  • It appears that the Python 2.4 package is not supported, even though provided in the SSD repository. It does not install for us. (The documentation warns that not all packages are guaranteed to work. This is disappointing!) We had to compile from source. The good news is that the OMS platform does have the ability to compile large software packages. The bad news is that Python did not correctly compile, although the result was usable.
  • We have also had unresolved difficulties in getting sendmail (or postfix) to operate. Sending results by email would benefit this application. In general, we would expect a standard Linux distribution like Debian would provide easier access to Python and sendmail.
  • Some physical details:
    • The OMS box does not have mounting tabs that would make it easy to install against a vertical wall, as required in our case.
    • The case is not sealed against a dusty or dirty environment. It may be acceptable in our environment, but more positive seals would increase operating confidence.
    • When installing in an environment with electrical equipment interfaces, it is desirable to have a definite case ground connection. The cable clamp screw can be used, but it is not ideal for this purpose. A separate grounding post would be useful.
Conclusion

The OMS 400 server has provided an ideal tool for implementing the Home Utility Support System. While this project could have been implemented with a standard PC, the operating environment is marginal for normal PC hardware. The OMS 400's combination of compact, robust packaging and nonvolatile flash disk, along with the power of its Linux operating environment, were ideal for this application.

We are grateful for generous support from Plat'Home Co., Ltd. that made this work possible.

Final Results: Irrigation Monitoring System


Play-by-play from Colin Duplantis, Rough and Ready, CA, as he sets up his irrigation monitoring system with the OpenMicroServer:

9/16/08 8:13 AM PDT
I unwrapped the Plat'Home OpenMicroServer. It's about the size of a VHS tape, maybe a little longer. I connected the server to my network via it's eth0 RJ45 jack and plugged it in. Lights 1,2 and 4 lit up in sequence in cycles. I searched briefly for light 3, but no luck.

I gave it time to boot up and checked my router DHCP lease table assuming that the unit defaulted to DHCP, but there was no new entry for the server. I then resorted to reading the startup guide and found very clearly in the instructions the default IP addresses for each interface on the server. Very helpful. Armed with this new information, I connected to the server's webserver via eth0. I logged in, set the hostname and domain name. Now, since I'm following instructions for a change, I executed save-and-reboot. After the server booted up again, I set the NTP server to “pool.ntp.org”. Whoops, I can't do that, the webserver won't accept a non-IP address. Undaunted, I looked it up: 72.167.54.201. I needed to save and reboot again, I guess I should have done it all at once. I waited a bit before rebooting so I make all the changes at once. I next added a new user “rainbird”, and removed the default existing user, “user1”. I moved on to the networking tab. I changed the default gateway to “192.168.1.1” and changed eth0 to the fixed IP 192.168.1.93. I set eth1 and eth2 to DHCP just in case I want to use them later. I added 192.168.1.1 as the DNS resolver. Again, I needed to reboot for this. I rebooted at that time because if the changes were correct, I should then have been able to contact the box on my network in general instead of via a cable connected from my laptop. Yay, it came up correctly. The time was now accurate (it uses UTC as it's TZ, which is fine). OK, the box was set up and running as a happy citizen on my LAN. The time was 8:46 AM, so all this took about 30 minutes.

The next step was to figure out how to get my applications onto the box. There was no SSH, but telnet was there. As is frequently the case, login as root is forbidden, so I tried my new user, “rainbird”. I couldn't log in as rainbird either because when I created the user via the webserver, it didn't create a homedir. And I deleted “user1”, whoops. Luckily, I was able to ftp in as “rainbird” and saw that /home/user1 still existed. I recreated “user1” via the web interface (using the UID it had before, not the UID it offers me). I was then able to telnet in as user1 and su to root. As root, I created “/home/rainbird” and set ownership to “rainbird:users”.

To run my irrigation controller, I needed cron, perl, and java. I first executed “crontab -e” and added “* * * * * touch /tmp/file” and saved. I checked the crontab with “crontab -l” and got the results I expected. The file got created after a bit, so cron was installed and running. Very good. Now I need perl and java.


Neither perl nor Java was installed by default, so I needed to figure out what chip is in the OpenMicroServer. I determined that the chip was a MIPS chip, so it was off to Dr. Google to find what I need. I found that Kaffe alleges to offer a Linux/MIPS port (I later found this information on Plat'Home's website including links to the Kaffe page with the version they got working). The OpenMicroServer itself has no compiler so I needed to do some cross-compiling for perl and Kaffe. Hey, here's something interesting: reading the glossy literature that comes with the box told me that the chip is an RMI Alchemy MIPS chip which happens to be the same chip the Sun Ray from Sun Microsystems uses. I found out that Sun has a 1.4.2 MIPS SE JRE available. I would need to do a little back-porting of the irrigation control software to remove generics, but that's certainly possible. In order to test the Sun version, I just needed to determine the glibc version and the endianness of the chip. While I was searching, I also tried to figure out what Linux distribution was running on the OpenMicroServer. Ah, SSD/Linux, according to the Plat'Home webpage. I found three Sun JREs to try for big and little endian glibc 2.2.5/2.3.2. I'll see if any of them function properly. I took a break at 9:30am PDT.

9/17/08 08:03 AM PDT
I tried to ftp the JREs I found from Sun to the box and found out that the box had very little disk space built in. I would have to attach an external device. I read the documentation some more and found that the OpenMicroServer has an internal slot for a Compact Flash card that can be used for disk space.

9/23/08 08:02 AM PDT
I bought an 8GB CF card. I opened the OpenMicroServer by removing a few screws.





The card slot was easy to find and it went in with no problems.






I closed the box and rebooted. Upon reboot, I found that the rainbird homedir I added was gone. At the time, I wasn't sure what happened there, but I readded the user1 via the web interface, telneted in as user1, re-added the rainbird home dir as root, and all was well. I found instructions on the Plat'Home webpage for formatting the CF card and had no problems at all. While I was on the Plat'Home webpage, I found out why the user homedir went away when I rebooted: I needed to update the boot RAM: flashcfg -s /etc/flashcfg. I now had sufficient disk space and was ready to resume my experimentations with Java. Plat'Home recommends the Kaffe Java implementation. I also downloaded a Sun version of 1.4.2_16, but it was only a 90-day evaluation version. A little experimentation suggested that the MIPS chip is little-endian. I think I'll need to go with Kaffe after all.

9/25/08 03:37 PM PDT

I found on the Plat'Home website an SSD VMWare development instance. This was fantastic news as cross-compiling can be a bear to set up. I downloaded the SSD VMWare instance from Plat'Home and found it nicely equipped with a MIPS cross-compiler. I compiled up a Hello, World C program and ran it on the OpenMicroServer and had success the first time out. Next, I'll try to compile up Kaffe using the cross-compiler and see if it works.

9/26/08 11:52 AM PDT
After a fair bit of fussing, I was able to built Kaffe version 1.1.7 on the VM for mipsel-linux. I transferred it to the server and installed it. Preliminary tests were successful.

10/01/08 08:28 AM PDT

Alas, I spoke too soon. It turns out that the Kaffe JVM is pretty unstable. I can either try an earlier version or port my software to C++ which can run natively. I think I will pursue the latter.



10/05/08 07:53 AM PDT

I ported a simplified version of my irrigation control software to C++ for a trial run. I installed in on the OpenMicroServer and connected it to my irrigation controller via its RS232 interface.

Let there be water!

Final Results: GPS Monitoring System

Feedback from Steve Castellotti of El Cerrito, CA:

I received my OpenMicroServer a short time ago but have already began making progress on my project.

Connecting to the Web Settings Tool proved no problem and I was soon up and running on my home network.

The first step I took was to install a 4 GB Compact Flash Microdrive, in order to act as a local storage extension to the built in Flash ROM.

The next step was to connect to Plat'Home's software package repository and begin downloading a few essential components, including OpenVPN to connect to my private network, Apache for serving up custom software and content on my LAN, PostgreSQL for storing the data I would soon be collecting via RS232 from my Trimaran's engine and solar panel arrange, and Icecast for streaming mp3 via HTTP.

I had no problem connecting both my 1 TB external hard drive and iPod as additional USB Storage devices.

Most of my existing software is written in Python, so I am now in the process of stepping through cross-compilation for the 400 Mhz MIPS-based AMD Alchemy CPU. This will allow all of my data collection and storage to run unmodified on this system. I am also working on cross-compiling Samba for network file sharing and libgpod to access the mp3 music files stored on the iPod for direct streaming via Icecast.

Finally I am strongly considering shifting to a Debian based installation (running off the Compact Flash drive) in order to access an even wider community and variety of pre-packaged software. A nice feature is that I can switch between my existing operating and trying a completely new software distribution simply by swapping out Compact Flash cards.

One of the benefits I've already seen with regards the OpenMicroServer compared to similar embedded devices is the level of processing power and onboard 128 MB of RAM memory. With some systems offering as little as 8 MB of memory it is nearly impossible to compile additional software packages, let alone run them with any reasonable expectation of performance.

OpenMicroServer has not let me down.

Plat'Home Unveils Final Results of 'Will Linux Work?' Contest

Today we reveled the final results of our four 'Will Linux Work?' contest winner's Linux experiments. For the past month our winners have been hard at work testing out their various environments - from the Chicken Sitter to the irrigation control device! We were floored by the type of American ingenuity that came through!

Just to recap, these were the four winning ideas and their results:

1. Steve Castellotti wanted a brain for his boat, but he was not ready for such a high IQ. He connected to Plat'Home's software package repository to download essential components, and he also connected both a 1 TB external hard drive and an iPod as additional USB Storage devices. Now monitoring and tracking on the high seas and in port are easier than ever.

2. Martin Ewing wanted to build a Home Utility Support System, and stick it in his basement in an environment somewhat questionable for a normal PC server. Software utilized during the project included gcc, Python, vim, gnuplot, ssh, and Apache. Ewing says that software developed for the project will be made under the GPLv3. The OMS's combination of compact, robust packaging and nonvolatile flash disk, along with the power of its Linux operating environment, passed the test with flying colors.

3. Colin Duplantis is building a system to control his farm's irrigation system, covering five acres, for watering lawns, providing drinking water for horses and other animals, and keeping a pond full. He had written his own version of irrigation control software. To fully test it will require running it through four seasons, so it is still "in testing," but popping open the hood, installing an 8GB CF card, and reading the manuals was enough to get his system up and running. Being willing to port his homemade irrigation control software to C++ allows him to run everything on the OMS, and interfacing with the irrigation controller via its RS232 interface has allowed him control where, when and how much water flows.

4. Gordon Smith needed someone to guard his chickens, someone reliable enough to stay up all night, someone smart enough to tell the difference between a chicken and a raccoon, and someone to close the door at the right time. His system utilizes an inexpensive webcam with IR capability to see in the dark, along with a computer vision library to count the chickens. To determine when dusk occurs, the server will run simple network time protocol (SNTP) and query another server to determine when sundown occurs each day. A stepper motor controller and power supply from a document scanner are used to open and close the coop door. Welcome home chickens!

For all details on the official results, please visit our website.