An Introduction to Hardware Hacking, or why three levels is a good thing.
Hardware hacking; what’s the first thing that comes to mind? That one scene from Hackers, or maybe Jason Statham hacking his own body in Crank? Well, maybe the reality is a lot more mundane; in my case there was a lot of head scratching, confusion and soldering. Despite knowing how to build a circuit and understanding the physics behind circuitry and electronics, I found the whole affair rather difficult. I ended up spending a lot of time on the internet looking up information, and even more time tinkering with a few different ways to control hardware. Thanks to the open source community, knowing the science of how to wire up a circuit is no longer such a barrier to entry as it once might have been. We, as creators, now have all the choices to make and are able to choose our own challenges while still ending up with the solution that we’re looking for.
There’s how many levels?
In my experience, there’s roughly three levels of difficulty when you first start hardware hacking. The first level takes most of the physical wiring and programming out of your hands or heavily simplifies it, and leaves you with the raw building blocks to create, such as with littleBits, or with Lego Mindstorms. The second level takes a more ambiguous form; it’s not quite completely customisable, but it’s where we start to see wiring happening guided by an interface to a computer, like with the MakeyMakey. With the third level, we start seeing fully programmable microcontrollers, breadboards and intricate circuits as seen with Arduinos and the Raspberry Pi project.
Level One; littleBits
The littleBits system is possibly one of the simplest systems I’ve ever seen, and relies solely on clipping the blocks together using the integrated magnets in each block to both hold them together and pass electricity from one block to the next. As the pieces are colour coded, they also make it easy to quickly find out how to create a circuit from nothing and get a fun little hack running. They present a fantastic learning experience and are just great fun to sit and play with, even if you do already know a bit more about hardware. Because they include electric motors, fans and sensors as buyable pieces, hacking together a small proof of concept or project using them is incredibly easy.
Level Two; MakeyMakey
The Makey Makey makes things a bit more complicated: the entire principle here is to start controlling your computer using, well, anything that can conduct electricity. As such, things can be triggered by cats licking out of a bowl of milk, or somebody touching a banana with a hand. Creating the connections is just a case of connecting alligator clips or wires to the board. What makes it so easy to use is the row of connections along the bottom of the board for ground and separate connection points which are labeled with individual keyboard buttons. The trick here is just to make the ‘ground’ strip on the board touch whichever input you have clipped a wire on to. Setting up your computer to work with the input provided by the MakeyMakey is just a case of configuring the programs on the computer to use keyboard strokes to trigger events.
When using the MakeyMakey for development, the device acts like a second keyboard connected to a computer. This means that while writing any projects, keyboard input is all you need to program for. Because of this, the MakeyMakey can’t really be used for measuring discrete quantities with one input, but can be used to detect binary data; whether, say, a door being open or closed. More information can be found on the MakeyMakey website at https://www.makeymakey.com.
Level Three; Arduino
The Arduino platform is a much more customisable system and its’ entire circuit board is open source, and the website can be found at arduino.cc. It’s open source roots has the bonus of allowing hardware developers or manufacturers like Adafruit to create specific add-ons for the Arduino, such as LCD displays or components allowing connection to the internet. As all it takes to connect to an arduino board is a stripped wire, the barrier of entry here is a little higher, owing to the programmer needing to have at least a basic grounding in creating circuitry. While the Arduino takes many forms, all they boil down to are microcontrollers wired up to different pins. These pins are, in a broad sense, used to either measure or supply particular voltages to whatever components are connected to the pins, and come in 3 main categories; digital, analogue, and power. The digital pins can serve as both outputs and inputs, however, can only be read from or written to using zero volts and the native voltage of the board, usually 5 volts. This means that for programming purposes it is either on or off, like the inputs found in the MakeyMakey. The analogue pins differ from the digital pins, having the ability of being able to handle any voltage between 0 volts and the maximum native voltage of the board, usually 5 volts. At the pin name implies, the power pins are used to supply power to whichever components need powering. In the case of the Arduino, these usually come in 3.3 volts or 5 volts. The Arduino system is also portable; batteries can be connected to the boards to power them, and as such can be placed in most any environment.
Programing the Arduino board’s microcontroller is usually just a case of using the Arduino developer environment, which is available on the Arduino website. Using an Arduino board on Windows, however, presents the interesting challenge of needing to disable driver signing in order for the board to be recognised by the operating system. However, if you’re more home with web development technologies such as Javascript and HTML, the BreakoutJS library offers a more familiar set up and can be found at breakoutjs.com. It enables the programmer to interact with the board through a web browser, using interface elements such as sliders and radio buttons and can also be triggered by standard Javascript. The ‘Johnny Five’ library, available at github.com/rwldrn/johnny-five , takes a slightly different tack to BreakoutJS and uses a Node server and Javascript to pass commands to the board.
Level Three; Raspberry Pi
The Rasperry Pi is a step up from the Arduino in terms of both complexity and flexibility. Marketed as a credit card sized computer, this chip has most of the inputs and outputs you would expect from an arduino, coupled with the hardware of a very low end computer; USB, HDMI outputs, Ethernet port, RCA video and stereo outputs along with general purpose input and output pins, a 3.3 volt pin and a 5 volt pin. The general purpose pins are separated into two banks; a 26 pin bank and an 8 pin bank, both with their own power supplies. As the pins are not explicitly mapped however, it’s quite possible to do a lot of damage to the board by connecting to the wrong pins! Google-ing for a layout of the GPIO pins will usually give you a decent graphic to work from. The Raspberry Pi features a surprisingly powerful processor which enables it to run Linux, as well as a whole host of other operating systems. As it is able to run a functional version of Linux, this means that any programming language that has libraries written for it to access the pins and can run on an ARM processor can be compiled and ran on the Pi. As far as creating circuits on the Raspberry Pi, there is little to no differences than the same tasks using an Arduino, apart from the Arduino having built in safeguards to prevent shorting out parts of the board.
Actually writing code for the device and testing it leaves the programmer with three options, from what i’ve found; The first option is to program and run the code from the device itself using a keyboard, mouse and monitor. There’s a whole host of development tools available for the Linux variant the Pi runs. The second option is using SSH to access the Pi over an Ethernet cable and upload and run the code that way. The third way is something that the folks over at Adafruit came up with, called the WebIDE. As the title implies, the Pi is connected to your router, and then accessed through the web browser. An online guide for this can be found at learn.adafruit.com/webide/overview.
Why are three levels awesome?
By no means is this in any way, shape, or form canon however; these are all just tidbits of information i’ve gathered while working with and being exposed to different methods of using hardware to control and read physical things. While being incredibly difficult on occasion, using hardware to accomplish a goal like building a robot or even making a light blink, provides an incredible sense of accomplishment and freedom. It lays the tools of say, a master electrician and those of an engineer at your feet and invites you to ‘come play’. As there’s so many different ways to go about hacking hardware, or creating your own circuits from scratch, there’s a tool or method to meet anybody’s skills and needs. This means that almost anybody, almost anywhere can start their first hardware hack right now. Thanks to both a rising interest in creating physical things instead of solely digital, and the willingness and ingenuity of people to facilitate it, there really is no better time to ‘get stuck in’, as it were. There’s nothing quite like the satisfaction of suddenly having a physical project that you’ve made blinking away at you, that works exactly how you had imagined it; there’s no reason not to give it a go!