Hardware Reference
In-Depth Information
You've already learned how to connect both analog and digital inputs/outputs,
but what about more complicated devices? The Arduino can expand its capabilities
by interfacing with a variety of external components. Many integrated circuits
implement standardized digital communication protocols to facilitate communi-
cation between your microcontroller and a wide array of possible modules. This
chapter explores the I 2 C bus (pronounced “eye squared see” or “eye two see”).
The I 2 C bus enables robust, high-speed, two-way communication between
devices while using a minimal number of I/O pins to facilitate communication.
An I 2 C bus is controlled by a master device (usually a microcontroller), and
contains one or more slave devices that receive information from the master.
In this chapter, you learn about the I 2 C protocol, and you implement it to com-
municate with a digital I 2 C temperature sensor capable of returning measure-
ments as degree values rather than as arbitrary analog values. You build upon
knowledge from previous chapters by combining what you learn in this chapter
to expand earlier projects.
NOTE Followthestepsofthischapterwiththistutorialvideo: www.jeremyblum
.com/2011/02/13/arduino-tutorial-7-i2c-and-processing/ .Youcanalso
findthisvideoontheWileywebsiteshownatthebeginningofthischapter.
HistoryoftheI 2 CBus
When it comes to communication protocols, understanding how the protocol
evolved over time makes it a lot easier to understand why it works the way it
does. The I 2 C protocol was invented by Phillips in the early 1980s to allow for
relatively low-speed communication between various ICs. The protocol was
standardized by the 1990s, and other companies quickly began to adopt the
protocol, releasing their own compatible chips. Generically, the protocol is known
as the “two-wire” protocol because two lines are used for communication, a
clock and data line. Although not all two-wire protocol devices have paid the
license fee to be called I 2 C devices, they are commonly all referred to as I 2 C.
This is similar to how Kleenex ® is often used to refer to all tissues, even those
that aren't manufactured by Kleenex ® . If you find a device that says it uses the
“two-wire” communication protocol, you can be fairly certain that it will work
in the ways described in this chapter.
I 2 CHardwareDesign
Figure 8-1 shows a common reference setup for an I 2 C communication system.
Unlike previous digital communication that you've seen in this topic, I 2 C is
unique in that multiple devices all share the same communication lines: a clock
 
Search WWH ::




Custom Search