Arduino Sketches. Langbridge James A.

Читать онлайн.
Название Arduino Sketches
Автор произведения Langbridge James A.
Жанр Зарубежная образовательная литература
Серия
Издательство Зарубежная образовательная литература
Год выпуска 0
isbn 9781118919699



Скачать книгу

behind the ringer. Instead, you could solder those components onto a prototyping board, saving space and making your design much more resistant to shock or tampering. The added advantage of this type of board is that you do not need to create your own printed circuit board or do any complicated routing.

      The Different Shields

      Shields exist for a wide variety of applications: storage on SD cards, network connectivity by Ethernet or WiFi robotics control, enabling displays like LCD and TFT screens, to name but a few.

      Most shields can be stacked, so you are not limited to using only one at a time. However, some shields may require input and outputs that will subsequently be unavailable to other designs. Be careful when you choose your shields!

       Arduino Motor Shield

      When using motors, special care has to be taken. When turned off, motors can induce voltage spikes, and components need to be added to a design account for this possibility. Also, typically, USB power is insufficient for motors. The Arduino Motor Shield takes care of this and enables the programmer independent control of two DC motors, or one stepper motor. This shield can either be powered from the Arduino or rely on an external power supply.

       Arduino Wireless SD Shield

      The Wireless SD shield is designed for an Xbee module but works with any radio modem with the same footprint. The on-board micro-SD slot allows the shield to act as a data logger. It also has a small prototyping area for adding components.

       Arduino Ethernet Shield

      The Arduino Ethernet shield does exactly as the name implies; it adds Ethernet connectivity through a W5100 controller, supporting up to four simultaneous socket connections. This module also includes a micro-SD slot for data-logging.

      The Arduino Ethernet Shield has an optional POE module. On a POE network, the module (and the parent Arduino) can be powered directly over Ethernet.

       Arduino WiFi Shield

      The Arduino WiFi Shield includes an HDG104 Wireless LAN controller, enabling an Arduino to access 802.11b/g networks. It can connect to open and encrypted networks. This module also includes a micro-SD slot for data-logging.

       Arduino GSM Shield

      The Arduino GSM shield connects to the Internet through a GPRS network, at a maximum of 85.6 KBps. It also has voice capabilities; by adding an external microphone and speaker circuit, it can make and receive voice calls. It can also send and receive SMS messages. The modem, an M10 by Quectel, is configured using AT commands, handled in software by the GSM library.

      The Arduino GSM Shield comes with a Bluevia SIM card; which allows for machine-to-machine roaming data connections in blocks of 10 or 20 megabytes. However, the GSM shield will work with a SIM card from a different provider.

       Your Own Shield

      In some cases, you will want to make your own electronics. For prototyping, a breadboard is sufficient, but when you need something more robust and more professional, it is time to make your own shield. There are several software options to assist you, but one of the best is the Fritzing application. In Fritzing, you can create breadboard designs, translate them into electronic schematics, and generate a shield layout directly. Fritzing also has its own shield creation system; just upload your schematic to its website and receive a professionally built shield.

      What Can You Do with an Arduino?

      This is one of the most commonly asked questions, but the answer is both simple and complicated. Put simply, you can do almost anything you can imagine. The most difficult part of any Arduino project is identifying a need. Maybe you have an aquarium at home and would like to control the lighting in a specific way? Maybe you would like to add a parking assist device onto your car. Some people just want to add some automation to their house, opening and closing motorized shades at the push of a button. Some people come up with even more amazing and fun projects: a remote-controlled lawn mower, even a chess playing robot. The possibilities are almost unlimited. There are a few things that an Arduino cannot do, but that list is becoming shorter every time a new Arduino-compatible board is released.

      Arduino is an excellent way to learn about software development and electronics because it is a low-cost, robust device that is easy to program.

      Some people use Arduino for hobbyist electronics, with projects ranging from the simple to the incredibly absurd. I know of one person who has entirely automated his house using 10 Arduino Megas, each room communicating with the others to better estimate electrical consumption, heating, and personal comfort.

      Arduino is also used professionally because the components are low-cost and highly reliable and have the added flexibility of being open source. When an initial design is completed, developers can make a board much smaller to be included in toys, small embedded systems, and even industrial machines. Several 3-D printers are based on Arduino for their ease of use and reliability.

      What You Will Need for This Book

      Each chapter has a list of elements required to complete. However, when creating an Arduino project, a few items are required every time. Following is a list:

      • A power supply– The Arduino Uno accepts an input voltage of 6 to 20 V, with 7 to 12 V being recommended. Any standard AC-to-DC center-positive adapter should work fine, preferably one that can supply up to or over 1 amp of current.

      • Multimeter– Almost any model. You do not need to buy the most expensive, far from it, but it should test DC voltage, DC amperage and continuity, with optional resistance calculation, and AC voltage and amperage if you plan to interface your Arduino to main's power.

      • Breadboard– The size depends on your project. Consider a medium-sized board; if it is too small you might not fit all your components (or it might be too cramped, possibly creating short circuits), and large breadboards can cost more and require more space. (I use 680-point breadboards for most of my examples and projects.)

      • Resistors– A common element of every project. There are numerous values, but there are some values that will be used more often. There are kits on the market that propose 10 of every value, or you can go with the most common, the choice is yours. To start out, ten 220-ohm, ten 1-kilohm, and ten 10-kilohm resistors should suffice.

      • LEDs– A great way of knowing the output of a pin. Coupled with a resistor, it can instantly show the state of your project.

      • Other electronic components– Sometimes it is handy to have a small collection of capacitors, switches, and diodes on hand. Each example in this book has a complete list of the required components.

      Summary

      This chapter briefly talked about some of what an Arduino can do, but there is no way of knowing exactly what everyone will do with it. As I said, your only limitation will be your imagination, and I would love to hear about what you have done with an Arduino! You can contact me on my website at http://packetfury.net. I look forward to hearing about your projects!

      In the next chapter, you will learn more about programming an Arduino, including how to install the Arduino IDE, how to connect an Arduino to your computer, and uploading your first sketch.

      Chapter 2

      Programming for the Arduino

      The Arduino is an embedded system, that is to say it has the minimum amount of hardware to get the job done. That does not mean that it is by any means a weak system; there is no point in having a PCI bus if it will never be used – it will only take up space, energy, and increase the overall cost of the device. Arduinos are lightweight – and inexpensive – and make excellent embedded systems. Just like all embedded systems, programming is done on a host computer, not the Arduino itself.

      Programming an embedded system, and indeed programming any sort of system, is the art of writing text that