You might ask yourself why you shouldn’t enjoy the convenience of DHCP
and DNS all the time. First of all, DHCP and DNS are two more things that
can go wrong. Debugging embedded systems is hard enough already, so you
shouldn’t make it harder by using services that you don’t absolutely need.
For most applications, hardwired IP addresses will do the job.
Another reason is code size. DHCP and DNS support will increase significantly
the size of the resulting binary file. Adding DHCP support to our time service
program increased its size by nearly 3,500 bytes. Still, DHCP and DNS are
useful tools for certain applications, and it’s great that they’re now part of
the Arduino’s standard library.
In the next chapter, you’ll learn how to implement another important network
protocol: you will send emails using an Arduino.
Alternative Networking Technologies
Ethernet is one of the most popular and most powerful networking technologies.
Using an Ethernet shield, you can easily connect your Arduino to the Internet both
as a client and as a server.
Depending on your project’s needs, it’s sometimes better to use a wireless connection.
With a Wi-Fi shield,
a
you can easily turn your Arduino into a wireless networking
device.
But often you don’t need the full power of Ethernet, especially if you need only short-
range communication in a personal area network. You can choose from a variety of
options, but Bluetooth and ZigBee
b
are probably the most popular. Excellent solutions
for both of them are available for the Arduino.
Finally, you can even participate in cellular networks with your Arduino. Plug in a
GSM shield
c
and your SIM card, and you are ready to go.
a.
http://arduino.cc/en/Main/ArduinoWiFiShield
b.
http://en.wikipedia.org/wiki/Zigbee
c.
http://arduino.cc/en/Main/ArduinoGSMShield
What If It Doesn’t Work?
Networks are complex and complicated beasts, and many things can go wrong
when trying the examples in this chapter. The most common problems are
the following:
• You have chosen the wrong serial port in the Processing application. By
default, the application uses the first serial port it can find. It might be
that you have connected your Arduino to another port. In this case, you
Chapter 10. Networking with Arduino • 180
report erratum • discuss
www.it-ebooks.info