Page 225 - Hacking Roomba
P. 225
206 Part III — More Complex Interfacing
The object is beholden to a single computer and cannot function without it. Ethernet is the
simplest and most pervasive physical protocol that can handle TCP/IP as a peer, rather than
being subservient to a larger computer. However, even though it’s the simplest, dealing with
Ethernet and TCP/IP requires a great deal more processing power than a simple serial port.
What Is Ethernet?
You’re likely very familiar with Ethernet as a user. The standard Ethernet jack is an RJ-45
connector that looks sort of like a fat 8-pin telephone jack. It is built into every computer now
as the basic means of computer-to-computer connectivity. At its basic, Ethernet is a protocol
for the physical transmission of serial data. It’s different from RS-232 in many ways, but the
two most notable are:
Ethernet breaks all transmission streams into frames, a kind of data packet.
Ethernet supports multiple devices on the same cable.
The packetization of data was an important and crucial step in the creation of the Internet.
Before packets, computers were connected with serial cables or phone lines. These dedicated
circuits joined just two computers together. If you wanted your computer to talk to another
computer, you had to get another serial port or phone line. It wasn’t a very scalable design, so
Ethernet was created to allow multiple computers to use the same wire. In order to keep one
computer from monopolizing the wire, data transmission was divided into frames and sent one
after the other. Between frames other computers could interrupt to transmit their own data.
Ethernet is a physical layer protocol and thus is only valid on a local area network (LAN). To
communicate between LANs, a higher-level protocol is needed, and the one everyone uses now
is the Internet Protocol (IP). IP provides a common, open language for all networked devices
and is the reason why the Internet works. If you then want to recreate a virtual direct connec-
tion between two computers on the Internet, you can use the Transmission Control Protocol
(TCP), which exists on top of IP the way IP does on top of Ethernet. TCP and IP are so com-
monly used together that they’re often called TCP/IP. TCP/IP doesn’t require Ethernet to
work. In fact, there are many alternatives to Ethernet. The most common alternative available
to consumers is Wi-Fi (also known as 802.11b/g).
To create a device that exists on the Internet like any other, you need to implement TCP/IP
and Ethernet (if using Ethernet). These are complex protocols, not something you can quickly
whip up by hand. For Ethernet, there are several chips that provide that protocol’s functional-
ity. For TCP/IP, there are several tiny stacks (collections of interlocking software) that fit within
modern microcontrollers and talk to these Ethernet chips.
In the open-source realm, one of the most popular TCP/IP stacks is uIP available from
www.sics.se/~adam/uip/. This is a great stack that has been ported to many different
types of microcontrollers. The downside of rolling your own embedded TCP/IP system is
that the Ethernet chips are all surface-mounting and hard to solder for a hobbyist.
Fortunately, several companies have done the hard work of putting together an Ethernet chip,
a microcontroller, and a TCP/IP stack and making it all function. To the user of these devices,