Hardware Reference
In-Depth Information
Even the ATMega328, with double the memory capabilities, or even the ATMega2561 with 256KB, seems less than
adequate, especially when compared to the Raspberry Pi. However, the tasks the Arduino will generally perform are very
simple and usually in the realm of comparing various inputs and performing simple logic, so this specification is more
than large enough. The complex tasks found in operating systems, like TCP/IP stacks, are not usually necessary since
you can transmit requests to a connected PC for these tasks. And when they're not, the problem is generally solved in
hardware by building the appropriate circuit and including the necessary driver software for that hardware component.
If you're experienced with other microcontrollers or PIC chips, the Arduino isn't different in any technical way
to them, so you can continue to use whatever chips you have used previously. However, the Arduino offers many
benefits to those less experienced with electronics:
u
A C-based language and development environment, instead of assembler
u
USB input/output control as standard
u
A large community of hackers, publishing project designs and sharing tips
u
Robust development boards that are less likely to blow up if you wrongly connect something
u
A wide range of prebuilt, compatible circuit boards (called
shields ) to provide more complex
functionality such as wireless communication. You'll see some examples later in the chapter
in the “Arduino Hardware” section
u
And, for the purists, open source hardware and architecture. This is an often overlooked point.
Having the hardware open source allows clone makers, such as Seeeduino, to exist. Clones can
be cheaper and more robust and can use surface-mount components while still remaining pin
compatible with the Arduino and its assorted shields
The scope of possible projects is similar to that of the LEGO Mindstorms, although now the circuits can be very
much smaller, involving more discrete components and wider functionality achieved through the aforementioned
shields. Whereas a LEGO device might be able to beep or play a short sound to indicate the arrival of e-mail, the
Arduino can use speech synthesis or full audio playback.
Installation and Setup
All Arduino software is written on a PC and transmitted to the board through USB. This is also used to receive any data
the Arduino chooses to transmit, by default through /dev/ttyUSB0 . (Remember to add your user into the dialout
group so that /dev/ttyUSB0 is accessible.) The development can take place in any fashion you desire, but it is simplest
with the Java-based IDE. Even if you adopt a command-line approach, the code will need to be compiled using the
avr-gcc toolchain, which can be installed under Debian with this:
apt-get install gcc-avr avr-libc avrdude
Java, if uninstalled, will need an extra line, like this:
apt-get install openjdk-6-jre
From here, it's a simple matter of installing the IDE. This is provided as a single archive from the web site at
http://arduino.cc/en/Main/Software . Extract this to an appropriate directory (root access is not required for any
of these steps), and run ./arduino from the directory. You should then set up the appropriate USB device and type of
Arduino (Tools ° Serial Port and Tools ° Board, respectively) before use.
You can begin a project by selecting File ° New from the menu. This creates what the Arduino IDE calls a sketch .
This involves a subdirectory in the Arduino working folder and a primary source file. Other source files can be added into
the sketch (through Sketch ° Add File) and will be automatically included into the project build. There is no Makefile
Search WWH ::




Custom Search