What is Arduino ? - Arduino Programming - Arduino Tutorial



Arduino Introduction

  • Arduino is a software platform, project and open-source hardware which is used to design and build electronic devices.
  • It manufactures and designs microcontroller kits and single-board interfaces for building electronics projects.
  • The Arduino boards was initially created to help the students with the non-technical background.
  • The Arduino board consists of sets of analog and digital I/O (Input / Output) pins, which are further interfaced to expansion boards, breadboard and other circuits.
  • Boards such as feature the model, serial communication interfaces, Universal Serial Bus, which are used for loading programs from the computers.
  • Arduino provides an Integrated Development Environment (IDE) project, which is based on the Processing Language to upload the code to the physical board.
  • The projects are authorized under the GNU General Public License and GNU Lesser General Public License.
  • It allows the use of Arduino boards; it can be manufactured and software distribution by anyone.

Various purposes for Arduino

Various purposes for Arduino

Various Purposes for Arduino

What is Arduino ?

  • Arduino is a hardware as well as software platform that helps in making electronic projects.
  • It is an open-source platform and has a variety of microprocessors and controllers then there are various types of Arduino boards used for various purposes.
  • It is a circuit board, which consists of different parts or interfaces.
  • The board consists of the set of analog and digital pins that are used to connect various components and devices, which we want to use for the functioning of the electronic devices.
  • In Arduino analog pins are mostly useful for fine-grained control and here most of the Arduino consists of 14 digital I/O pins.
  • In Arduino boards the other devices are microcontroller, voltage regulator, USB port, power connector, etc.

Features of Arduino

Features of Arduino

  • Arduino programming is a simple version of C++, which makes easy to learn.
  • The Arduino IDE is used to control the functions of boards and further sends the set of specifications to the microcontroller.
  • Arduino does not need an extra piece or board to load new code and it can read digital and analog input signals.
  • It is easy to implement and use on hardware and software platform.

Microcontroller

Microcontroller

  • It is a small and low power computer and most of the microcontroller have a Random Access Memory (RAM), Central Processing Unit (CPU), then memory storage like other computer systems.
  • Microcontroller has very small memory of 2KB which is two Kilobytes and It is a single chip that includes memory, processor and Input/Output (I/O) peripherals.
  • Some microcontrollers are capable of running only one program at a time, due to loss memory.
  • The General-Purpose Input Output (GPIO) pins present on the chip help us to control another circuitry or electronic from the program.

Electronic devices around Us

  • Here, we have many electronic devices around us.
MicroController
  • In microwave oven microcontroller accepts the user input and controls the magnet run that generate microwave rays to cook the food and displays the output timer.
MicroController
  • In modern cars also contain dozens of microcontrollers working in tandem like one after another to control functions like radio interface, lighting, etc.

Arduino kit

 Arduino Kit

Arduino Kit

Arduino Boards

  • There are variety of Arduino board used for different purposes and it varies in I/O pins, size, etc.
  • In Arduino boards there are various components they are Digital Input/Output pins, Microcontroller, USB Connector and interface, Reset Button, Voltage Regulator, LED's, Power button and Crystal Oscillator.
  • The popular Arduino boards are
    • Arduino UNO
    • Arduino Nano
    • Arduino Mega
    • Arduino Duemilanove
    • Arduino Bluetooth

Arduino UNO

 Arduino Uno

Arduino Uno

  • Arduino UNO is a standard board of Arduino here UNO means 'one' in Italian.
  • It was named as UNO to label the first release of Arduino Software and it was also the first USB board released by Arduino.
  • Arduino UNO board was developed by Arduino.cc and in various projects it is considered as the powerful board.
  • Arduino UNO is based on an ATmega328P microcontroller and compared to other boards it is easy to use, such as the Arduino Mega board, etc.
  • This board consists of analog and digital Input/Output pins (I/O), shields, and other circuits.
  • The Arduino UNO includes 14 digital pins, 6 analog pin inputs, USB connector, power jack, In Circuit Serial Programming (ICSP) header.
  • It is programmed based on Integrated Development Environment (IDE) and it can run on both offline and online platforms.

Arduino Nano

 Arduino Nano

Arduino Nano

  • Arduino Nano is a small Arduino board which is based on ATmega328P or ATmega628 Microcontroller and it is same as Arduino UNO board.
  • It is defined as a consistent, sustainable small and flexible microcontroller board.
  • Using Arduino IDE, it is organized, which can run on various platforms and here IDE stands for Integrated Development Environment.
  • Using Arduino Nano board are Arduino IDE and mini-USB devices required to start our projects.
  • The Arduino IDE software must be installed on our respected desktop or laptop and mini-USB transfers the code from the computer to the Arduino Nano board.
  • The Arduino Nano is used to produce a clock of a precise frequency, using constant voltage.

Arduino Mega

 Arduino Mega

Arduino Mega Board

  • Arduino Mega board is based on ATmega2560 Microcontroller and it is an 8-bit microcontroller.
  • We need a simple USB cable to connect to the computer and battery or AC to DC adapter to get started with it.
  • Using Arduino IDE Arduino Mega is organized, which can run on various platforms.
  • Compare to other Arduino boards, the functioning of Arduino Mega is similar and we need not require extra components for its working.
  • It gives the advantage of working with more memory space over other boards.
  • It can help us to work with the number of sensors at a time, which has higher processing power.

Arduino Duemilanove

 Arduino Duemilanove

Arduino Duemilanove

  • Arduino Due is the first Arduino board that is developed based on the ARM Microcontroller and it is based on the 32- bit ARM core.
  • It has two parts, which are named as Native Programming port and USB port and it consists of 54 Digital Input/Output pins and 12 Analog pins.
  • Using Arduino IDE, Arduino Due is also organized which can run on various platforms.
  • The Arduino Due board consists of Reset button, Native USB port, Programming USB port, Digital I/O pins, Power jack, Analog pins.

Arduino Bluetooth

Arduino Bluetooth Board

Arduino Bluetooth

  • Arduino Bluetooth is a microcontroller board originally was based on the ATmega168 with 328P and Blue giga WT11 Bluetooth.
  • It supports wireless serial communication over Bluetooth, but is not compatible with Bluetooth headsets or other audio devices.
  • It has 14 digital input/output pins of which 6 can be used as PWM outputs and one can be used to reset the WT11 module, an ICSP header, and a reset button, a 16 MHz crystal oscillator, screw terminals for power, 6 analog inputs.
  • It can be programmed wirelessly over the Bluetooth and contains everything needed to support the microcontroller.

Arduino Functions

  • In Arduino Functions allows a programmer to divide a specific code into various sections, and each section performs a particular task.
  • In program functions are created to perform a task multiple times and it is a type of procedure that returns the area of code from which it is called.
  • It increases the readability of code and conceives and organizes the program.
  • It makes the program compact and small and reduces the chance of errors.
  • It allows us to divide a complex code or program into a simple one and avoids the repetition of the set of statement or codes.

Arduino Common Functions

Arduino Common Functions

Arduino Common Functions

  • The Arduino common functions consist of two types they are setup () and loop (), which are called automatically in the background.
    • Void Setup () includes the initial part of the code, which is executed only once and it is called as preparation block.
    • Void Loop () includes the statements, which are executed repeatedly and it is called as execution block.

Function Declaration

Function Declaration

Function Declaration

Function return type

  • Here, we need a return type for a function and in variable we can store the return value of a function.
  • We can use any data type as a return type, such as char, float, etc.

Function Name

  • It represents the real body of the function and consists of a name specified to the function.

Function parameter

  • Parameters are used to passed to the function and they are defined as the special variables, which are used to pass data to a function.
  • The function must be followed by parentheses () and the semicolon; and the actual data passed is termed as an argument.

Sample Code

int a= 0;  
int b;  
void setup()  
{  
  Serial.begin(9600);  
}  
void loop()   
{  
b = Evenfunction(a); // we can store the function return value in variable b  
  Serial.print(a);  
  Serial.print(" : "); // to separate even or odd text  
  if (b==1)  
  {  
    Serial.println( " Number is even");  
  }  
    else  
    {  
      Serial.println("Number is odd");  
    }  
                       
      a++; // the function will increment and will again run  
                     delay(1000);  
}  
                    
 int Evenfunction(int d)  
                       {  
                       if (d% 2==0)  
                       {  
                         return 1;  
                       }  
                       else  
                       {  
                         return 0;  
                       }  
                     }

Output

Arduino Functions List

Arduino Data Types

Arduino Data Types

Arduino Data Types

Void Data Type

  • The void data type used to declare the functions and specifies the empty set of values.
  • It is used as the return type for the functions which do not return any value.

Int Data Type

  • The integer data types are the whole numbers like 5, -6, 10, -123, etc. that they do not have fractional part.
  • The integer data types are represented by int and it is considered the primary data type to store the numbers.

Char Data Type

  • The char datatype can store any number of character set and an identifier declared as the char becomes a character variable.
  • The literals are written inside a single quote and it is often said to be an integer type.

Float Data Type

  • A number having the decimal part and fractional part is considered as a floating-point number.
  • Due to their greater resolution, fractional numbers are used to approximate the analog and contiguous values.
  • In exponent form floating point numbers can be written.

Double Data Type

  • Double data type is also used for handling the floating-point or decimal numbers.
  • It stores floating point numbers with larger precision and range and occupies twice as much memory as float.

Unsigned Int Data Type

  • The unsigned int stores the value up to 2 bytes or 16 bits and stores only positive values.
  • The range of unsigned int data type is from 0 to 65,535 or 0 to ((2 ^ 16) - 1).
  • The difference between signed and unsigned data type is sign bit.

Short Data Type

  • The short is an integer data type that stores two bytes or 16-bit of data and range of short data types is from -32768 to 32767 or - (2^ 15) to ((2 ^ 15) - 1).

Long Data Type

  • The long data types are considered as the extended size variables, which store 4 bytes (32 -bits) and its size ranges starts from -2,147,483,648 to 2,147,483,647.
  • At least one of the numbers should be followed by L, which forces the number to be a long data type, while using integer numbers.

Unsigned Long Data Type

  • The unsigned long data types stores 4 bytes (32 -bits) which considered as the extended size variables.
  • Like other unsigned data types, it does not store negative numbers, which makes their size ranges from 0 to 4,294,967,295 or (2^32 - 1).

Byte Data Type

  • It stores values from 0 to 255, which is considered as an unsigned number.

Word Data Type

  • It stores values from 0 to 65535, which is considered as an unsigned number of 16 bits or 2 bytes

Related Searches to What is Arduino ? - Arduino Programming - Arduino Tutorial