Anda di halaman 1dari 39

USER MANUAL FOR QUICK LEARNING KIT

FOR ARDUINO

---------------------------------------------------------------------------------------------------------------------
Note: This tutorial is for novice user. It shows how to work on Arduino UNO board and explain
the working on open source Arduino software. Please refer to the documentation procedure
described here as followed. To work with this its mandatory that user already has an Arduino
UNO board.

---------------------------------------------------------------------------------------------------------------------

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 1


Table of Contents
1. Introduction to Arduino UNO Board .............................................................................3
1.1. Overview............................................................................................................................3
1.2. Why use Arduino? .............................................................................................................3
1.3. What can we do with Arduino? .........................................................................................4
2. Introduction to UNO board ................................................................................................5
2.2. Arduino UNO board- .........................................................................................................6
2.3. Arduino UNO board component description-....................................................................7
2.4. Pin Diagram of ATMEGA 328 ..........................................................................................8
3.1. Introduction to Arduino Programming ............................................................................11
3.2 Compilation of your first program ...................................................................................12
3.3. Uploading Program on Arduino Board ............................................................................13

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 2


1. Introduction to Arduino UNO Board

1.1. Overview
Arduino is a tool for making computers that can sense and control more of the physical
world than your desktop computer. It's an open-source physical computing platform
based on a simple microcontroller board, and a development environment for writing
software for the board.
It has a Separate Software Development Environment, which is also an integrated
development environment (IDE). Arduino is an open source means you are free to
modify the hardware or software of the Arduino boards according to the requirements.
For software, you can add AVR-C library and start writing code as in AVR studio.
Arduino consist of digital and analog I/O pins that can be interfaced to various extension
boards and other circuits. The boards feature serial communications interfaces, including
USB on some models, for loading programs from personal computers. The Arduino IDE
uses a simplified version of C++, making it easier to learn to program. Finally, Arduino
provides a standard form factor that breaks out the functions of the micro-controller into a
more accessible package. Arduino can interact with buttons, LEDs, motors, speakers,
GPS units, cameras, the internet, and even your smart-phone or your TV.

1.2. Why use Arduino?


There are many other microcontrollers and microcontroller platforms available for
physical computing. BX-24, Phidgets, MIT's Handyboard, and many others offer similar
functionality.
All of these tools take the messy details of microcontroller programming and wrap it up
in an easy-to-use package.
Arduino also simplifies the process of working with microcontrollers, but it offers
some advantage for teachers, students, and interested amateurs over other systems:
Inexpensive - Arduino boards are relatively inexpensive compared to other
microcontroller platforms. The least expensive version of the Arduino module can be
assembled by hand, and even the pre-assembled.
Cross-platform - The Arduino software runs on Windows, Macintosh OSX, and
Linux operating systems. Most microcontroller systems are limited to Windows.
Simple, clear programming environment - The Arduino programming environment
is easy-to-use for beginners, yet flexible enough for advanced users to take advantage
of as well.
Open source and extensible software - The Arduino is based on Atmel's AVR

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 3


series. The Arduino software is an open source tools, available for extension by
experienced programmers. The language can be expanded through C++ libraries.

1.3. What can we do with Arduino?


Arduino is a great tool for developing interactive objects, taking inputs from a variety
of switches or sensors and controlling a variety of lights, motors and other outputs.
Arduino projects can be stand-alone or they can be connected to a computer using USB.

The Arduino will be seen by the computer as a standard serial interface. There is serial
communication APIs on most programming languages so interfacing Arduino with a
software program running on the computer should be pretty straight forward. The
Arduino board is a microcontroller board, which is a small circuit that contains a whole
computer on a small chip (the microcontroller).

There are different versions of the Arduino board.

Arduino can be used to develop interactive objects, taking inputs from a variety of
switches or sensors, and controlling a variety of lights, motors, and other physical
outputs. Arduino projects can be stand-alone, or they can communicate with software
running on your computer (e.g. Flash, Processing, MaxMSP).

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 4


2. Introduction to UNO board

The Arduino Uno is a microcontroller board based on the ATmega328. It has 14


digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, 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 Uno differs from all preceding boards in that it
does not use the FTDI USB-to-serial driver chip. Instead, it features the Atmega8U2
programmed as a USB-to-serial converter. "Uno" means one in Italian and is named to
mark the upcoming release of Arduino 1.0. The Uno and version 1.0 will be the
reference versions of Arduino, moving forward. The Uno is the latest in a series of
USB Arduino Board.

2.1. Component list of Arduino UNO board-


* 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
* Flash Memory 32 KB of which 0.5 KB used by bootloader.
* SRAM 2 KB
*EEPROM 1 KB
*Clock Speed 16 MHz

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 5


2.2. Arduino UNO board-

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 6


2.3. Arduino UNO board component description-

Power- The Arduino Uno can be powered via the USB connection or with
an external power supply. The power source is selected automatically. The adapter
External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or
battery can be connected by plugging a 2.1mm centre-positive plug into the board's
power jack. Leads from a battery can be inserted in the Gnd and VIN pin headers of
the POWER connector. The board can operate on an external supply of 6 to 20 volts. If
supplied with less than 7V, however, the 5V pin may supply less than five volts and
the board may be unstable. If using more than 12V, the voltage regulator may overheat
and damage the board. The recommended range is 7 to 12 volts.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 7


The power pins are follows-

Vin- The input voltage to the Arduino board when it's using an external power source
(as opposed to 5 volts from the USB connection or other regulated power source). You
can supply voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.

5v- The regulated power supply used to power the microcontroller and other
components on the board. This can come either from VIN via an on-board regulator, or
be supplied by USB or another regulated 5V supply.

3V3- A 3.3 volt supply generated by the on-board regulator. Maximum current draw is
50 mA.

GND- Ground pins.

2.4. Pin Diagram of ATMEGA 328-

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 8


Memory- The Atmega328 has 32 KB of flash memory for storing code (of which
0,5 KB is used for the bootloader); It has also 2 KB of SRAM and 1 KB of EEPROM
(which can be read and written with the EEPROM library).

Input and output- Each of the 14 digital pins on the Uno can be used as an input
or output, using pinMode(), digitalWrite() and digitalRead() functions They operate at
5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal
pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some
pins have specialized functions:

Serial: 0 (RX) and 1 (TX)- Used to receive (RX) and transmit (TX) TTL
serial data. These pins are connected to the corresponding pins of the ATmega8U2
USB-to-TTL Serial chip

External Interrupts: 2 and 3- These pins can be configured to trigger an


interrupt on a low value, a rising or falling edge, or a change in value. See the
attachInterrupt() function for details.

PWM: 3, 5, 6, 9, 10, and 11- Provide 8-bit PWM output with the
analogWrite() function.

SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK).- pins support


SPI communication, which although provided by the underlying hardware, is not
currently included in the Arduino language.

LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the LED is on, when the pin is LOW, it's off.

Analog i/o port: The Uno has 6 analog inputs, each of which provide 10
bits of resolution (i.e. 1024 different values). By default they measure from
ground to 5 volts, though is it possible to change the upper end of their range
using the AREF pin and the analogReference ()function. Additionally, some
pins have specialized functionality.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 9


I2C: 4 (SDA) and 5 (SCL): Support I2C C (TWI) communication using the
Wire library.

AREF: Reference voltage for the analog inputs. Used with analogReference ()
.
Reset- Bring this line LOW to reset the microcontroller. Typically used to
add a reset button to shields which block the one on the board.

Communication-The Arduino Uno has a number of facilities for communicating


with a computer, another Arduino, or other microcontrollers. The ATmega328 provides
UART TTL (5V) serial communication, which is available on microcontroller. The
ATmega328 provides UART TTL (5V) serial communication, which is available on
digital pins 0 (RX) and 1 (TX). An ATmega8U2 on the board channels this serial
communication over USB and appears as a virtual com port to software on the computer.
The '8U2 firmware uses the standard USB COM drivers, and no external driver is needed.
However, on Windows, an *.inf file is required.

The Arduino software includes a serial monitor which allows simple textual data to be
sent to and from the Arduino board. The RX and TX LEDs on the board will flash when
data is being transmitted via the USB-to- serial chip and USB connection to the computer
(but not for serial communication on pins 0 and 1). A software serial library allows for
serial communication on any of the Uno's digital pins. The ATmega328 also support I2C
(TWI) and SPI communication. The Arduino software includes a Wire library to
simplify use of the I2C bus. To use the SPI communication please sees the ATmega328
datasheet.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 10


3.1. Introduction to Arduino Programming
Writing your first program
/***************************your first ARDUINO Project**************************/

Void setup()

// Initialize the PORTs, Variables, etc here

Void loop()

// Write your code that gets continuously executed

/***********end of the program*************/

Write down the above code to your Arduino Text Editor. See Screen shot of the same
below.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 11


3.2 Compilation of your first program
Press Verify button in tool bar to Compile your project and then press upload button to
dump the code in the microcontroller as shown in diagram.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 12


3.3. Uploading Program on Arduino Board

Step 1: Connect one end of your USB Cable with Computers USB Port and connect
other end with the Arduino board.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 13


Step 2: - Click on to the button Serial Port which is shown in drop down menu.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 14


Step 3: Browse your Board to be used. Here we are using Arduino UNO BOARD.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 15


Step 4: - Finally click on to the Upload button to burn the sketch file in the Arduino
Board.

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 16


EXPERIMENT-1
AIM
Led Blinking using Arduino UNO.

ARDUINO PROGRAM
Program for led blinking using Arduino Uno.

// Pin 13 has an LED connected on most Arduino boards.


// give it a name:
int led = 13;

// the setup routine runs once when you press reset:


void setup()
{
// initialize the digital pin as an output.
pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:


void loop()
{
digitalWrite(led, HIGH); // turn the LED on
delay(1000); // wait for a second
digitalWrite(led, LOW); // turn the LED off
delay(1000); // wait for a second
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 17


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 18


EXPERIMENT-2
AIM
Led control using tactile switch.

ARDUINO PROGRAM
Program for Led control using tactile switch.

const int K0 = A2;


const int K1 = A3;
const int K2 = A4;
const int K3 = A5;

const int L0 = 13;


const int L1 = 12;
const int L2 = 11;
const int L3 = 10;

int K0State = 0;
int K1State = 0;
int K2State = 0;
int K3State = 0;

void setup()
{
pinMode(K0, INPUT);
pinMode(K1, INPUT);
pinMode(K2, INPUT);
pinMode(K3, INPUT);

pinMode(L0, OUTPUT);
pinMode(L1, OUTPUT);
pinMode(L2, OUTPUT);
pinMode(L3, OUTPUT);
}

void loop()
{
ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 19
K0State = digitalRead(K0);
K1State = digitalRead(K1);
K2State = digitalRead(K2);
K3State = digitalRead(K3);

if (K0State == HIGH)
{
digitalWrite(L0, HIGH);
}

if (K1State == HIGH)
{
digitalWrite(L1, HIGH);
}

if (K2State == HIGH)
{
digitalWrite(L2, HIGH);
}

if (K3State == HIGH)
{
digitalWrite(L3, HIGH);
}

else
PORTB=0b00000000;
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 20


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 21


EXPERIMENT-3
AIM
Control six LEDs by digital output pins.

ARDUINO PROGRAM
Program for controlling six leds by digital output pins.

const int led1=10;


const int led2=11;
const int led3=12;
const int led4=13;

void setup()
{
// put your setup code here, to run once:
pinMode(led1,OUTPUT);
pinMode(led2,OUTPUT);
pinMode(led3,OUTPUT);
pinMode(led4,OUTPUT);

void loop()
{
// put your main code here, to run repeatedly:
digitalWrite(led1,HIGH);
digitalWrite(led2,LOW);
digitalWrite(led3,HIGH);
digitalWrite(led4,LOW);
delay(200);
digitalWrite(led1,LOW);
digitalWrite(led2,HIGH);
digitalWrite(led3,LOW);
digitalWrite(led4,HIGH);
delay(200);
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 22


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 23


EXPERIMENT-4
AIM
Traffic light control using Arduino uno.

ARDUINO PROGRAM
Program for controlling six leds by digital output pins.

int carRed = 12; //car lights being assigned


int carYellow = 11;
int carGreen = 10;
int pedRed = 9; //ped lights being assigned
int pedGreen = 8;
int button = 2; // button pin
int crossTime = 5000; //crossing time given to pedestrians
unsigned long changeTime ;

void setup ()
{
pinMode(carRed, OUTPUT);
pinMode(carYellow, OUTPUT);
pinMode(carGreen, OUTPUT);
pinMode(pedRed, OUTPUT);
pinMode(pedGreen, OUTPUT);
pinMode(button, INPUT);

digitalWrite(carGreen,HIGH); //start with green car light on


digitalWrite(pedRed, HIGH); //start with red ped light on
}

void loop()
{
/* check if button is pressed
and it is over 5 sec since last button press*/
int state = digitalRead(button);
if(state==HIGH && (millis() - changeTime) > 5000)
{
changeLights(); //function to change lights
}
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 24


void changeLights()
{
digitalWrite(carGreen,LOW); //green car light off
digitalWrite(carYellow,HIGH); // yellow car light on
delay(2000); //wait 2 seconds

digitalWrite(carYellow,LOW); // yellow car light off


digitalWrite(carRed,HIGH); //red car light on
delay(1000); //wait 1 second to turn on ped
light

digitalWrite(pedRed,LOW); //red ped light off


digitalWrite(pedGreen,HIGH); //green ped light on. allow
crossing
delay(crossTime); //delay preset time of 5 seconds
//flashing of ped green light
for (int x=0; x<10; x++)
{
digitalWrite(pedGreen,HIGH);
delay(250);
digitalWrite(pedGreen,LOW);
delay(250);
}

digitalWrite(pedRed, HIGH); //turn red ped light on


delay(100);

digitalWrite(carGreen,HIGH); //car green light on


digitalWrite(carRed,LOW); //car red light off

changeTime = millis(); //record time since last lights change

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 25


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 26


EXPERIMENT-5
AIM
Potentiometer to control the LED on PWM pin.

ARDUINO PROGRAM
Program for potentiometer to control the LED on PWM pin.

int inputPin = A0; // set input pin for the potentiometer


int inputValue = 0; // potentiometer input variable
int ledPin = 11; // set output pin for the LED

void setup()
{
// declare the ledPin as an OUTPUT:
pinMode(ledPin, OUTPUT);
}

void loop()
{
// read the value from the potentiometer:
inputValue = analogRead(inputPin);

// send the square wave signal to the LED:


analogWrite(ledPin, inputValue/4);
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 27


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 28


EXPERIMENT-6
AIM
Potentiometer to control the servo motor.

ARDUINO PROGRAM

// Controlling a servo position using a potentiometer


(variable resistor)
#include <Servo.h>
Servo myservo; // create servo object to control a servo

int potpin = 1; // analog pin used to connect the


potentiometer
int val; // variable to read the value from the analog
pin

void setup()
{
myservo.attach(5); // attaches the servo on pin 5 to the
servo object
Serial.begin(19200); // some servos doesn't work without
Serial
}

void loop()
{
val = analogRead(potpin); // reads the value
of the potentiometer (value between 0 and 1023)
val = map(val, 0, 1023, 0, 179); // scale it to use
it with the servo (value between 0 and 180)
myservo.write(val); // sets the servo
position according to the scaled value
delay(15); // waits for the

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 29


servo to get there
}

CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 30


EXPERIMENT-7
AIM
Potentiometer to control RGB led.

ARDUINO PROGRAM

Program for potentiometer to control RGB led.

int redPin = 11;


int greenPin = 10;
int bluePin = 9;

int redPotPin = 1;
int greenPotPin = 2;
int bluePotPin = 3;

int delayLength = 1250;

#define COMMON_ANODE

void setup()
{
Serial.begin(9600);
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
}

void loop()
{
int redVal = analogRead(redPotPin) / 4;
int greenVal = analogRead(greenPotPin) / 4;
int blueVal = analogRead(bluePotPin) / 4;

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 31


setColor(redVal, greenVal, blueVal);
delay(100);
}

void setColor(int red, int green, int blue)


{
#ifdef COMMON_ANODE
red = 255 - red;
green = 255 - green;
blue = 255 - blue;
#endif

analogWrite(redPin, red);
analogWrite(greenPin, green);
analogWrite(bluePin, blue);
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 32


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 33


EXPERIMENT-8
AIM
16 x 2 lcd interfacing with Arduino uno.

ARDUINO PROGRAM

Program for 16 x 2 lcd interfacing for Arduino uno.

#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface


pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("hello, world!");
}

void loop()
{
// set the cursor to column 0, line 1
// (note: line 1 is the second row, since counting begins
with 0):
lcd.setCursor(0, 1);
// print the number of seconds since reset:
lcd.print(millis() / 1000);
}

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 34


CIRCUIT DIAGRAM

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 35


ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 36
For any Query???

Technical : +91-8744000666
Other Queries: +91-8744000555

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 37


ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 38
Thanks for purchasing Arduino UNO
board from

ROBOMART ARDUINO QUICK LEARNING KIT MANUAL Page 39

Anda mungkin juga menyukai