INTRODUCTION TO ARDUINO
What is Arduino?
ARDUINO is an open-source platform used for building electronics projects
which consists of both a physical programmable circuit board and an IDE
(Integrated Development Environment) that runs on your computer.
Arduino Uno Anatomy
Arduino Uno Technical Specifications
Arduino Uno is a microcontroller board based on the ATmega328P. It has six
analog inputs, a 16 MHz quartz crystal, a power jack, a USB connection, an
ICSP header, 14 digital input/output pins of which 6 of them can be used as
PWM outputs, and a reset button.
Pin Descriptions
Pin Pin
Details
Category Name
Vin: Input voltage to Arduino when using an external power
Vin;
source. 5V: Regulated power supply used to power
3.3V,
Power microcontroller and other components on the board. 3.3V:
5V,
3.3V supply generated by on-board voltage regulator.
GND
Maximum current draw is 50mA. GND: Ground pins.
Reset Reset Resets the microcontroller.
Analog
A0 – A5 Used to provide analog input in the range of 0-5V.
Pins
Input/ Digital
Output Pins 0 - Can be used as input or output pins.
Pins 13
0(Rx),
Serial Used to receive and transmit TTL serial data.
1(Tx)
External
2, 3 To trigger an interrupt.
Interrupts
3, 5, 6,
PWM Provides 8-bit PWM output.
9, 11
10
(SS),
11
(MOSI),
SPI Used for SPI communication.
12
(MISO)
and 13
(SCK)
Inbuilt
13 To turn on the inbuilt LED.
LED
TWI A4 Used for TWI communication.
Pin Pin
Details
Category Name
(SDA),
A5
(SCA)
AREF AREF To provide reference voltage for input voltage.
Why Arduino?
To provide an inexpensive and easy way for hobbyists, students, and
professionals to create devices that interact with their environment using
sensors and actuators.
When and Why Arduino?
Arduino was introduced way back in 2005.
To provide an inexpensive and easy way for hobbyists, students, and
professionals to create devices that interact with their environment
using sensors and actuators.
Common examples for beginner hobbyists include simple robots,
thermostats, and motion detectors.
The Founders
David Cuartielles
Gianluca Martino
Tom Igoe
David Mellis
Massimo Banzi
Arduino Flavors
Arduino Basic Requirements
Skillsets: C Programming, PC Literate, and a little knowledge on
electronics.
Basic Requirements:
o Have a java installed in your System
o Extract Arduino Package
o Install your Arduino Driver
Setting up ARDUINO IDE
How to Download the Arduino IDE
The Arduino Software (IDE) makes it easy to create codes and upload it to
the board. It runs on Windows, Linux and Mac OS X. The environment is
written in Java and based on Processing and other open-source software. To
download the Arduino IDE, go to this link:
[Link]
Installation
Choose what best suits on whatever you are working with.
When the download finishes, proceed with the installation. Here's a
step-by-step procedure provided by this link:
[Link]
You choose the components to install.
"Check the components you want to install and uncheck the
components you don't want to install. Click Next to continue."
Components: Install Arduino software, Install USB driver, Create Start
Menu shortcut, Create Desktop shortcut, Associate .ino files.
"Setup will install Arduino in the following folder..."
Structure of C Programming
Learning C Programming:
To learn Arduino, we will first target one of the major skills required: C
Programming. To learn this, we will first use a generic compiler for C
programming.
A "Normal" C Code Example:
#include <stdio.h>
int main()
{
/* My first program */
printf("Hello, World! \n");
return 0;0
}
Breakdown of Normal C Structure:
Preprocessor (#include <stdio.h>): These commands tell the
compiler to do preprocessing before doing actual compilation.
Function (int main ()): The main building blocks of any C Program.
Every C Program will have one or more functions, and there is one
mandatory function which is called main() function.
Expressions/Statements: Combine variables and constants to create
new values. Statements are expressions, assignments, function calls,
or control flow statements which make up C programs.
return 0;: Return of the function.
Arduino C Structure
The "Blink" Example:
Why is this different?
o This is still C code, but the standard format of an Arduino code.
o Other parts are removed simply because Arduino makers made
sure that Arduino will be a friendly, healthy environment for
beginners.
3. The "Hard" Way (If not made simple)
What would the code look like if Arduino makers didn't make it
simple? If not made simple, this is how your code would look just for
declaring your ports (using #define to map pins to hexadecimal
memory addresses like 0x0001, 0x0002, etc.).