Sunday, June 10, 2012

This Pi are more rectangular than square

Here's a list of what I've done to get my Raspberry Pi into a mode suitable for development. (Suitable to my way of thinking, not to someone in their right mind.) As always these ideas are never mine, and I am trying to give credit where it's due.

I started with the Debian Squeeze image from Raspberry Pi. Nothing against Arch, but I use Ubuntu on my laptop and this seemed like an easier transition. There are good instructions linked from the download page for how to get your image transferred to an SD card so it will boot correctly. The image is sized for a 4 GB card, but at Publix the 4 GB and 8 GB cards were the same price (a ridiculously low price, in my opinion) so I got an 8 GB card and followed the additional instructions to resize the root partition and file system to fill the extra space. I did all this work from my laptop, which has an SD card slot on it that loads as /dev/mmcblk0 under Ubuntu.

After having cast around the house looking for a composite input monitor or an available HDMI-capable monitor and come up empty (curse you Diablo III), it occurred to me that I should be able to run X remotely. Then it occurred to me that, unless I could log in at the console first, I'd never know the IP address of the card and the argument was moot. A little searching showed that, as usual, I wasn't the first person to have faced and overcome this issue.

I put the SD card into my laptop and mounted the two partitions - one is the /boot and one is /. I set the board to have a static IP address by configuring the root partition's /etc/network/interfaces file as follows:
# Used by ifup(8) and ifdown(8). See the interfaces(5) manpage or
# /usr/share/doc/ifupdown/examples for more information.
auto lo
iface lo inet loopback
#iface eth0 inet dhcp
iface eth0 inet static

I thenfollowed this set of instructions  to turn on SSH (the initial prerequisite) and then install and configure TightVNC. Put the SD card back in the board, power it on, and away we go.

Based on some searching, it became apparent at this point that the OWFS installation was going to be a little more complicated. The as-distributed kernel from Raspberry Pi doesn't include (as of this writing) the kernel module required to engage the i2c bus hardware which can be used to drive 1-Wire directly. However, the community stepped in (again) and now there's a new kernel that includes the driver. The comments on that post include crucial instructions on installation and also the need for updated firmware, both of which I managed to follow without too much difficulty.

Next, to get OWFS going, I downloaded the source tarball from SourceForge and followed the build instructions (configure, make, make install). One thing I noticed was that the 'owfs' binary wasn't built on my board for some reason. It turns out that it has to do with libusb versions and Debian Squeeze. By following some instructions on how to build OWFS on Squeeze, I got owfs compiled and installed.

I can't really test them too much because I don't have the hardware ready yet, but at least they show the simulation expected. Here's a page that shows how to get the software running. When I try to start owfs, it chirps because I don't have the USB bus master, but I will take that as a win for now.

Is this thing on?

Nobody is around to read this, which is fine, but I'm writing it anyway because for the first time in like, forever, I have some news.

Raspberry Pi - that's a
3x5 index card for scale
I have a Raspberry Pi. And I'm not afraid to use it.

One of the most frustrating things about the "hacker" side of Fork and Hay was continuing to run up against limitations in the capabilities of the Arduino I was hoping to use for process monitoring and control. Now, I'm fully aware that the limitations were there for good purpose, and the frustration was not really with the Arduino itself, but rather with the time it took me to realize that I was trying to turn a useful  controller into a general purpose PC and getting mad because it wasn't happening. I had somehow convinced myself that just because Arduino supported a C++ -like programming environment that it would be suitable for anything a general C++ platform could handle, and that was just a wrong concept all the way around.

My poor Arduino, I'm so sorry I hurt you in that way. Can we still be friends?

Raspberry Pi is an ARM-based computer with 256MB RAM, on-board Ethernet and USB, a header full of general-purpose I/O pins, and HDMI and composite video output. It comes configured to boot off an SD card, and it supports Debian Squeeze and Arch Linux, among others. I think I can work with that. ;-)

Also, during the (ahem) hiatus I discovered that, once you broaden your horizons beyond the controller level, there are lots of other ways of getting temperature data from 1-Wire devices, including the 1-Wire File System (owfs) and devices like USB adapters and hubs. I'm sure that you could chalk some of this up to the usual "time marches on" phenomenon, but I can't help but wonder if it were there all along and through myopia I just missed it. Oh well. It's not like I had time to deal with it even it had been there.

A lot of the struggles I faced early on had to do with trying to revive my long-dormant electronics and low-level programming skills. Fortunately the world, as usual, has picked me up. I can now purchase guaranteed-to-work submersible DS18B20 probes, and the Raspberry Pi Linux images have a full gcc capability. And they run X Window. And they support [fill in most of your favorite *nix tools here], including the mightiest editor ever created by the hand of man, vi.