Pre-West Interview: Christopher Small
Christopher Small's talk at Clojure/West is about using Clojure to build a smart chicken coop.
Christopher Small used Clojure on a BeagleBone Black (a small Linux-based computer) to build a smart chicken coop. He will talk about what it takes to get Clojure running on it. Here is his BeagleBone Black and Clojure project on GitHub.
About Christopher Small
Interview with Christopher Small
PurelyFunctional.tv How did you get into Clojure?
Christopher Small: I actually wrote a blog post about this.
In short, I was evaluating languages with which to implement the machine learning engine for my startup, pol.is. After having done some tinkering with Haskell and OCaml, I'd come to love functional programming, and thought it would be fun to use a functional language for this project. At the time, I wasn't aware of FP's strong concurrency story, but learning of it pretty naturally led me to Clojure, which we went with for a number of reasons.
Since using it, I've fallen more and more in love with it every day. To me Clojure is the best of two worlds: the elegance and power of functional programming combined with the relaxed, fun atmosphere of python or ruby.
I'm now thoroughly addicted.
PF.tv: How did you get into raising chickens? And what led you to try automating some of the tasks involved?
CS: My family raised chickens when I was growing up, so I've been around them since I was little.
More recently, when I moved to Seattle I lived in a housing co-op called the Ballistic Chicken Coop, so called because we took care of half a dozen chickens. The chicken run was fully enclosed, but every now and again the raccoons would find a way in and we'd loose a chicken or two. We'd patch it up, but they'd eventually find another way in. At times we'd try closing the coop door at night and opening in the morning, but that became an orchestration nightmare for the house. Also, chickens like getting up early, and we... didn't. It occurred to me that the only way to make sure they were safe --- aside from completely redoing the run, a major project --- would be to set up an automatic door for the coop. I spent some time coming up with plans and door designs, but sadly never made the time to actually build it.
There was this chicken there we called Black Chicken. She's one of the sweetest birds I've ever seen. She would sit on my lap and let me pet her, rolling her eyes back and clucking gently. We became BFFs. But at the BCC, when chickens stop paying rent, the get "evicted". Which is to say, turned into soup. While I was there, I was able to stay the hand of death, but I knew that if I moved, I would have to take her with me.
Fortunately, my wife and I were able to find a place very close by being vacated by a friend of ours who had a small flock she needed to leave behind. However, at the new place, the top of the run wasn't fenced in like at the BCC, so we had to lock them and let them out each night and morning.
As a lazy, functional programmer, this could not stand, so I finally went to work building the automatic door.
PF.tv: What made you choose the BeagleBone Black?
CS: The short answer is that I already had one. The long answer is the reason I had one already.
The world of physical computing boards breaks down into the microcontroller and full computer camps. The former is best exemplified by the Arduino, while the Raspberry Pi is the most popular of the latter.
Microcontroller boards are nice because they draw a lot less power, but don't come with the creature comforts of a fully fledged operating system, meaning you're stuck writing in C or C++. There is a program called Firmata one can install on their Arduino which makes it possible to control the board remotely, but that would have required an 80 ft USB cable going out to the coop. Since I wanted to try hardware programming in Clojure, this class of boards was ruled out.
While the Raspberry Pi is the most popular full computer board, the BBB has some distinct advantages. The BBB has more pins, and in particular has analog input pins built in, which I needed for this project. At the time anyway, it was also more powerful and had more RAM than the existing Pi, which is a plus for Clojure/JVM programming. However, the Pi released just this Feb 2015 has upped the ante a bit, at a lower price; I'm sure there will be some tit for tat for some time here. There are a whole host of other boards out there with their ups and downs, but without getting too far in the weeds, I chose the BBB.
PF.tv: Where can people follow you online?
PF.tv: If Clojure were a food, what food would it be?
CS: Had to think about this one for a while. But I'm going to go with one of my favorite fruits: the mangosteen. It's modular, elegant, and delicious :-)