Hack and / - Working on My Temper
In my August 2010 column, I wrote about how I used an old laptop, some spare X10 devices I had and a TEMPer USB thermometer to control my fridge so I could ferment beer in a nice, controlled environment. Since then, I've received a number of e-mail messages from Linux Journal readers talking about their own projects to create the perfect beer fridge. After reading about Arduino-powered fridges and other hardware-hacking solutions, I became jealous and began to think that my laptop solution, although simple, was overkill. My hardware-hacking skills aren't quite to Arduino levels yet, so I ultimately decided to look at other, lower-powered Linux devices I had around (it turns out I had quite a few) to see if I couldn't coax one of them into controlling my fridge.
The kind of device I needed had to meet a few criteria. One, it should be able to run Linux. Second, it ideally would have at least one USB port that I could use (with a hub if necessary) to connect my USB thermometer, and if it didn't have a serial port, also connect a USB serial adapter so I could use my X10 serial dongle. Sorry, Spykee robot, but my final choice was a pink Pogoplug (Figure 1). The Pogoplug is a nifty little Linux-powered appliance that allows you to connect your own USB hard drives and then provide that data to you wherever you are, as long as you have an Internet connection. Think of it somewhat like a personal Dropbox, except you have full control of the storage and data. There's also a good-size community around the Pogoplug that provides third-party applications and even a custom Linux distribution based on Arch Linux.
The best things about the Pogoplug for my purposes were that it was small, low-powered, had a custom Linux distribution with package management, and most important, it had four USB ports. Once I decided to use it instead of my laptop, the next step was to get the Arch Linux-based Plugbox Linux installed on it. This distribution is hosted on www.plugapps.com, and the site provides all sorts of third-party applications and packages for Pogoplug, DockStar and SheevaPlug devices. I simply followed the install document for Plugbox Linux verbatim, so instead of reposting it here, just follow the steps at www.plugapps.com/index.php5?title=PlugApps:Pogoplug_Setboot. Be sure to follow the advice about setting up openntpd; otherwise, Plugbox's time will be way off, and you'll get strange warnings and errors as you try to install and compile software.
Essentially, Plugbox Linux installs itself on an external USB drive that you provide and then sets up the bootloader so that if the drive is inserted, it will attempt to boot from it; otherwise, it will boot from the native Pogoplug firmware. This provides a simple, relatively low-risk way to modify the device to do what you want while still being able to go back to defaults. Although I might have been able to get the native Linux install to do what I wanted, Plugbox has simple package management using Arch Linux's pacman, so I also could go back to the standard Pogoplug firmware at any time. In my case, I used a spare 1GB thumbdrive for the OS, and that seemed to be plenty.
After the Plugbox installation completed, I was able to boot in to the environment and configure everything over SSH. Now, all I needed to do was repeat my steps to get the CPAN modules my TEMPer device needed, install bottlerocket, and I should be done. I guess I'm spoiled by all the packages available in Debian, but then again, I didn't expect bottlerocket to be packaged for this custom distribution. I figured I'd be able to get the CPAN modules I needed, but the real question was whether I could get bottlerocket to compile. Without it, this project would be over. It turns out it wasn't too difficult. I just used pacman to install my build environment and then downloaded and compiled bottlerocket like you would in the old days:
# pacman -S gcc make # wget http://www.linuxha.com/bottlerocket/bottlerocket-current.tar.gz # tar xvfz bottlerocket-current.tar.gz # cd bottlerocket-0.04c/ # ./configure # make # make install
When I tested bottlerocket, I noticed something interesting. The USB-to-serial adapter I plugged in was detected and appeared to work; however, after I ran bottlerocket the first time, any subsequent execution would result in an error for /dev/ttyUSB0. I had to unload and reload that particular USB-to-serial module between each bottlerocket execution for it to work properly. I know from experience that not all USB-to-serial adapters are created equal and that some do a better job, for instance, with sending break signals to your console, so I figured this was just a case of a cheap serial adapter without full serial port support. Instead of just living with the kludge of reloading the module each time, I replaced this adapter with another one I had that I knew had excellent support for break signals and overall had better compatibility. With this new adapter, I was able to power my fridge on and off without issues.
Kyle Rankin is a director of engineering operations in the San Francisco Bay Area, the author of a number of books including DevOps Troubleshooting and The Official Ubuntu Server Book, and is a columnist for Linux Journal.
|PHP for Non-Developers||Jun 30, 2015|
|A Code Boot Camp for Underprivileged Kids||Jun 30, 2015|
|Comprehensive Identity Management and Audit for Red Hat Enterprise Linux||Jun 29, 2015|
|Linux Kernel 4.1 Released||Jun 26, 2015|
|Secure Server Deployments in Hostile Territory||Jun 25, 2015|
|Take Control of Growing Redis NoSQL Server Clusters||Jun 24, 2015|
- Comprehensive Identity Management and Audit for Red Hat Enterprise Linux
- A Code Boot Camp for Underprivileged Kids
- Linux Kernel 4.1 Released
- Secure Server Deployments in Hostile Territory
- Django Templates
- PHP for Non-Developers
- Cinnamon 2.6 Released
- Gettin' Sticky with It
- Attack of the Drones
- Take Control of Growing Redis NoSQL Server Clusters