News and Happenings from the Japanese Linux Pioneer

Tuesday, October 21, 2008

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!

1 comment:

maneesh said...

With webcam surveillance, you can login from any computer, from any corner of the world and watch what is going on in your house. Whether you're on vacation, or away at work, your home is just a click away. What's more, most webcam software providers like GotoCamera www.gotocamera.com even allow you to login from your mobile phone and watch videos of your home.