Off-the-Shelf Hacker: A Look at CHIP, the $9 Nano-Linux Machine
My CHIP computer board arrived last Saturday. Within the hour I had it hooked up to my big screen, via the composite video output and connected to my WiFi LAN. A common, everyday 5-volt Samsung phone charger supplied the juice and the tried-and-true Logitech K400r wireless keyboard/mousepad gave me control over character input. Boot-up took about a half a minute.
What’s a CHIP Computer?
Like other micro-controllers, the CHIP is a Linux-based board that’s able to run a complete desktop, various command-line and GUI-based apps, along with an assortment of accessible digital input/output pins. It cost me $9 plus $6 shipping. Here are the specs:
- WiFi B/G/N
- Bluetooth 4.0
- 1.0 GHz R8 ARM processor
- 4.0 GB high-speed storage
- 512 KB of RAM
- Composite video output
- 2.4” x 1.6” x .5” board size with headers
The CHIP’s claim to fame from the beginning was that it was the first $9 computer. It also seamlessly integrated WiFi and Bluetooth onto the board, taking advantage of the built-in Linux networking stack.
What I Like about…
One thing I like about the CHIP is that Linux resides in the on-board flash memory, like the Beagle Bone Black and not on a micro-SD card like the Raspberry Pi. As expected, there is about 2.3 GB left of the 4 GB available space for applications and data. You can cram a few applications and quite a bit of data into that amount of space. Using onboard memory should also be more robust than a micro-SD card.
I always add a little piece of Scotch tape over the end of the micro-SD card on my Raspberry Pi projects, so it doesn’t pop out when I’m hauling the gear around. Granted I don’t have 32 GB of space. Certainly, I’ll never lose the card on the CHIP.
Putting WiFi and Bluetooth on the board are also big pluses for the CHIP. It was easy to pull up the WiFi applet in the system tray on the desktop and simply choose my access point. I noticed that the signal was pretty strong, as well, indicating the embedded WiFi chip is fairly sensitive.
The CHIP uses a variant of Debian Linux called CHIP OS. The little machine boots into the desktop, without a password, by default. Applications are easily added using the Synaptic program manager, as well as the old standby, apt-get, from the command line.
Integrating into a Gadget
Basic input and output capabilities to sense and control your environment are fundamental to physical computing. With all the desktops, connectivity and portable options, of the current crop of nano-Linux machines, it’s easy to get side tracked and not realize that these tiny boards have pioneered the movement to DIY physical computing, through access to the input and output pins.
So, as a quick test of ease-of-use of a couple of the CHIP’s GPIO pins, I pirated the wired clicker from an earlier project and attached it to GPIO pins marked XIO-P0 and XIO-P1. The other side of the switches were attached to ground. I didn’t bother with any pull-up resistors, and it seemed to work OK. The XIO designations appear on the headers, by the way. It’s a helpful feature, and you’ll probably need a magnifying glass to make them out.
The CHIP also includes Python, in its build, just like the Raspberry Pi. I uploaded the scrollslides.py script I used in the Raspi presentation machine and simply changed out the library and GPIO pin names. The NextThing Web site has instructions for loading the Adafruit CHIP gpio libraries, which you’ll need to do before the script works. There’s also a bunch of useful GPIO information on the xtacocorex GitHub page. The libraries don’t seem to have any setup code for pull-up/pull-down resistors, so I assume they are internal on the board. Or, perhaps not.
I also added the xdotool utility through the Synaptic program manager. Xdotool outputs a character each time it’s called. It’s kind of like a programmatic keypress, from within the Python script.
Here’s the new scrollslides.py code.
import CHIP_IO.GPIO as GPIO
input_state = GPIO.input("U14_13")
if input_state == False:
os.system("xdotool search --name 'Impress' key Up")
input_state = GPIO.input("U14_14")
if input_state == False:
os.system("xdotool search --name 'Impress' key Down")
Once all that was done, I simply loaded a presentation into LibreOffice (you may have to install that too), brought up a slide presentation and clicked over to slide show. I then used a terminal to start the scrollslides.py script.
chip% sudo python scrollslides.py
Each time I pushed a button LibreOffice would move forward or backward through the slide stack.
You should know that the composite video is limited to something like 640×480 resolution. Nevertheless, the slide text and pictures were crisp and clear.
I was impressed with the performance of LibreOffice on the CHIP. While certainly not as fast as a notebook or a quad-core Raspberry Pi 3, I’ll be using the CHIP to manage my slides in future conference tech talks.
I think the CHIP is a cool little nano-Linux machine. It runs Python and LibreOffice without complaint, has SSH running by default and seems pretty stable. The micro-controller world seems to have settled on Python, for their general purpose programming language and that makes writing code easy whether you’re on a Raspberry Pi, Beagle Bone or CHIP.
Don’t forget that the CHIP has a ton of digital gpio pins. One untapped use Off-The-Shelf Hackers might investigate, is for simple button/switch oriented interfaces. We’ll look at that idea in a future column.
Let us know what you are doing with your CHIP.