KEMBAR78
Introduction to arduino | PDF
University of Duhok
College of Science
CS Department
Arduino. What is Arduino?
Arduino is an open-source platform used for building
electronics projects.
Arduino consists of
• microcontroller : physical programmable circuit board
• software: IDE (Integrated Development Environment)
that runs on your computer, used to write and upload
computer code to the physical board.
The Arduino platform has become quite popular with people just
starting out with electronics, and for good reason. Unlike most
previous programmable circuit boards, the Arduino does not need a
separate piece of hardware (called a programmer) in order to load
new code onto the board – you can simply use a USB cable.
Additionally, 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.
It is an open source hardware, any one can get the details of its
design and modify it or make his own one himself.
Arduino boards:
UNO Mega LilyPad
Arduino BT Arduino Nano Arduino Mini
Arduino UNO:
Digital output
~: PWM.
0,1: Serial port.
In circuit Serial
programming
Atmel
Microcontroller
Analog input.
Power Supply
USB port
Power input
TX RX LEDs
Power LED
Reset Button
There are many varieties of Arduino boards that can be
used for different purposes:
 Power LED Indicator
There’s a tiny LED next to the word ‘ON’ This LED should light up
whenever you plug your Arduino into a power source. If this light
doesn’t turn on, there’s a good chance something is wrong. Time to
re-check your circuit!
Power (USB / Barrel Jack)
Every Arduino board needs a way to be connected to a power source.
The Arduino UNO can be powered from a USB cable coming from
your computer or a wall power supply that is terminated in a barrel
jack. The USB connection also used to load code onto your Arduino
board.
What's on the Arduino board?.
Cont..
 Reset Button
The Arduino has a reset button . Pushing it will temporarily connect
the reset pin to ground and restart any code that is loaded on the
Arduino. This can be very useful if your code doesn’t repeat, but you
want to test it multiple times.
 TX RX LEDs
TX is short for transmit, RX is short for receive. These LEDs will give
us some nice visual indications whenever our Arduino is receiving or
transmitting data (like when we’re loading a new program onto the
board).
Cont..
 Main IC
The black thing with all the metal legs is an IC, or Integrated Circuit .
Think of it as the brains of our Arduino. The main IC on the Arduino
is slightly different from board type to board type, but is usually from
the ATmega line of IC’s from the ATMEL company.
 Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF)
The pins on your Arduino are the places where you connect wires to
construct a circuit (probably in conjuction with a breadboard and
some wire. They usually have black plastic ‘headers’ that allow you
to just plug a wire right into the board. The Arduino has several
different kinds of pins, each of which is labeled on the board and
used for different functions.
Cont..
• GND : Short for ‘Ground’. There are several GND pins on the Arduino, any
of which can be used to ground your circuit.
• 5V & 3.3V : the 5V pin supplies 5 volts of power, and the 3.3V pin supplies
3.3 volts of power.
• Analog : The area of pins under the ‘Analog In’ label (A0 through A5 on the
UNO) are Analog In pins. These pins can read the signal from an analog
sensor (like a temperature sensor) and convert it into a digital value that we
can read.
• Digital : Across from the analog pins are the digital pins (0 through 13 on
the UNO). These pins can be used for both digital input (like telling if a
button is pushed) and digital output (like powering an LED).
• PWM : You may have noticed the tilde (~) next to some of the digital pins (3,
5, 6, 9, 10, and 11 on the UNO). These pins act as normal digital pins, but
can also be used for something called Pulse-Width Modulation (PWM). but
for now, think of these pins as being able to simulate analog output (like
fading an LED in and out).
• AREF : Stands for Analog Reference. Most of the time you can leave this
pin alone. It is sometimes used to set an external reference voltage
(between 0 and 5 Volts) as the upper limit for the analog input pins.
You can download the Arduino IDE
(The program used to write code and
uploading it to arduino boards) from:
http://arduino.cc/en/Main/Software
Arduino IDE:
Arduino IDE:
Arduino IDE:
Arduino IDE:
• Verify: Checks your code for errors.
• Upload: Compiles your code and uploads it to the Arduino
board.
• New: Creates a new sketch.
• Open: Presents a menu of all the sketches in your sketchbook.
Clicking one will open it within the current window.
• Save: Saves your sketch.
• Serial Monitor: used to receive serial data from the board and
send the serial data to the board.
Arduino IDE:
From an idea to a final project, we usually follow the following steps:
ArduinoLanguage The basic sketch (program) has two required functions:
1- void setup ( )
{
statements;
}
2- void loop ( )
{
statements;
}
 The setup function is for preparation or initialization
and the loop function is for execution.
 The setup function runs once when you power the
board or press reset button. The loop function runs
over and over again forever.
 In Arduino: Variables, functions, comments, control/loop
statements, arithmetic/comparison/logical operators, and
anything related are same as in C/C++.
 Arduino language reference is in the link below:
http://www.arduino.cc/en/Reference/HomePage
Thank You 

Introduction to arduino

  • 1.
    University of Duhok Collegeof Science CS Department
  • 2.
    Arduino. What isArduino? Arduino is an open-source platform used for building electronics projects. Arduino consists of • microcontroller : physical programmable circuit board • software: IDE (Integrated Development Environment) that runs on your computer, used to write and upload computer code to the physical board.
  • 3.
    The Arduino platformhas become quite popular with people just starting out with electronics, and for good reason. Unlike most previous programmable circuit boards, the Arduino does not need a separate piece of hardware (called a programmer) in order to load new code onto the board – you can simply use a USB cable. Additionally, 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. It is an open source hardware, any one can get the details of its design and modify it or make his own one himself.
  • 4.
    Arduino boards: UNO MegaLilyPad Arduino BT Arduino Nano Arduino Mini
  • 5.
    Arduino UNO: Digital output ~:PWM. 0,1: Serial port. In circuit Serial programming Atmel Microcontroller Analog input. Power Supply USB port Power input TX RX LEDs Power LED Reset Button
  • 6.
    There are manyvarieties of Arduino boards that can be used for different purposes:  Power LED Indicator There’s a tiny LED next to the word ‘ON’ This LED should light up whenever you plug your Arduino into a power source. If this light doesn’t turn on, there’s a good chance something is wrong. Time to re-check your circuit! Power (USB / Barrel Jack) Every Arduino board needs a way to be connected to a power source. The Arduino UNO can be powered from a USB cable coming from your computer or a wall power supply that is terminated in a barrel jack. The USB connection also used to load code onto your Arduino board. What's on the Arduino board?.
  • 7.
    Cont..  Reset Button TheArduino has a reset button . Pushing it will temporarily connect the reset pin to ground and restart any code that is loaded on the Arduino. This can be very useful if your code doesn’t repeat, but you want to test it multiple times.  TX RX LEDs TX is short for transmit, RX is short for receive. These LEDs will give us some nice visual indications whenever our Arduino is receiving or transmitting data (like when we’re loading a new program onto the board).
  • 8.
    Cont..  Main IC Theblack thing with all the metal legs is an IC, or Integrated Circuit . Think of it as the brains of our Arduino. The main IC on the Arduino is slightly different from board type to board type, but is usually from the ATmega line of IC’s from the ATMEL company.  Pins (5V, 3.3V, GND, Analog, Digital, PWM, AREF) The pins on your Arduino are the places where you connect wires to construct a circuit (probably in conjuction with a breadboard and some wire. They usually have black plastic ‘headers’ that allow you to just plug a wire right into the board. The Arduino has several different kinds of pins, each of which is labeled on the board and used for different functions.
  • 9.
    Cont.. • GND :Short for ‘Ground’. There are several GND pins on the Arduino, any of which can be used to ground your circuit. • 5V & 3.3V : the 5V pin supplies 5 volts of power, and the 3.3V pin supplies 3.3 volts of power. • Analog : The area of pins under the ‘Analog In’ label (A0 through A5 on the UNO) are Analog In pins. These pins can read the signal from an analog sensor (like a temperature sensor) and convert it into a digital value that we can read. • Digital : Across from the analog pins are the digital pins (0 through 13 on the UNO). These pins can be used for both digital input (like telling if a button is pushed) and digital output (like powering an LED). • PWM : You may have noticed the tilde (~) next to some of the digital pins (3, 5, 6, 9, 10, and 11 on the UNO). These pins act as normal digital pins, but can also be used for something called Pulse-Width Modulation (PWM). but for now, think of these pins as being able to simulate analog output (like fading an LED in and out). • AREF : Stands for Analog Reference. Most of the time you can leave this pin alone. It is sometimes used to set an external reference voltage (between 0 and 5 Volts) as the upper limit for the analog input pins.
  • 10.
    You can downloadthe Arduino IDE (The program used to write code and uploading it to arduino boards) from: http://arduino.cc/en/Main/Software Arduino IDE:
  • 11.
  • 12.
  • 13.
    Arduino IDE: • Verify:Checks your code for errors. • Upload: Compiles your code and uploads it to the Arduino board. • New: Creates a new sketch. • Open: Presents a menu of all the sketches in your sketchbook. Clicking one will open it within the current window. • Save: Saves your sketch. • Serial Monitor: used to receive serial data from the board and send the serial data to the board.
  • 14.
    Arduino IDE: From anidea to a final project, we usually follow the following steps:
  • 15.
    ArduinoLanguage The basicsketch (program) has two required functions: 1- void setup ( ) { statements; } 2- void loop ( ) { statements; }
  • 16.
     The setupfunction is for preparation or initialization and the loop function is for execution.  The setup function runs once when you power the board or press reset button. The loop function runs over and over again forever.  In Arduino: Variables, functions, comments, control/loop statements, arithmetic/comparison/logical operators, and anything related are same as in C/C++.  Arduino language reference is in the link below: http://www.arduino.cc/en/Reference/HomePage
  • 17.