Arduino Board: Arduino UNO
Arduino Board: Arduino UNO
*Download Arduino Software from Arduino.cc and unzip the folder to your computer. A
file within the folder called Arduino, allows you to launch the programming environment.
*You need to install a driver that comes with Arduino to be able to communicate with
the board
2
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended)7-12V
Input Voltage (limits)6-20V
Digital I/O Pins 14
(of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
USB
7-12 v
3v
5v
GRD
Arduino BT
The Arduino BT is an Arduino board with built-in bluetooth module,
allowing for wireless communication.
LilyPad Arduino
The LilyPad Arduino is a microcontroller board designed for wearables
and e-textiles. It can be sewn to fabric and similarly mounted power
supplies, sensors and actuators with conductive thread.
Arduino Nano
Arduino Nano is a surface mount breadboard embedded version with
integrated USB. It is a smallest, complete, and breadboard friendly. It
has everything that Diecimila has (electrically) with more analog input
pins and onboard +5V AREF jumper.
Xbee Shield
The Xbee shield allows an Arduino board to communicate wirelessly using Zigbee. The module can
communicate up to 100 feet indoors or 300 feet outdoors (with line-of-sight). It can be used as a
serial/usb replacement or you can put it into a command mode and configure it for a variety of
broadcast and mesh networking options.
The Xbee shield was created in collaboration with Libelium, who developed it for use in their SquidBee
motes (used for creating sensor networks).
Adafruit Servo/Stepper/DC Motor shield
A shield that can control 2 hobby servos and up to 2 unipolar/bipolar stepper motors or 4 bi-directional
DC motors.
Battery Shield
A shield from Liquidware that connects to the back of the Arduino, with a USB-rechargable lithium ion
battery that can power an Arduino for 14-28 hours depending on the circuit
Liquidware TouchShield
OLED touch screen shield.
Adafruit Wave shield
Plays any size 22KHz audio files from an SD memory card for music, effects and interactive sound art
Adafruit GPS & Datalogging shield
Connects up a GPS module and can log location, time/date as well as sensor data to an SD memory
flash card.
Adafruit XPort/Ethernet shield
8
Allows use of an XPort module for connecting to the Internet as a client or server.
http://ladyada.net
http://www.liquidware.com
Adafruit Servo/Stepper/DC Motor shield
A shield that can control 2 hobby servos and up to 2
unipolar/bipolar stepper motors or 4 bi-directional
DC motors.
http://ladyada.net
10
Arduino Boards
This is the new Arduino Uno. In addition to all the features of the previous board, the Uno now uses an ATmega8U2 instead of the FTDI chip. This allows for
faster transfer rates, no drivers needed for Linux or Mac (inf file for Windows is needed), and the ability to have the Uno show up as a keyboard, mouse,
joystick, etc.
The Arduino Mega is a microcontroller board based on the ATmega2560. It has 54 digital input/output pins (of which 14 can be used as PWM outputs), 16
analog inputs, 4 UARTs (hardware serial ports), a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a reset button. It contains
everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.
The Mega is compatible with most shields designed for the Arduino Duemilanove or Diecimila. This is the new Arduino Mega 2560. In addition to all the features
of the previous board, the Mega 2560 now uses an ATmega8U2 instead of the FTDI chip. This allows for faster transfer rates, no drivers needed for Linux or
Mac (inf file for Windows is needed), and the ability to have the board show up as a keyboard, mouse, joystick, etc. It also has twice as much flash memory.
Other variaitions of arduino are Arduino pro, Arduino Mini Pro and Lilypad Arduino .
http://www.sparkfun.com/commerce/product_info.php?products_id=9950
http://www.sparkfun.com/commerce/product_info.php?products_id=9949
http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=148
http://www.sparkfun.com/commerce/product_info.php?products_id=10088
http://www.sparkfun.com/commerce/product_info.php?products_id=10033
Wall Adapter Power Supply - 9VDC 650mA/ Wall Adapter Power Supply - 12VDC 600mA
9VDC is High quality switching 'wall wart' AC to DC 9V 650mA wall power supply manufactured specifically for Spark Fun Electronics. These are switch mode
power supplies which mean the output is regulated to 9V and the capable output current is much higher (650mA!). These will power most projects that don't
require more than 650mA of current. Center-positive 5.5x2.1mm barrel connector.
Works with 100-240VAC inputs.
12VDC is a high quality AC to DC 'wall wart' which produces a regulated output of 12VDC at up to 600mA. These are switch mode power supplies which means
the output is regulated to 12V and the capable output current is much higher (600mA!). These will power most projects that don't require more than 650mA of
current. Center-positive 5.5x2.1mm barrel connector. Works with 100-240VAC inputs.
http://www.sparkfun.com/commerce/product_info.php?products_id=298
http://www.sparkfun.com/commerce/product_info.php?products_id=9442
Conductive Thread
Conductive thread is a creative way to connect various electronics onto clothing. This thread can carry current for power and signals. While not as conductive as
traces on a printed circuit board (PCB), this thread makes wearable clothing 'wearable'!
http://www.sparkfun.com/commerce/product_info.php?products_id=8544
http://www.sparkfun.com/commerce/product_info.php?products_id=8549
Protoboard
Protoboards provide a free canvass for devising soldered circuit compositions. They come in different colors and sizes.
http://www.sparkfun.com/commerce/product_info.php?products_id=8619
http://www.sparkfun.com/commerce/product_info.php?products_id=8708
http://www.sparkfun.com/commerce/product_info.php?products_id=8808
http://www.sparkfun.com/commerce/product_info.php?products_id=8814
http://www.sparkfun.com/commerce/product_info.php?products_id=8809
http://www.sparkfun.com/commerce/product_info.php?products_id=8847
http://www.sparkfun.com/commerce/product_info.php?products_id=8885
http://www.sparkfun.com/commerce/product_info.php?products_id=8887
Solderless Breadboard
To free yourself from the pain of soldering and also from the risk of ruining your components it is advisable to your breadboards. Breadboards come in different
sizes and even colors
http://www.sparkfun.com/commerce/product_info.php?products_id=9567
http://www.sparkfun.com/commerce/product_info.php?products_id=8800
http://www.sparkfun.com/commerce/product_info.php?products_id=8802
http://www.sparkfun.com/commerce/product_info.php?products_id=8803
http://www.sparkfun.com/commerce/product_info.php?products_id=137
http://www.sparkfun.com/commerce/product_info.php?products_id=7916
29
30
Arduino-Digital Output
Digital Out put is defined as sending on/off or
Aurduino board (pin
31
Arduino-Digital Output-LED
LED (Light Emitting Diode) is a light feature that can be used as an actuator of the space.
Being a Diode, an LED is a directional piece meaning that it is activated only if it is placed in the
circuit in the right direction
Ground Pin
Digital Pin
32
Arduino-Ground Pin
For electricity to flow in a circuit, we need difference in level of electricity energy. In Arduino board
this difference is provided by making a circuit between one of the output pins and ground pin.
When we send a signal through output pin any signal that is not 0 or LOW will provide the
desired difference between the two ends of the circuit and will result in electricity flow between
the digital output pin and ground pin- The level of electricity energy at Ground pin is zero, as a
result any non zero signal on the digital pin gives us a difference and an electricity flow.
You can also create this situation using two output pins, one sending the low signal and one
sending a high signal. The low signal pin in this case will function as the ground.
33
Arduino-Digital Output-LED
LEDs come in different colors and shapes.
34
Arduino-Digital Output-LED
35
Arduino-Digital Output-LED
36
Arduino-Digital Output-LED
void setup(){
pinMode(13, OUTPUT);
}
void loop(){
digitalWrite(13, HIGH);
delay(1000);
digitalWrite(13, LOW);
delay(1000);
}
37
38
39
1.
2.
3.
4.
5.
Arduino-Digital Output-LED
41
Arduino-Digital Output-LED
The Board should be connected to the computer in order to upload the program from arduino
environment to the board. Once the program is uploaded, if there is no realtime data being
communicated between the board and the program there is no need for the board to be
connected any more. Thus you can change the power to Ext(external Power) as opposed to
USB(power from USB) and use a battery or a power adaptor to power the board.
In the case of the LED exercise since after uploading there is no data being communicated
between the board and the computer, you can disconnect the piece and make it a independent
42
disconnected piece.
Arduino-Using SolderlessBreadboard
Solderless Board is useful to build prototypes, as fast as possible without going through tiresome
and time consuming process of soldering parts together to make connections
43
Arduino-Using SolderlessBreadboard
Solderless Board is useful to build prototypes, as fast as possible without going through tiresome
and time consuming process of soldering parts together to make connections
Most important thing in using a solderless breadboard in understanding its connections and
wiring underneath the white cover to be able to connect parts in a way that complete and flawless
lines are provided for electricity flow
44
Arduino-Using SolderlessBreadboard
Solderless Board is useful to build prototypes, as fast as possible without going through tiresome
and time consuming process of soldering parts together to make connections
Most important thing in using a solderless breadboard in understanding its connections and
wiring underneath the white cover to be able to connect parts in a way that complete and flawless
lines are provided for electricity flow
45
Arduino-Using SolderlessBreadboard
For example this is how an LED can be connected to an Arduino board using a solderless
breadboard.
*we are using color codes in wiring. Red wire is connected to output pin and black 46
wire is
connected to Ground
Arduino-Using SolderlessBreadboard
For example this is how an LED can be connected to an Arduino board using a solderless
breadboard. The red dotted line shows the flow of electricity from the digital output pin to LED
and then ground pin.
47
Arduino-Using SolderlessBreadboard
Using a Solderless breadboard does not make that much of sense if we are only connecting one
LED to the board with one in and one out wire connected to it. It is best suited when we want to
have multiple elements connected to one or multiple pins.
For example what if we want to control multiple LEDs from one digital output pin on Arduino
board?
48
Ground Pin
Digital Pin
In Serial connection, adding more electricity consuming elements results in weaker electricity
flow. In case of Arduino Board adding more than three High intensity LEDs will result in so weak
an electricity flow that the LEDs will not turn on
Also, in Serial connection, disconnecting any element of the connection-i.e. disconnecting one of
the LEDs will result in breaking the circuit and as a result electricity will stop flowing and the
49
whole circuit will not work anymore
Serial Connection on Solderless Board-The left diagram shows the electricity flow in the circuit.
50
Ground Pin
Digital Pin
In Parallel connection, adding more electricity consuming elements do not result in decrease of
electricity flow
Also, in Parallel connection, disconnecting any element of the connection-i.e. disconnecting one
of the LEDs will not result in breaking the circuit since each element is individually connected to
51
both digital output pin and ground pin.
52
Arduino-Analog Output-LED
Analog Out put is defined as sending signals from one of the digital pins on the Aurduino board
that range between two extremes: 0-255
Out of 13 Digital pins on Arduino board the following pins can be used to signal out Analog
output: 3,5,6,9,10,11
These are the pins with PWM label next to them on the board
53
Arduino-Analog Output-LED
For this exercise since we need to see the light variations , we are going to use a high intensity
LED. High Intensity LEDs emit more light than normal LEDs and it is easier to detect light
54
variations, using them.
Arduino-Analog Output-LED
55
Arduino-Analog Output-LED
//pin 11,10,9,6,5,3 can be used for Analog output
void setup(){
pinMode(11, OUTPUT); // Specify Arduino Pin number and output/input mode
}
void loop(){
analogWrite(11, 255); // sending Analog output 255
delay(500);
// Wait for half a second
analogWrite(11, 200); // Sending Analog output 200
delay(500);
// Wait for half a second
analogWrite(11, 150); // Sending Analog output 150
delay(500);
// Wait for half a second
analogWrite(11, 100); // Sending Analog output 100
delay(500);
// Wait for half a second
analogWrite(11, 50); // Sending Analog output 50
delay(500);
// Wait for half a second
analogWrite(11, 0); // sending analog output 0
delay(500);
// Wait for half a second
}
56
57
58
60
61
62
63
64
65
Aside from introduction of randomness, payattention to how changing the place of delay()
function can change the systems behavior. Here we put the delay function out side of the for
loop. As a result instead of seeing the change for each actuator one by one in a sequence, which
is the case in the previous exercise, here, at first all the actuators(LEDs) are configured together
66
and then the system pauses for one second to let us see the over all configuration.
67
1.
2.
3.
4.
5.
6.
68
3-Color LED
void setup(){
pinMode(13,OUTPUT);
pinMode(12,OUTPUT);
pinMode(11,OUTPUT);
pinMode(10,OUTPUT);
}
void loop(){
digitalWrite(11,LOW);
digitalWrite(13,HIGH);
digitalWrite(12,LOW);
digitalWrite(10,LOW);
delay(1000);
digitalWrite(13,LOW);
digitalWrite(12,HIGH);
digitalWrite(10,LOW);
delay(1000);
digitalWrite(13,LOW);
digitalWrite(12,LOW);
digitalWrite(10,HIGH);
delay(1000);
}
Digital
Pin13
Digital
LOW/HIGH Pin12
LOW/HIGH
Digital
Pin10
LOW/HIGH
Digital
Pin11
LOW
ArduinoDigital Output-Sound-Piezo
A Piezo is an electronic piece that converts electricity energy to sound. It is a digital output
device. You can make white noise or even exact musical notes ( frequencies for musical notes)
based on the duration that you iterate between HIGH and LOW signals.
A Piezo is a directional piece, meaning that it has a positive and negative pole. The positive pole
should be connected to the digital output pin that you allocate to control the piezo and the
70
negative pole should be connected to Ground pin
ArduinoDigital Output-Sound-Piezo
71
ArduinoDigital Output-Sound-Piezo
//connect piezo to pin 13 and ground
int freqs[] = {
1915, 1700, 1519, 1432, 1275, 1136, 1014, 956};
//string tones[] = {"do", "re", "mi", "fa","sol"," la", "si", "do"};
void setup(){
pinMode(13,OUTPUT);
}
void loop(){
for(int i=0;i<8;i++){//iterating through notes
for(int j=0;j<1000;j++){//the time span that each note is being played
digitalWrite(13,HIGH);
delayMicroseconds(freqs[i]);
digitalWrite(13,LOW);
delayMicroseconds(freqs[i]);
}
}
}
72
73
74
In the same setting if you connect an LED parallel to Piezo, you can see how the same signal
can be interpreted differently using a different output device that accept the same type of
75
signals(in this case digital signal)
ArduinoDigitalOutput-Motion-Servo Motor
Servo Motors are electronic devices that convert digital signal to rotational movement. There are
two sorts of servo motors: Standard servos that their rotation is limited to maximum of 180
degrees in each direction and Continuous Rotation Servos that can provide rotation unlimitedly
in
76
both directions
ArduinoDigitalOutput-Motion-Servo Motor
A servo motor is a motor that pulses at a certain rate moving its gear at a certain angle. It has
three connections: the black is ground, the red is connected to 5V, and the white (yellow
wire here) is set to the digital pin.
Groun
d
V5
Digital Pin
77
78
myservo.attach(9);
}
void loop()
{
myservo.attach(9);
for(pos = 0; pos < 180; pos += 1) // goes from 0 degrees to 180 degrees
{
// in steps of 1 degree
myservo.write(pos);
delay(15);
}
for(pos = 180; pos>=1; pos-=1) // goes from 180 degrees to 0 degrees
{
myservo.write(pos);
// tell servo to go to position in variable 'pos'
delay(15);
// waits 15ms for the servo to reach the position
}
myservo.detach();
delay(2000);
}
79
80
81
82
Groun
d
V5
Digital Pin
83
84
ArduinoDigital Output - Continuous RotationUpload the following code to the board and while the servo is
connected, try to adjust the pin until the servo motor is static.
Adjustment
Once the servo is adjusted to this code any pulse grater than 1500 will
result in rotation in one direction while any pulse less than 1500 will
result in rotation in the other direction
void setup()
{
pinMode(5,OUTPUT);
}
void loop()
{
for (int i = 0; i <= 200; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1500); // 1.5ms This is the frequency at which the servo motor should be static
digitalWrite(5,LOW);
delay(20); // 20ms
}
85
}
86
void setup()
{
pinMode(5,OUTPUT);
}
void loop()
{
//Rotating in One direction
for (int i = 0; i <= 200; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(20); // 20ms
}
//Stop
for (int i = 0; i <= 200; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1500);
digitalWrite(5,LOW);
delay(20); // 20ms
}
//Rotating in the other direction
for (int i = 0; i <= 200; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1200);
digitalWrite(5,LOW);
delay(20); // 20ms
}
//Stop
for (int i = 0; i <= 200; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1500);
digitalWrite(5,LOW);
delay(20); // 20ms
}
}
87
void setup()
{
pinMode(5,OUTPUT);
}
void loop()
{
//Continious Rotation
for (int i = 0; i <= 20; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(1);
}
//Rotating with delayed steps
for (int i = 0; i <= 20; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(100);
}
//More Delay
for (int i = 0; i <= 20; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(200);
}
//More Delay
for (int i = 0; i <= 20; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(400);
}
//More Delay
for (int i = 0; i <= 20; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(800);
}
//More Delay
for (int i = 0; i <= 20; i++)
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(1800);
}
}
88
void setup()
{
pinMode(5,OUTPUT);
}
void loop()
{
{
digitalWrite(5,HIGH);
delayMicroseconds(1800);
digitalWrite(5,LOW);
delay(20);
}
delay(1000);
89
90
91
93
Stepper Motor
94
Stepper Motor
95
void setup(){
pinMode(2,OUTPUT);
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
}
void loop(){
// Pause between the types that determines the speed
int stepperSpeed=200;// Change to change speed
int dir=1;// change to -1 to change direction
if (dir==1){ //Running Clockwise
digitalWrite(2,HIGH);//Step 1
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
delay(stepperSpeed);// Pause between the types that determines
digitalWrite(2,HIGH);//Step 2
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
delay(stepperSpeed);// Pause between the types that determines
digitalWrite(2,LOW);//Step 3
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
delay(stepperSpeed);// Pause between the types that determines
digitalWrite(2,LOW);//Step 4
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
delay(stepperSpeed);// Pause between the types that determines
}
if (dir==-1){ //Running CounterClockwise
digitalWrite(2,LOW);//Step 4
digitalWrite(3,HIGH);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
delay(stepperSpeed);// Pause between the types that determines
digitalWrite(2,LOW);//Step 3
digitalWrite(3,HIGH);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
delay(stepperSpeed);// Pause between the types that determines
digitalWrite(2,HIGH);//Step 2
digitalWrite(3,LOW);
digitalWrite(4,LOW);
digitalWrite(5,HIGH);
delay(stepperSpeed);// Pause between the types that determines
digitalWrite(2,HIGH);//Step1
digitalWrite(3,LOW);
digitalWrite(4,HIGH);
digitalWrite(5,LOW);
delay(stepperSpeed);// Pause between the types that determines
}
}
the speed
the speed
the speed
the speed
the speed
the speed
the speed
96
Vibration Motor
: A vibration motor! This itty-bitty, shaftless vibratory motor is perfect for non-audible indicators. Use in any number of applications to indicate to the wearer when
a status has changed. All moving parts are protected within the housing. With a 2-3.6V operating range, these units shake crazily at 3V. Once anchored to a
PCB or within a pocket, the unit vibrates softly but noticeably. This high quality unit comes with a 3M adhesive backing and reinforced connection wires.
http://www.sparkfun.com/products/8449
http://www.sparkfun.com/products/8751
http://www.musclewires.com/Products.php
http://www.robotshop.com/
Flexible Heater
They come in various shapes and sizes and powers. They are able to regulate temperature.
http://www.omega.com/
iklimnet.com
Honeywell.com
jelpc-pneumatic.com
MarineDepot.com
Sparkfun.com
http://www.jameco.com/
www.ledsupply.com/
http://www.oznium.com/led-strip-flat-head
External Power
3v-220v
GRD
Control Pin
104