Computing stuff tied to the physical world

Linux, pins, volts, and ports

One of the more interesting properties of these little Linux boards, is the presence of I/O pins – which can be directly controlled from Linux, even from simple shell scripts in fact.

But there are some considerations to keep in mind:

  • Voltage levels – the CPU chip on these boards operates on 3.3V or less, usually. This means you can’t connect them to 5V levels: that will most likely instantly damage the chip and take the whole board down with it – for good!
  • Output currents – the amount of current from these I/O pins is severely limited, usually t 2..8 mA. Some boards can set the “drive strength” of their output pins under software control.
  • Spike protection – keep in mind that the chips used on these board have hundreds of pins to connect them with the rest of the circuit. These pins were never designed to end up on a pin header for external use with long wires to… whatever you connect to it. There is NO protection against inductive spikes or static electricity discharges.

As far as voltage levels are concerned, it’s by far the easiest to stay on the same level everywhere. For this reason, 3.3V-based Arduinos (and other derivatives, including JeeNodes) are much preferred over their 5V versions. I/O between different voltage levels requires level conversion to avoid damage. Sometimes this can be just one or two resistors per pin, but for high-speed connections, more circuitry will be required.

And then there’s the issue of pinouts. Prepare yourself for a lot of “investigative reading” to make stuff work when connected through these pins. To find out how a pin is accessed from Linux, you may have to dig through information deep inside a 1000+ page datasheet!

Which is where the mainstream Linux boards have the advantage: so many people have already worked out the details of the Raspberry Pi for example, that there is a ton of information online – including the WiringPi library, providing an Arduino-like interface to the I/O pins of the Raspberry Pi, as well as its I2C and SPI interface(s).

Here is the pinout of the 40-pin header on the Raspberry Pi A+/B+ models:

Screen Shot 2015 01 15 at 20 21 44

(the above table comes from Wikipedia)

As you can see, there are up to 26 “General Purpose” I/O pins available on this 2×20-pin header, some of which can be re-used as serial console (UART), I2C bus, or SPI bus.

The nice thing about the Raspberry Pi boards is that their I/O pins operate at 3.3V levels, which is easy to interface with. And that there are already millions of them out there!

The BeagleBone Black has more pins, but these boards are (slightly) less common and too many pins can actually be a disadvantage: inserting or removing a “cape” with its two rows of 2×48-pin headers takes quite a bit of force. Not so convenient for ad-hoc experiments.

The Odroid U3 has almost no I/O pins (just I2C and SPI), which in itself isn’t necessarily so bad since we could easily hook up some I/O expanders, but these I/O pins also operate at 1.8V levels. That means we’re forced to add level shifters. Again, not perfect for tinkering.

But there’s a nice trend on the horizon of this fast-moving world. Stay tuned…

[Back to article index]