Hardware Reference
In-Depth Information
Figure 8-4. One of many LEGO cases, from LegoPunk.com/?q=node/210
Interfacing With Hardware
When your Raspberry Pi arrives, it comes as a circuit board in a small static-free bag. This is a far cry from the big box
and fancy packaging of a laptop, or desktop machine. It might be this that makes people more inclinded to connect
wires directly to the board for the purpose of interfacing, in a way they're never likely to do with a desktop.
Given the previous mentioned problems with USB, and the fact that the USB sockets are slow and usually full of
keyboards, mice, and hard drives, means that USB isn't the usual way of interfacing with a Raspberry Pi. That accolade
is shared between the GPIO, I2C, SPI, and Arduino-related technology.
Hardware Caution
Debugging software, although painful and difficult, is comparatively easy when compared to debugging hardware.
Especially, when you come from a software background. The debuggers available to hardware engineers (e.g., a voltmeter,
and an ammeter) are positively antiquated when compared to even the most basic version of GDB. So, unless you're a
rich kid with a good logic analyzer, you will have modify your development approach! Particularly as a hardware bug can
destroy the circuit you're trying to build, and the computer connected to it. When this happens you might not even realize
it, and waste time trying to fix a circuit that can never work.
It is for this reason that many interface boards exist, as they generally have protection buffers built-in so even if
you put too much voltage on an input in, or try and drive the current the wrong way around the circuit, then you won't
destroy your hardware. They can also help fix the voltage levels needed to run the various pieces of hardware. A lot of
discrete socketed components use 5v, which is why the Arduino can work simply with them since it's is set to use 5v by
default. However, with the Raspberry Pi running at 3.3v, you need adjust the voltage level when communicating with
such chips. An interface board can help in this regard.
If your development approach could be described as cautious, then adopting I2C or SPI might be preferably to
GPIO because they both need a chip to effectively handle the protocol-such as the MCP23017 or MCP3208, respectively.
Not only do they allow many more channels than the GPIO, but they also provide a form of buffering to help protect the
Raspberry Pi itself.
Search WWH ::




Custom Search