A Tale of Two Gadgets: the TonidoPlug 2 and a Bus Pirate…

A few days ago, I mentioned that one of my servers had died. I spent some time thinking about how I would replace it. I like having a 24/7 hooked up to the Internet to serve as a file drop and a place where I can use SSH to connect to other devices on my home network, but the machine need not be hugely fast, and it would probably be better if it were fairly low power. My previous server drew about 30 watts, and I suspected that I could get something more compact and lower power to replace it.

So, I ordered a TonidoPlug 2. It’s a cute little server based upon the Sheeva Plug computer concept, but includes space to insert a 2.5″ SATA laptop drive. It has all sorts of “personal cloud” applications running on it, which I had no interest in, but doing a bit more research, I found that I could install ArchLinux on the internal hard drive, and it would boot to that automatically. Cool, think I. I ordered mine off Amazon.

It arrived yesterday. I powered it up, verified that it worked in its default configuration, then proceeded to follow the directions on the ArchLinux ARM page. Upon reboot… not good. I ended up with a flashing red LED, and the network never comes back up. So, I pulled the internal drive, and it reboots back to its default configuration.

I then start tracking through various support and Wiki links. I find that some people have had difficulty booting from the internal drives, and the Tonido support guys have been very coy, claiming that “we don’t support that”. Frown. Not good.

But in doing this research, I found that it was possible to access the boot loader and serial console. On the bottom side of the tonido is a nice little rubber cover, concealing 4 pins. Most people seem to make a small adapter to use an FTDI-serial adapter cable with it (the six pin ones like you would use for the Arduino), but I had a Bus Pirate sitting around, and I thought that it might work. And… it did!

In case anyone else (or me in the future) wants to know how to do this:

  • The four pins are Vcc, Rx, Tx, and GND, starting from the power supply side and working toward the USB/Ethernet cable side.
  • I just hooked up MOSI to RX, MISO to TX, and GND to GND
  • To use the Bus Pirate with my Mac laptop, I like to use GNU screen. If you run “screen /dev/tty.usbserial-AH00MPIK 115200” (your tty device will likely be different), it makes a convenient terminal emulator. From there, you can access the Bus Pirate, configure it in UART mode with a baud rate of 115200 and sensible other defaults.
  • You can then use the Bus Pirate as a UART bridge by invoking the “(1)” macro. You’ll then essentially be talking directly to the Tonido via the BusPirate.
  • Using screen’s C-a H command, you can start a log file, which will record all the output from the serial port. Doing the command again will stop logging.

Hooking it up, I got lots of cool info from the Tonido:

         __  __                      _ _
        |  \/  | __ _ _ ____   _____| | |
        | |\/| |/ _` | '__\ \ / / _ \ | |
        | |  | | (_| | |   \ V /  __/ | |
        |_|  |_|\__,_|_|    \_/ \___|_|_|
 _   _     ____              _
| | | |   | __ )  ___   ___ | |_ 
| | | |___|  _ \ / _ \ / _ \| __| 
| |_| |___| |_) | (_) | (_) | |_ 
 \___/    |____/ \___/ \___/ \__| 
 ** MARVELL BOARD: DB-88F6282A-BP LE 

U-Boot 1.1.4 (Sep 13 2011 - 13:25:05) Marvell version: 3.4.27
USISH-SMB Ver: topkick1281p2-001-008-20110913-codelathe

U-Boot code: 00600000 -> 0067FFF0  BSS: -> 006D0120

Soc: MV88F1155 Rev 1 (DDR2)
CPU running @ 800Mhz L2 running @ 400Mhz
SysClock = 400Mhz , TClock = 200Mhz 

DRAM unknown CAL  tRP = 8 tRAS = 20 tRCD=8
DRAM CS[0] base 0x00000000   size 512MB 
DRAM Total size 512MB  16bit width
Addresses 8M - 0M are saved for the U-Boot usage.
Mem malloc Initialization (8M - 7M): Done
NAND:512 MB
Flash:  0 kB

CPU : Marvell Feroceon (Rev 1)

Streaming disabled 
Write allocate disabled


USB 0: host mode
PEX 0: interface detected no Link.
Net:   egiga0 [PRIME]
Hit any key to stop autoboot:  0 
(Re)start USB...
USB:   scanning bus for devices... 1 USB Device(s) found
Waiting for storage device(s) to settle before scanning...
0 Storage Device(s) found
** Bad partition 1 **
## Booting image at 00800000 ...
Bad Magic Number
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done

Reset IDE: 
Marvell Serial ATA Adapter
Integrated Sata device found
[0 0 0]: Enable DMA mode (5)
  Device 0 @ 0 0:
Model: TOSHIBA MK6465GSX                        Firm: GJ003M   Ser#:            50OAC319T
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 610480.3 MB = 596.1 GB (1250263728 x 512)


** Unable to read "/boot/uImage" from ide 0:1 **
## Booting image at 00800000 ...
Bad Magic Number
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done

NAND read: device 0 offset 0x200000, size 0x600000

6291456 bytes read: OK

## Booting image at 01200000 ...
   Image Name:   Linux-2.6.31.8-topkick1281p2-001
   Created:      2011-11-10   3:58:11 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3121408 Bytes =  3 MB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
OK

Starting kernel ...

Uncompressing Linux................................................................................................................................................................................................... done, booting the kernel.
Linux version 2.6.31.8-topkick1281p2-001-004-20101214 (andrew@localhost.localdomain) (gcc version 3.4.4 (release) (CodeSourcery ARM 2005q3-2)) #2 Thu Nov 10 11:58:07 CST 2011
CPU: Feroceon 88FR131 [56251311] revision 1 (ARMv5TE), cr=00053977
CPU: VIVT data cache, VIVT instruction cache
Machine: Feroceon-KW
Using UBoot passing parameters structure
Memory policy: ECC disabled, Data cache writeback
Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 130048
Kernel command line: console=ttyS0,115200;version=topkick1281p2-001-006-20101103 mtdparts=nand_mtd:0x180000@0(u-boot),0x20000@0x180000(u-boot-env),0x600000@0x200000(uImage),0x1f800000@0x800000(rootfs) ubi.mtd=3 root=ubi0:rootfs rootfstype=ubifs rootdelay=10
PID hash table entries: 2048 (order: 11, 8192 bytes)
Dentry cache hash table entries: 65536 (order: 6, 262144 bytes)
Inode-cache hash table entries: 32768 (order: 5, 131072 bytes)
Memory: 512MB = 512MB total
Memory: 513280KB available (5612K code, 319K data, 148K init, 0K highmem)
NR_IRQS:128
Console: colour dummy device 80x30
Calibrating delay loop... 794.62 BogoMIPS (lpj=3973120)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
xor: measuring software checksum speed
   arm4regs  :   723.200 MB/sec
   8regs     :   433.600 MB/sec
   32regs    :   600.800 MB/sec
xor: using function: arm4regs (723.200 MB/sec)
NET: Registered protocol family 16
Feroceon L2: Enabling L2
Feroceon L2: Cache support initialised.

CPU Interface
-------------
SDRAM_CS0 ....base 00000000, size 512MB 
SDRAM_CS1 ....disable
SDRAM_CS2 ....disable
SDRAM_CS3 ....disable
PEX0_MEM ....base e8000000, size 128MB 
PEX0_IO ....base f2000000, size   1MB 
INTER_REGS ....base f1000000, size   1MB 
NFLASH_CS ....base fa000000, size   2MB 
SPI_CS ....base f4000000, size  16MB 
BOOT_ROM_CS ....no such
DEV_BOOTCS ....no such
CRYPT_ENG ....base f0000000, size   2MB 

  Marvell Development Board (LSP Version KW_LSP_5.0.3)-- DB-88F6282A-BP  Soc: MV88F1155 Rev 1 LE

 Detected Tclk 200000000 and SysClk 400000000 
MV Buttons Device Load
Marvell USB EHCI Host controller #0: df837740
PEX0 interface detected no Link.
PCI: bus0: Fast back to back transfers enabled
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
raid6: int32x1     72 MB/s
raid6: int32x2    101 MB/s
raid6: int32x4     88 MB/s
raid6: int32x8     80 MB/s
raid6: using algorithm int32x2 (101 MB/s)
cfg80211: Calling CRDA to update world regulatory domain
NET: Registered protocol family 2
IP route cache hash table entries: 16384 (order: 4, 65536 bytes)
TCP established hash table entries: 65536 (order: 7, 524288 bytes)
TCP bind hash table entries: 65536 (order: 6, 262144 bytes)
TCP: Hash tables configured (established 65536 bind 65536)
TCP reno registered
NET: Registered protocol family 1
rtc mv_rtc: rtc core: registered kw-rtc as rtc0
RTC registered
cpufreq: Init kirkwood cpufreq driver
XOR registered 4 channels
XOR 2nd invalidate WA enabled
mvCesaInit: sessions=640, queue=64, pSram=f0000000
Warning: TS unit is powered off.
MV Buttons Driver Load
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
SGI XFS with security attributes, large block/inode numbers, no debug enabled
msgmni has been set to 1002
alg: No test for cipher_null (cipher_null-generic)
alg: No test for ecb(cipher_null) (ecb-cipher_null)
alg: No test for digest_null (digest_null-generic)
alg: No test for compress_null (compress_null-generic)
alg: No test for stdrng (krng)
alg: No test for hmac(digest_null) (hmac(digest_null-generic))
async_tx: api initialized (sync-only)
io scheduler noop registered
io scheduler anticipatory registered (default)
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.0: ttyS0 at MMIO 0xf1012000 (irq = 33) is a 16550A
console [ttyS0] enabled
Integrated Sata device found
IRQ 21/mvSata: IRQF_DISABLED is not guaranteed on shared IRQs
scsi0 : Marvell SCSI to SATA adapter
scsi1 : Marvell SCSI to SATA adapter
scsi 0:0:0:0: Direct-Access     TOSHIBA  MK6465GSX        GJ00 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] Sector size 0 reported, assuming 512.
sd 0:0:0:0: [sda] 1250263728 512-byte logical blocks: (640 GB/596 GiB)
sd 0:0:0:0: [sda] 0-byte physical blocks
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: Attached scsi generic sg0 type 0
Loading Marvell Ethernet Driver:
  o Cached descriptors in DRAM
  o DRAM SW cache-coherency
  o 2 Giga ports supported
  o Multi RX Queue support - 4 RX queues
  o Multi TX Queue support - 2 TX Queues
  o TCP segmentation offload (TSO) supported
  o Large Receive offload (LRO) supported
  o Receive checksum offload supported
  o Transmit checksum offload supported
  o Network Fast Processing (Routing) supported - (Disabled)
  o Network Fast Processing (NAT) supported
  o Driver ERROR statistics enabled
  o Driver INFO statistics enabled
  o Proc tool API enabled
  o SKB Reuse supported - (Disabled)
  o SKB Recycle supported - (Disabled)
  o Gateway support enabled
     o Using Marvell Header Mode
     o L2 IGMP support
  o Rx descripors: q0=128 q1=128 q2=128 q3=128
  o Tx descripors: q0=532 q1=532
  o Loading network interface(s):
    o  register under mv88fx_eth platform
sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, supports DPO and FUA
sd 0:0:0:0: [sda] Sector size 0 reported, assuming 512.
    o eth0, ifindex = 2, GbE port = 0

Warning: Giga 1 is Powered Off

Warning: Giga 1 is Powered Off

mvFpRuleDb (df280000): 16384 entries, 65536 bytes
Intel(R) PRO/1000 Network Driver - version 7.3.21-k3-NAPI
Copyright (c) 1999-2006 Intel Corporation.
e1000e: Intel(R) PRO/1000 Network Driver - 1.0.2-k2
e1000e: Copyright (c) 1999-2008 Intel Corporation.
e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
e100: Copyright(c) 1999-2006 Intel Corporation
 sda:
PPP generic driver version 2.4.2
PPP Deflate Compression module registered
PPP BSD Compression module registered
PPP MPPE Compression module registered
NET: Registered protocol family 24
PPPoL2TP kernel driver, V1.0
Using Hamming 1-bit ECC for NAND device
NAND device: Manufacturer ID: 0xad, Chip ID: 0xdc (Hynix NAND 512MiB 3,3V 8-bit)
Scanning device for bad blocks
Bad eraseblock 1064 at 0x000008500000
Bad eraseblock 1065 at 0x000008520000
Bad eraseblock 1884 at 0x00000eb80000
Bad eraseblock 1885 at 0x00000eba0000
Bad eraseblock 2038 at 0x00000fec0000
Bad eraseblock 2039 at 0x00000fee0000
Bad eraseblock 2580 at 0x000014280000
Bad eraseblock 2581 at 0x0000142a0000
Bad eraseblock 2606 at 0x0000145c0000
Bad eraseblock 2844 at 0x000016380000
Bad eraseblock 3269 at 0x0000198a0000
Bad eraseblock 3547 at 0x00001bb60000
4 cmdlinepart partitions found on MTD device nand_mtd
Using command line partition definition
Creating 4 MTD partitions on "nand_mtd":
0x000000000000-0x000000180000 : "u-boot"
 sda1
sd 0:0:0:0: [sda] Sector size 0 reported, assuming 512.
0x000000180000-0x0000001a0000 : "u-boot-env"
sd 0:0:0:0: [sda] Attached SCSI disk
0x000000200000-0x000000800000 : "uImage"
0x000000800000-0x000020000000 : "rootfs"
UBI: attaching mtd3 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI: attached mtd3 to ubi0
UBI: MTD device name:            "rootfs"
UBI: MTD device size:            504 MiB
UBI: number of good PEBs:        4020
UBI: number of bad PEBs:         12
UBI: max. allowed volumes:       128
UBI: wear-leveling threshold:    4096
UBI: number of internal volumes: 1
UBI: number of user volumes:     1
UBI: available PEBs:             75
UBI: total number of reserved PEBs: 3945
UBI: number of PEBs reserved for bad PEB handling: 40
UBI: max/mean erase counter: 3/1
UBI: image sequence number: 0
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
ehci_marvell ehci_marvell.70059: Marvell Orion EHCI
ehci_marvell ehci_marvell.70059: new USB bus registered, assigned bus number 1
UBI: background thread "ubi_bgt0d" started, PID 480
ehci_marvell ehci_marvell.70059: irq 19, io base 0xf1050100
ehci_marvell ehci_marvell.70059: USB 2.0 started, EHCI 1.00
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 1 port detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
uhci_hcd: USB Universal Host Controller Interface driver
usbcore: registered new interface driver usblp
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver ums-datafab
usbcore: registered new interface driver ums-freecom
usbcore: registered new interface driver ums-jumpshot
usbcore: registered new interface driver ums-sddr09
usbcore: registered new interface driver ums-sddr55
usbcore: registered new interface driver ums-usbat
pwrctl: dev_t_NO. = 0xdd00000, major = 221
pwrctl: request the irq power off registered. 
mice: PS/2 mouse device common for all mice
i2c /dev entries driver
Linux telephony interface: v1.00
md: linear personality registered for level -1
md: raid0 personality registered for level 0
md: raid1 personality registered for level 1
md: raid6 personality registered for level 6
md: raid5 personality registered for level 5
md: raid4 personality registered for level 4
device-mapper: ioctl: 4.15.0-ioctl (2009-04-01) initialised: dm-devel@redhat.com
sdhci: Secure Digital Host Controller Interface driver
sdhci: Copyright(c) Pierre Ossman
mmc0: mvsdio driver initialized, lacking card detect (fall back to polling)
Advanced Linux Sound Architecture Driver Version 1.0.20.
No device for DAI CS42L51
ALSA device list:
  No soundcards found.
nf_conntrack version 0.5.0 (8192 buckets, 32768 max)
mvFpNatDb (df360000): 16384 entries, 65536 bytes
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 17
NFP (fdb) init 256 entries, 1024 bytes
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
rtc mv_rtc: setting system clock to 2012-03-31 01:20:22 UTC (1333156822)
Waiting 10sec before mounting root device...
mmc0: new high speed SDIO card at address 0001
md: Waiting for all devices to be available before autodetect
md: If you don't use raid, use raid=noautodetect
md: Autodetecting RAID arrays.
md: Scanned 0 and added 0 devices.
md: autorun ...
md: ... autorun DONE.
UBIFS: mounted UBI device 0, volume 0, name "rootfs"
UBIFS: file system size:   501387264 bytes (489636 KiB, 478 MiB, 3886 LEBs)
UBIFS: journal size:       25159680 bytes (24570 KiB, 23 MiB, 195 LEBs)
UBIFS: media format:       w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root:  4952683 bytes (4836 KiB)
VFS: Mounted root (ubifs filesystem) on device 0:11.
Freeing init memory: 148K
Using makefile-style concurrent boot in runlevel S.
Starting the hotplug events dispatcher: udevd.
Synthesizing the initial hotplug events...done.
Waiting for /dev to be fully populated...done.
Setting parameters of disc: (none).
Activating swap...done.
Starting early crypto disks...done.
Starting remaining crypto disks...done.
Loading kernel modules...done.
Cleaning up ifupdown....
Setting up networking....
Activating lvm and md swap...done.
Checking file systems...fsck from util-linux-ng 2.17.2
done.
Mounting local filesystems...done.
Activating swapfile swap...done.
Cleaning up temporary files....
Setting kernel variables ...done.
Configuring network interfaces...Internet Systems Consortium DHCP Client 4.1.1-P1
Copyright 2004-2010 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

eth0: started
Listening on LPF/eth0/40:2c:f4:bc:8b:c9
Sending on   LPF/eth0/40:2c:f4:bc:8b:c9
Sending on   Socket/fallback
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 4
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 5
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 7
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
done.
Cleaning up temporary files....
fuse init (API version 7.12)
Using makefile-style concurrent boot in runlevel 2.
Network Interface Plugging Daemon...start eth0...done.
Starting enhanced syslogd: rsyslogd.
Starting Samba daemons: nmbd smbdStarting periodic command scheduler: cron.
.
Starting system message bus: dbus.
Starting OpenBSD Secure Shell server: sshd.
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended

Debian GNU/Linux 6.0 TonidoPlug2 ttyS0

TonidoPlug2 login: --2012-03-30 18:21:50--  http://patch.codelathe.com/firmware/tonidoplug2/updates.list
Resolving patch.codelathe.com... failed: Name or service not known.
wget: unable to resolve host address “patch.codelathe.com”

Debian GNU/Linux 6.0 TonidoPlug2 ttyS0

TonidoPlug2 login: root
Password: 
Last login: Fri Mar 30 18:16:16 PDT 2012 on ttyS0
Linux TonidoPlug2 2.6.31.8-topkick1281p2-001-004-20101214 #2 Thu Nov 10 11:58:07 CST 2011 armv5tel

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
root@TonidoPlug2:~# 

I suspect I’ll be able to debug it a lot better tomorrow.

The first Internet of Things Bay Area Meetup and the Air Quality Egg…

Last night, I met with Nanode creator Ken Boak and Chris Jefferies from tinajalabs.com at Cafe Actual in Berkeley for the inaugural IoTBayArea meetup. IoT groups are already going strong in many cities like London, Amsterdam, and NYC, but now that Ken is operating here in the SF Bay Area, he wanted to get a group going here.

The current big project being developed by these groups is the Air Quality Egg: a crowd sourced air quality sensor network based upon open source technology. It’s a new Kickstarter based project too (which I have decided to back)!

Air Quality Egg



Beyond the fact that it uses some cool technology, I like this project mostly because the data it gathers will enable people to understand something about the world that they live in day to day. In the Bay Area, we have the Bay Area Air Quality Management District, a government group established in 1955 by the California legislature to monitor air quality in the nine SF Bay counties. This is the government agency that is responsible for (among other things) the Spare the Air day program, which warns citizens of days with particularly unhealthy air pollution, and urges them to take personal action to reduce the problem. It’s a great program, and they produce some interesting real time data on air quality in different areas, as well as forecasts. The air quality index (AQI) that they report measures ground-level ozone, airborne particles, carbon monoxide, sulfur dioxide and nitrogen dioxide.

So, if the government is doing such a good job, why do we need a citizen network to monitor the same things?

First of all, this data may not be accurate for your neighborhood. If your home or business is located near sources of pollution (such as busy streets or some industrial polluters) in spite of the fact that the overall air pollution in your city is reasonable, you might be experiencing high levels of these pollutants. Or it could simply be a matter of geography: I live in a fairly smallish valley, which might be more isolated from the offshore winds that might blow pollutants away. It would be interesting to understand how the pollution in my relatively suburban environment compared with other locations.

Secondly, an open source archive of raw sensor data opens up opportunities for research. Instead of just getting a single AQI number, we’ll end up with a bunch of spatially distributed raw readings for individual pollutants. Perhaps ozone is the dominant pollutant in your area. Or perhaps burning of yard waste causes particulates to spike in certain areas at certain times of the year. Perhaps we can see the daily variation in carbon monoxide as traffic peaks and ebbs in certain locations.

Third, it encourages citizen participation in thinking about air pollution. Just as “Spare the Air” days challenge us to consider ways to change our behavior to improve air quality, participation in an air quality monitoring network turns something that is easy to take for granted into something that we can understand and improve.

Oh, and it involves cool software and hardware too. 🙂

If any of this interests you, you might try following Ken (@monsonite) on Twitter. The IoTBayArea is just beginning, but I suspect we’ll see some rapid growth. We are shooting for regular meetings, with the next one tentatively set for the last weekend in April (but subject to change, stay tuned). Even if the Air Quality Egg project doesn’t thrill you, if you are still interested in the world of Internet connected devices, I urge you to try to come to the next one, you’ll find like minded people and good conversation.

Thanks to Ken and Chris.

The Little Engine that Could…

In my home office, I have a machine called “fishtank”. I realized that I first bought it back in 2002, and since then it has been running various flavors of FreeBSD (probably beginning around 4.6 or so, currently running 7.2). At various times I’ve added or upgraded disk drives to it. While a power failure just two weeks ago reset it’s uptime, it’s had uptimes in excess of six hundred days on at least two occasions. I use it as an ssh server, file repository, and generally just a net accessible resource for generic computing tasks.

But the other day, I wanted to generate some new maps for my website using some code that I had never tried before, the Matplotlib Basemap Toolkit. There were already port files in FreeBSD, so I thought I’d try it out. So, I set it running with portmaster, and walked away.

The build failed.

Digging in, I found that it failed while building gcc (why it needed to build a new version of gcc I’m not sure, but it thinks it did). And it turns out it just flat ran out of memory.

I asked the quite natural question, “how much memory does this thing have?”

The answer: 256 megabytes. With less than 500 megabytes of swap.

I think it’s time to consider an upgrade. I could put 1G of memory in it, but that seems pretty lame. I think I’ll replace it with a small mini-desktop. I’m looking for an inexpensive, relatively low power and most importantly quiet server box. Anyone have any recommendations?

On bread…

This morning I was in a rush to get out of the house, and didn’t have time to make a big breakfast, so while I was gathering my stuff, I cut a fairly thick slice of bread off the loaf I made last night and jammed it in the toaster. As I was about to leave, the toaster popped, I quickly smeared on a tablespoon of peanut butter, and headed out.

It was really quite delicious.

Other than some Jewish ryebread that we got the other day, I haven’t bought a loaf of bread since last year. Instead, I make it, using what I consider one of the greatest food hacks of recent memory: Jim Lahey’s no-knead bread. Making bread this way is straightforward and ultimately rewarding: to have a tasty hot loaf come out of the oven, after filling your kitchen with that bready, yeasty smell feels like you are really cooking, that you really understand food.

Yes, yes. Some of you are of the anti-carb religion. I know, carbs do terrible things to your blood sugar and insulin levels, which mucks with all sorts of things having to do with metabolism and weight management. I even agree with it, at least to a point. But “bad foods” have gone through cycles. When I was a kid, it was sugar. Then it was fats. Then carbohydrates. We want to do the right thing, but we get fed conflicting information. We were told that there were links between consumption of fats and coronary disease, but more recent studies seem to refute this basic idea. Recent studies question the idea that omega-3 fatty acids improve cardiac health, or that dietary fiber protects against colon cancer. What’s a guy to do?

I’m trying to develop a philosophy of food, cooking and eating that will feed and nourish my body, and still provide me with the rich, emotional experience that I enjoy from food. I like Michael Pollan’s simple philosophy:

Eat Food. Not too much. Mostly plants.

I’m been mostly thinking about the first one over the last month, that I should be eating food. I began to realize that my weight (and the associated health issues related to it) weren’t really being caused by the occasional trips to the fancy restaurants that my wife and I enjoy a few times a year, nor by the meals that I prepared for myself, but were caused by all the “food-like” substances that I ate without thinking. So-called fast food. Processed food. Food that came in boxes, with nutritional labels. I began to view even the “Smart Ones” frozen foods that my wife and I consumed almost daily in our previous bought of Weight Watchers were part of a basic problem: a prioritization of convenience over actually taking the time and energy to think about, prepare, and consume actual food.

So, back to bread. The no-knead bread takes about 3 cups of flour to make. Along with infinitesimal amounts of salt, yeast, and a water, all it takes is heat to convert this into a large crusty loaf such as the one I pictured above. I made that loaf with unbleached bread flour (King Arthur’s). Should I be eating this? Should I be making this?

I’m going to say “yes”, with certain reservations.

First of all, while it is made from a fairly processed raw material (bread flour), it contains none of the “non-food” items that you frequently see on bread labels. It has no high fructose corn syrup (in fact, no added sugar). It has no preservatives. It’s just flour, salt, yeast and water. It’s pretty much the same recipe that humans have been making for thousands of years. It would be hard to classify bread made this way as a non-food: bread is practically the definition of food. We could deconstruct all the components: a cup of bread flour has about 361 calories, 2g of fat, 73 grams of carbohydrates, 12.7 grams of protein, and 1 gram of sugar. That is a lot of carbohydrates. There isn’t a lot of vitamin content in the bread either. But even if you ate 1/3 of my loaf in a day, it would account for less than 20% of the calories of a typical 2000 calorie diet. Reasonable (not even small) portions of this bread can be a part of your daily meal, and of course, I don’t even eat it daily. When I do, I try to make sure other aspects of my diet are richer in proteins and vegetables.

Secondly, I’m making it myself. I’m under no delusion that the bread is more nutritious as a result, but I’m trying to modify some of my destructive food behaviors. One of the ways to do that is to stop shooting for convenience. Convenience foods are there when you don’t want to be bothered to think about what you are eating, but you should be thinking about what you are eating. While this bread is simple to make, it does take 24 hours to make. You have to think ahead of time, and that means that you tend not to eat it without thinking about it. I firmly believe that so-called ‘food scientists’ are working mostly to make products which are addictive and convenient, rather than satisfying and nutritious. I can do better.

Third, and perhaps most importantly: it’s better in almost everyway than the convenient food it replaces. Check out that loaf again. It looks better. It smells better. It tastes better. When I make it, I feel like I’m cutting out the bad stuff, and concentrating on the good stuff. I think about building meals around a few slices of bread. I think about butternut squash soup. Or maybe just some braised greens and some crusty slices of toast. This morning’s peanut butter and toast was brilliant. The toast had a crispiness that I don’t think you get in prepackaged, pre-sliced bread. I modified the cooking times and preps a bit from my previous loaf, and the bread came out higher, and with a more delicate crust. I’m already imagining the next loaf I’ll make (probably next week).

I’m going to enjoy bread and pasta, but I’m going to think carefully about it. I’m going to maximize my enjoyment of it, while moderating my consumption.

Addendum: One of the most interesting books I’ve read lately is Tamar Adler’s incredible Everlasting Meal. She makes a claim in her book which struck home with me, that it’s impossible to solve dietary problems without cooking (I’ll have to look up the exact quote). Her book is a brilliant celebration of the art, craft and philosophy of cooking and food. Well worth reading.

24 hours, 73 unique stations on WSPR

For the last couple of days, I’ve let my FT-817 and the WSPR software monitor 40m, 30m, and 20m (shifted as time permits, and as propagation shifts). Last night I managed to set a new distance record by hearing ZS6BIM in South Africa, at a distance of 16,941km. I also picked up a couple of other entities that I haven’t seen before: Austria, Guatemala, Vietnam and Thailand. Very cool.

73 spots:

Timestamp Call MHz SNR Drift Grid Pwr Reporter RGrid km az
 2012-03-21 16:24   ZS6BIM   10.140114   -24   0   KG44df   1   K6HX   CM87ux   16941   303 
 2012-03-21 14:00   HS0ZBS   10.140216   -27   0   OK03ss   5   K6HX   CM87ux   12669   37 
 2012-03-20 17:28   VK2UX   14.097091   -17   0   QF56hf   5   K6HX   CM87ux   12007   56 
 2012-03-21 05:54   ZL3XX   7.040101   -25   -1   RE78kr   5   K6HX   CM87ux   10873   45 
 2012-03-21 16:34   ZL2FT   10.140146   -26   0   RF70mb   5   K6HX   CM87ux   10758   45 
 2012-03-21 06:12   OE3WGW   10.140174   -24   -2   JN88cj   5   K6HX   CM87ux   9573   328 
 2012-03-21 05:26   EA1URO   7.040090   -26   0   IN62bh   5   K6HX   CM87ux   8898   313 
 2012-03-21 16:34   JA2GRC   10.140211   -27   0   PM74uu   5   K6HX   CM87ux   8613   52 
 2012-03-21 16:34   JQ2WDO   10.140190   -18   0   PM95gi   5   K6HX   CM87ux   8374   54 
 2012-03-20 19:04   WA2YUN   14.097123   -9   0   RK39hh   5   K6HX   CM87ux   7072   56 
 2012-03-21 06:08   W1BW   10.140231   -25   0   FN42hl   0.1   K6HX   CM87ux   4286   281 
 2012-03-20 20:50   W2RON   14.097098   -10   0   FN34kp   5   K6HX   CM87ux   4109   277 
 2012-03-20 18:56   WA3DNM   14.097119   -16   0   FM29fw   5   K6HX   CM87ux   4002   282 
 2012-03-21 02:38   TG8AMX   7.040087   -14   0   EK44fu   5   K6HX   CM87ux   3965   316 
 2012-03-20 20:52   W4AC   14.097113   -24   0   EL86ux   5   K6HX   CM87ux   3913   298 
 2012-03-20 21:30   W3GXT   14.097099   -21   0   FM19ol   5   K6HX   CM87ux   3908   282 
 2012-03-21 12:08   KB3VR   10.140176   -25   -1   FM19la   1   K6HX   CM87ux   3898   283 
 2012-03-20 18:40   W3CSW   14.097161   -29   0   FM19kd   2   K6HX   CM87ux   3888   283 
 2012-03-20 19:04   K3GEN   14.097026   -25   0   FM19ke   1   K6HX   CM87ux   3887   283 
 2012-03-20 20:08   W2LNX   14.097094   -16   0   FM19jb   50   K6HX   CM87ux   3883   283 
 2012-03-20 18:54   NH7SR   14.097110   -8   0   BL11ch   5   K6HX   CM87ux   3866   53 
 2012-03-21 01:26   AI4WV   14.097047   -9   1   FM05pv   2   K6HX   CM87ux   3845   287 
 2012-03-20 18:42   NA4U   14.097120   -20   0   FM03ac   5   K6HX   CM87ux   3835   290 
 2012-03-21 06:30   WA8KNE   10.140177   -16   0   EM90gg   5   K6HX   CM87ux   3823   294 
 2012-03-21 07:30   W3HH   10.140141   -17   0   EL89vb   1   K6HX   CM87ux   3814   296 
 2012-03-21 04:02   W2XC   7.040118   -11   -1   FN02qw   5   K6HX   CM87ux   3693   277 
 2012-03-20 21:30   KC2UK   14.097091   -11   0   FN03mb   5   K6HX   CM87ux   3665   276 
 2012-03-21 02:10   VA3SK   7.040028   -18   0   FN06   5   K6HX   CM87ux   3635   271 
 2012-03-21 02:20   VA3MW   7.040146   -12   0   FN03hu   5   K6HX   CM87ux   3623   275 
 2012-03-20 19:10   W4DJW   14.097024   -18   0   EM84ux   5   K6HX   CM87ux   3564   287 
 2012-03-21 12:30   WT4C   10.140156   -18   1   EM84ps   5   K6HX   CM87ux   3535   288 
 2012-03-20 20:30   VE3KYK   14.097015   -10   0   EN96ol   5   K6HX   CM87ux   3501   270 
 2012-03-20 17:30   VE3ELX   14.097091   -18   -2   EN92gv   5   K6HX   CM87ux   3464   275 
 2012-03-20 20:40   K4COD   14.097151   -6   0   EM73sc   5   K6HX   CM87ux   3442   290 
 2012-03-21 00:14   AK4T   14.097137   -26   0   EM74vb   2   K6HX   CM87ux   3429   288 
 2012-03-21 05:36   KE3PL   7.040065   -12   0   EM74xx   5   K6HX   CM87ux   3412   287 
 2012-03-20 17:20   W8SJV   14.097172   -22   0   EN80mg   1   K6HX   CM87ux   3375   279 
 2012-03-20 17:26   KC8WJD   14.097011   -27   0   EN72dx   5   K6HX   CM87ux   3118   272 
 2012-03-21 02:08   K8CYV   7.040112   -4   0   EN63ve   5   K6HX   CM87ux   3077   272 
 2012-03-21 09:36   KC9NBV   10.140196   -13   0   EM69oe   1   K6HX   CM87ux   3069   279 
 2012-03-21 00:30   K9AN   14.097161   -11   0   EN50wc   0.5   K6HX   CM87ux   2942   277 
 2012-03-20 23:24   KC9OJV   14.097064   -27   -1   EN51wu   1   K6HX   CM87ux   2926   273 
 2012-03-20 18:56   KB9AMG   14.097030   -22   0   EN52tx   5   K6HX   CM87ux   2902   271 
 2012-03-20 17:14   K0VM   14.097091   -13   0   EN42db   2   K6HX   CM87ux   2629   270 
 2012-03-20 22:48   K0AZ   14.097027   -14   0   EM37cd   1   K6HX   CM87ux   2504   281 
 2012-03-20 18:40   WA5VRO   14.097061   -12   0   EM10cf   5   K6HX   CM87ux   2406   298 
 2012-03-21 02:42   VE4KE   7.040095   -11   0   EO01te   5   K6HX   CM87ux   2378   241 
 2012-03-20 18:56   K5XL   14.097141   -16   0   EM12kp   1   K6HX   CM87ux   2351   292 
 2012-03-20 19:30   KE7A   14.097132   -10   -1   EM12kx   5   K6HX   CM87ux   2338   291 
 2012-03-20 21:42   K5FRD   14.097011   +10   0   EM12gm   10   K6HX   CM87ux   2327   292 
 2012-03-20 17:46   K7FB   14.097017   -19   0   EM13   1   K6HX   CM87ux   2326   290 
 2012-03-20 21:20   WA5ETV   14.097090   -22   0   EM15jm   5   K6HX   CM87ux   2245   284 
 2012-03-20 20:50   VE6PDQ   14.097117   -17   0   DO34ir   5   K6HX   CM87ux   1983   204 
 2012-03-20 20:40   VE6OG   14.097167   -2   0   DO33fn   5   K6HX   CM87ux   1858   205 
 2012-03-21 02:56   K5USF   7.040053   -9   0   DM62pi   1   K6HX   CM87ux   1546   298 
 2012-03-21 14:12   W5OLF   10.140171   -28   0   DM79   0.01   K6HX   CM87ux   1503   269 
 2012-03-20 20:40   WF7M   14.097088   -13   0   CN87nw   1   K6HX   CM87ux   1108   177 
 2012-03-21 15:40   W8ZU   10.140193   +2   0   DM33   5   K6HX   CM87ux   973   304 
 2012-03-21 02:06   KF7O   7.040101   -7   0   DN06tb   1   K6HX   CM87ux   955   201 
 2012-03-20 18:32   W7QL   14.097096   +10   -1   DN40bo   5   K6HX   CM87ux   942   255 
 2012-03-20 18:52   WA7KGX   14.097118   +2   0   CN85no   5   K6HX   CM87ux   849   177 
 2012-03-21 03:04   W6II   7.040011   -4   0   CN85mn   5   K6HX   CM87ux   845   176 
 2012-03-21 03:44   K7FET   7.040069   -25   0   CN85mm   1   K6HX   CM87ux   840   176 
 2012-03-20 18:40   AC0NM   14.097019   -27   0   DM12jt   1   K6HX   CM87ux   736   323 
 2012-03-21 16:36   N6ETE   10.140147   +2   0   DM12kw   1   K6HX   CM87ux   730   322 
 2012-03-21 02:38   WD6DOD   7.040143   +3   0   DM13ao   5   K6HX   CM87ux   624   322 
 2012-03-21 16:30   K7LG   10.140200   -4   -1   DM04se   1   K6HX   CM87ux   544   322 
 2012-03-21 16:36   KC6KGE   10.140243   -17   0   DM05gd   5   K6HX   CM87ux   404   322 
 2012-03-21 01:50   KP4MD   14.097054   -18   0   CM98iq   5   K6HX   CM87ux   118   228 
 2012-03-20 19:00   N6GN   14.097091   -19   0   CM88ok   5   K6HX   CM87ux   67   139 
 2012-03-20 18:56   K6SRO   14.097188   -16   0   CM88ql   5   K6HX   CM87ux   63   152 
 2012-03-20 18:54   W6/LA4ZCA   14.097047   -16   0   CM87wk   5   K6HX   CM87ux   62   346 
 2012-03-21 04:38   NN6RF   7.040012   -14   0   CM87uw   2   K6HX   CM87ux   5   0 

Listening to WSPR-ing…

I was interested in the WSPR (Weak Signal Propagation Reporter) system for quite a while, but have not recently been running it from my home QTH. Yesterday, I decided to give it a whirl, and set it up to run on 30m (the classic frequency) to see what I could get. In the past, I’ve logged some interesting places, such as 4Z4TI (Israel), WA2YUM (Wake Island) and DP1POL, operating from Antartica and setting my distance record of nearly 15,000 km. But overnight tonight I added VK4TMH, the kiwi ZL2FT, and a DXCC entitity I hadn’t seen before: XV4Y from Vietnam. Very nice. Today, I’ve shifted up in frequency to 20m, and am currently listening there. So far I’ve caught two Aussies (VK2UX and VK4XDB) as well as HB9EFK from Switzerland. I was hoping for some more European stations, but it appears the window for that has passed already. I’ll leave it running for the next 24, and then maybe shift to a different frequency set.

QRPP backissues available on the Internet…

This morning, while listening to the latest SolderSmoke podcast, Bill mentioned that back issues of the Norcal journal “QRPP” were available for free download. Indeed, Chuck Adams has placed them here. I’m currently downloading them for myself, my brief scan indicates all sorts of good information, well worth adding to any archive that you keep. I know I’ll be putting them on my new iPad soon.

Happy π-day!

Today is π-day (3/14) as well as Albert Einstein’s birthday. I was trying to get inspired to produce something pi related, so I scanned my bookshelves for the kind of fun recreational mathematics books that provide the raw grist for my geek mill. I found a copy of Peter Beckmann’s A History of Pi, which I remember cracking open a few times, but which I had not read in a while. I briefly flipped through the pages, looking for something interesting, and on page 113 found something that didn’t seem pi-related, but nevertheless caught my eye:

Even today there are many statements that are “true” by physical standards of experience, but that remain mathematically unproven. Two of the most famous are the Goldbach conjecture and the four color problem. … The other well known problem, the so-called four-color problem, is to prove that no matter how a plane is subdivided into non-overlapping regions, it is always possible to paint the regions with no more than four colors in such a way that no two adjacent regions have the same color. By experience, the trueth of the assertion is known to every printer of maps (common corners, like Colorado and Arizona, do not count as adjacent.) And no matter how one tries to dream up intertwining states on a fictitious map (see figure above), four colors always appear to be enough. But there is no proof.

That set me dashing to the front of the book to find out when it was published. It turns out it was 1971. But I remember reading the announcement of the proof of the four color theorem by Appel and Hacken in the pages of Scientific American as a young teen. In celebration of their achievement, the University of Illinois began using the postmark shown above (replacing their previous famous example declaring that 2^11213-1 is prime). The discovery was significant not just for it’s intrinsic value, but also because it was the first instance where computers assisted in proving a mathematical theorem. Very cool.

Beckman’s book is actually pretty interesting, but kind of fades out at the end when discussing computer attempts at computing pi. The record at that point stood at about 500,000 digits of so, although Beckmann said that “this record will, no doubt, eventually be broken”.

And it has. Not just broken, but obliterated.

Arduino Hole Dimensions Drawing

I’ve been kind of busy and distracted lately, so I haven’t had much time to get any embedded microcontrollers. I did dust off an Arduino FIO that I never played with, and charged up a 1000maH LiPo battery to power it. While it was blinking, I dug out my Xbees and started thinking of a project that I put off a while ago (more details later) and realized that while the Arduino FIO is cheap, compact, and includes an Xbee socket, it does have one kind of annoying problem: no mounting holes. While pondering this, I decided to try to dig out the dimensions for the standard hole pattern used on the Arduino. Like many things regarding the Arduino, the answer could be found on the Adafruit weblog:

Arduino Hole Dimensions Drawing from adafruit industries blog.

Breadboarding a Tellymate for the Arduino…

The microcontrollers of today are in many ways superior to the simple eight bit computers that I learned to program as a teenager, but one way in which most of them are decidedly inferior is that they have only a very limited number of actual peripherals. After all, even my simplest Atari 400 back in 1980 could be hooked to a television and display text and graphics. But there is something good about these microcontrollers: they are quite a bit faster than these old chips, and they are lots cheaper.

This means that it’s possible to generate video not by the usual method of having dedicated computer hardware, but by “bit-banging” the video signal directly with carefully written code with timing. Many Arduino users have seen the “TV out” library for the Arduino, which does precisely this, if you haven’t check out this old video of mine where I demonstrate it.


But that library has two major problems. It’s very low resolution, and it’s hard to use with libraries that may screw up it’s video timing (such as the library that allows you to read PS/2 keyboards).

But there is another cool idea: use a separate Atmel AVR chip as a dedicated processor to generate video. This is the approach that the Batsocks Tellymate Shield uses. If you want, you can buy a kit from them for an Arduino shield, which would be very convenient. It basically implements a simple serial terminal which implements VT-52 like command codes, which makes it very simple to program. And because it is entirely separate from the main Arduino, it generates stable video without any of the timing problems that using TVout can have. Oh, and because it is very cleverly written, it can do higher resolution video (25 lines of 38 characters).

A very cute gadget. What’s even more awesome is that you can breadboard one of these things very, very simply. I had an old ATmega88 sitting in a drawer. If you don’t need full RS232 voltage levels (like, for instance, driving it from the Arduino serial ports) then the only thing you need are two resistors, two diodes, and a smattering of capacitors. I programmed my Arduino to serve as the ISP, flashed the firmware into the chip (the authors nicely include versions for a wide variety of Arduino chips), reprogrammed the fuses to use the external crystal, and then breadboarded it up. And then, after powering it up, well, nothing. I hauled out my scope. Was serial data going to the board? Yep. Anything like a signal coming out? Nope. Wait, it looks like something varying from 4.5 to 5.5 volts? Ooops. Loose ground wire. Fixed that. Working? Nope. Recheck pins. Doh! Outputs are on pins 15 and 17, not 16 and 18. Fixed that, and….

It works.

If you need a simple video interface for an Arduino project, you can easily build this interface on a breadboard, a chunk of protoboard, or you can get various version with differing capabilities from the creators. But try it out: it’s a cool little gadget.

Earthquake!

About 5:30AM, I woke to find my bed slightly shaking, and maybe a hint of some noise. Just as I was about to drift off, a fairly violent jolt hit the house. Some various items were knocked off shelves, a fairly scary way to wake up. Carmen and I bolted for the door and waited for aftershocks: I thought I felt an immediate smaller shock, but since then, things have been fairly quiet. Worse earthquake I’ve felt in 20 years here (I missed the Loma Prieta).

Here is the seismogram that a local station recorded:

Phew. Exciting. All of our local twitter/facebook friends are reporting that things are okay where they are at. Doubt I’m going back to bed though. 🙂

The battle with weight begins anew…

Back in 2004, I blogged that I was joining Weight Watchers. Over the next year or so, I shed about seventy pounds, but then reached a stalling point where further weight loss seemed impossible. This frustration ultimately caused me to stop going.

My weight held for a while, but over the years (and recently at an accelerated pace) my weight has returned, so now nearly 8 years later, I’m back in the same position again. Blood pressure up. Cholesterol up. Weight up. And eight years older. So, it’s back to Weight Watchers again. It’s not without it’s drawbacks (for one, being outnumbered by women at meetings by 25 to 1) but it is fundamentally quite reasonable, and I’ve had success with it before.

Today, I’ll merely list my weight at 1.0 (measured in normalized brainwagon units). As we go forward, my hope is to update you with smaller fractional values. Wish me luck.