Friday, November 8, 2013

Component-Arduino




ARDUINO
 Arduino is  the most popular microcontroller board for advanced users and all kinds of more ambitious projects. It’s been used to make robots, home automation gadgets, automotive projects, for sensing and controlling lights, motors, locks and servos, sound and video, interactive objects like animated sculptures, toys and games, radio links and just about anything else you can dream up. 


Introduction:

An Arduino board with a RS-232 serial interface (upper left) and an Atmel ATmega8

microcontroller chip (black, lower right). The 14 digital I/O pins are located at the top and the 6

analog input pins at the lower right.

Arduino is an open-source single-board microcontroller, descendant of the open-source Wiring

platform, designed to make the process of using electronics in multidisciplinary projects more

accessible. The hardware consists of a simple open hardware design for the Arduino board with

an Atmel AVR processor and on-board input/output support. The software consists of a standard

programming language compiler and the boot loader that runs on the board.

Arduino hardware is programmed using a Wiring-based language (syntax and libraries), similar

to C++ with some slight simplifications and modifications, and a Processing-based integrated

development environment.

The Arduino project received an honorary mention in the Digital Communities category at the

2006 Prix Ars Electronics.

37

 HARDWARE:

Fig 4.1 Arduino hardware.

An Arduino board consists of an 8-bit Atmel AVR microcontroller with complementary

components to facilitate programming and incorporation into other circuits. An important aspect

of the Arduino is the standard way that connectors are exposed, allowing the CPU board to be

connected to a variety of interchangeable add-on modules known as shields. Some shields

communicate with the Arduino board directly over various pins, but many shields are

individually addressable via an I²C serial bus, allowing many shields to be stacked and used in

parallel. Official Arduinos have used the megaAVR series of chips, specifically the ATmega8,

ATmega168, ATmega328, ATmega1280, and ATmega2560. A handful of other processors have

been used by Arduino compatibles. Most boards include a 5 volt linear regulator and a 16 MHz

crystal oscillator (or ceramic resonator in some variants), although some designs such as the

LilyPad run at 8 MHz and dispense with the onboard voltage regulator due to specific formfactor

restrictions. An Arduino's microcontroller is also pre-programmed with a boot loader that

simplifies uploading of programs to the on-chip flash memory, compared with other devices that

typically need an external programmer.

At a conceptual level, when using the Arduino software stack, all boards are programmed over

an RS-232 serial connection, but the way this is implemented varies by hardware version. Serial

Arduino boards contain a simple inverter circuit to convert between RS-232-level and TTL-level

signals. Current Arduino boards are programmed via USB, implemented using USB-to-serial

38

adapter chips such as the FTDI FT232. Some variants, such as the Arduino Mini and the

unofficial Boarduino, use a detachable USB-to-serial adapter board or cable, Bluetooth or other

methods. (When used with traditional microcontroller tools instead of the Arduino IDE, standard

AVR ISP programming is used.)

The Arduino board exposes most of the microcontroller's I/O pins for use by other circuits. The

Diecimila, Duemilanove, and current Uno provide 14 digital I/O pins, six of which can produce

pulse-width modulated signals, and six analog inputs. These pins are on the top of the board, via

female 0.1 inch headers. Several plug-in application shields are also commercially available.

The Arduino Nano, and Arduino-compatible Bare Bones Board and Boarduino boards may

provide male header pins on the underside of the board to be plugged into solderless

breadboards.

SOFTWARE:

The Arduino IDE is a cross-platform application written in Java, and is derived from the IDE for

the Processing programming language and the Wiring project. It is designed to introduce

programming to artists and other newcomers unfamiliar with software development. It includes a

code editor with features such as syntax highlighting, brace matching, and automatic indentation,

and is also capable of compiling and uploading programs to the board with a single click. There

is typically no need to edit makefiles or run programs on a command-line interface. Although

building on command-line is possible if required with some third-party tools such as Ino.

The Arduino IDE comes with a C/C++ library called "Wiring" (from the project of the same

name), which makes many common input/output operations much easier. Arduino programs are

written in C/C++, although users only need define two functions to make a runnable program:

* setup() – a function run once at the start of a program that can initialize settings

* loop() – a function called repeatedly until the board powers off

The integrated pin 13 LED

39

A typical first program for a microcontroller simply blinks an LED on and off. In the Arduino

environment, the user might write a program like this

Program:

#define LED_PIN 13

void setup () {

pinMode (LED_PIN, OUTPUT); // enable pin 13 for digital output

}

void loop () {

digitalWrite (LED_PIN, HIGH); // turn on the LED

delay (1000); // wait one second (1000 milliseconds)

digitalWrite (LED_PIN, LOW); // turn off the LED

delay (1000); // wait one second

}

It is a feature of most Arduino boards that they have an LED and load resistor connected

between pin 13 and ground, a convenient feature for many simple tests.[29] The above code

would not be seen by a standard C++ compiler as a valid program, so when the user clicks the

"Upload to I/O board" button in the IDE, a copy of the code is written to a temporary file with an

extra include header at the top and a very simple main() function at the bottom, to make it a valid

C++ program. See Cyclic executive

The Arduino IDE uses the GNU toolchain and AVR Libc to compile programs, and uses avrdude

to upload programs to the board.As the Arduino platform uses Atmel microcontrollers Atmel’s

development environment, AVR Studio or the newer Atmel Studio, may also be used to develop

40

software for the Arduino. For educational purposes there is third party graphical development

environment called Minibloq available under a different open source license.

 Language Reference

Arduino programs can be divided in three main parts: structure, values (variables and constants),

and functions.

Structure

· setup()

· loop()

C o n tr o l S tr u c tu r e s

· if

· if...else

· for

· switch case

· while

· do... while

· break

· continue

· return

· goto

F u r th e r Sy n ta x

· ; (semicolon)

· {} (curly braces)

· // (single line comment)

· /* */ (multi-line comment)

· #define

· #include

A r ith m e tic O p e r a to r s

· = (assignment operator)

Variables

C o n s ta n ts

· HIGH | LOW

· INPUT | OUTPUT|INPUT_PULLUP

· true | false

· integer constants

· floating point constants

D a ta T y p e s

· void

· boolean

· char

· unsigned char

· byte

· int

· unsigned int

· word

· long

· unsigned long

· short

· float

· double

· string - char array

· String - object

· array

Functions

D ig ita l I /O

· pinMode()

· digitalWrite()

· digitalRead()

A n a lo g I /O

· analogReference()

· analogRead()

· analogWrite() - PWM

D u e o n ly

· analogReadResolution()

· analogWriteResolution()

A d v an c e d I /O

· tone()

· noTone()

· shiftOut()

· shiftIn()

· pulseIn()

T im e

· millis()

41

· + (addition)

· - (subtraction)

· * (multiplication)

· / (division)

· % (modulo)

C om p a r is o n Op e r a to rs

· == (equal to)

· != (not equal to)

· < (less than)

· > (greater than)

· <= (less than or equal to)

· >= (greater than or equal to)

B o o le an Op e r a to r s

· && (and)

· || (or)

· ! (not)

P o in te r Ac c e s s O p e r a to r s

· * dereference operator

· & reference operator

B itw is e Op e r a to r s

· & (bitwise and)| (bitwise or)

C o n ve r s io n

· char()

· byte()

· int()

· word()

· long()

· float()

Va r ia b le S c o p e & Q ualifie r s

· variable scope

· static

· volatile

· const

R a n dom N um b e r s

· randomSeed()

· random()

B its a n d B y te s

· lowByte()

· highByte()

· bitRead()

· bitWrite()

· bitSet()

·

· micros()

· delay()

· delayMicroseconds()

M a th

· min()

· max()

· abs()

· constrain()

· map()

· pow()

· sqrt()

T r ig o n om e tr y

· sin()

· cos()

· tan()

· bitClear()

· bit()

E x te r n a l I n te r r up ts

· attachInterrupt()

· detachInterrupt()

· noInterrupts()

·

Applications:

* Xoscillo - open-source oscilloscope

* Open-source hardware for scientific equipment.

The original Arduino hardware is manufactured by the Italian company Smart Projects. Some

Arduino-branded boards have been designed by the American company SparkFun Electronics.

42

 Types of Arduino:

Fifteen versions of the Arduino hardware have been commercially produced to date

1. The Serial Arduino, programmed with a DE-9 serial connection and using an ATmega8

2. The Arduino Extreme, with a USB interface for programming and using an ATmega8

3. The Arduino Mini, a miniature version of the Arduino using a surface-mounted ATmega168

4. The Arduino Nano, an even smaller, USB powered version of the Arduino using a surfacemounted

ATmega168 (ATmega328 for newer version)

5. The LilyPad Arduino, a minimalist design for wearable application using a surface-mounted

ATmega168

6. The Arduino NG, with a USB interface for programming and using an ATmega8

7. The Arduino NG plus, with a USB interface for programming and using an ATmega168

8. The Arduino Bluetooth, with a Bluetooth interface for programming using an ATmega168

9. The Arduino Diecimila, with a USB interface and utilizes an ATmega168 in a DIL28

package (pictured)

10. The Arduino Duemilanove ("2009"), using the ATmega168 (ATmega328 for newer

version) and powered via USB/DC power, switching automatically

11. The Arduino Mega, using a surface-mounted ATmega1280 for additional I/O and memory.

12. The Arduino Uno, uses the same ATmega328 as late-model Duemilanove, but whereas the

Duemilanove used an FTDI chipset for USB, the Uno uses an ATmega8U2 programmed as a

serial converter.

13. The Arduino Mega2560, uses a surface-mounted ATmega2560, bringing the total memory

to 256 kB. It also incorporates the new ATmega8U2 (ATmega16U2 in revision 3) USB chipset.

43

14. The Arduino Leonardo, with an ATmega32U4 chip that eliminates the need for USB

connection and can be used as a virtual keyboard or mouse. It was released at the Maker Faire

Bay Area 2012.

15. The Arduino Esplora, resembling a video game controller, with a joystick and built-in

sensors for sound, light, temperature, and acceleration.

 Open hardware and open source:

The Arduino hardware reference designs are distributed under a Creative Commons Attribution

Share-Alike 2.5 license and are available on the Arduino Web site. Layout and production files

for some versions of the Arduino hardware are also available. The source code for the IDE and

the on-board library are available and released under the GPLv2 license.

Arduino and Arduino-compatible boards make use of shields, which are printed circuit boards

that sit atop an Arduino, and plug into the normally supplied pin-headers. These are expansions

to the base Arduino. There are many functions of shields, from motor controls, to breadboarding

A list of Arduino-compatible shields is maintained at the Arduino Shield List website. A number

of shields can also be made DIY.

No comments:

Post a Comment