The Arduino is an open-source, single-board microcontroller that you can use for many different applications. It is arguably the easiest and least expensive microcontroller option for hobbyists, students and professionals to develop microcontroller-based projects. Arduinos use either an Atmel AVR or Atmel ARM microcontroller chip, and some versions have a USB interface. They also have six or more analog input pins and fourteen or more digital input/output (I/O) pins that are used to connect sensors, actuators, and other peripheral circuits to the microcontroller. Arduinos cost anywhere from five or six dollars up to $40, depending on the feature set of the board.
Types of Arduino Boards
There are many different types of Arduinos available, as shown in the table below, each with its own feature set. They differ with regard to processing speed, memory, I/O ports, and connectivity, but their basic functionality is the same.
- Arduino Uno
- Arduino Leonardo
- Arduino Due
- Arduino Yún
- Arduino Tre
- Arduino Micro
- Arduino Robot
- Arduino Esplora
- Arduino Mega
- Arduino Mini
- LilyPad Arduino
- Arduino Nano
- Arduino Fio
- Arduino Pro
- Arduino Ethernet
The software used to program the Arduino is called the Integrated Development Environment (IDE). The IDE is a Java application that runs on many different platforms, including PCs, Macs, and Linux systems. It is developed for beginners who are not familiar with programming. It includes a code editor, a compiler, and an uploader. Also included are code libraries for using peripherals, such as serial ports and various types of displays. Arduino programs are called "sketches," and they are written in a language very similar to C or C++.
Most Arduinos connect to a host computer via a USB cable. This connection enables you to upload sketches to your Arduino as well as provide power to the board.
Programming an Arduino is easy: you use the IDE code editor to write the program and then compile and upload it with a single click.
An Arduino program includes two main functions:
You use the setup() function to initialize settings for the board. This function runs only once when the board is powered on.
The loop() function is executed after setup() completes, and unlike the setup() function, it runs continually.
Here are some of the most commonly used functions in Arduino programming:
- pinMode - sets the pin mode to either INPUT or OUTPUT.
- analogRead - reads an analog voltage from an analog input pin.
- analogWrite - writes an analog voltage to an analog output pin.
- digitalRead - reads the value of a digital input pin.
- digitalWrite - sets the value of a digital output pin to either HIGH or LOW.
- Serial.print - prints data to the serial port as human-readable ASCII text.
Arduino libraries are collections of functions that allow you to control devices. Here are some of the most widely-used libraries:
- GPS library
- LCD library
- Servo library
- SD library
- Robot_control library
- Robot_motor library
- Ethernet library
- Wi-Fi library
- Stepper library
- SPI library
- EEPROM library
- Software Serial library
- GSM library
Steps for setting up Arduino
1. First, install the IDE software. You can download the IDE from the Arduino website.
2. Install the software on your PC.
3. Now run the arduino IDE .exe file. It has a following layout:
4. Write your program using the code editor and upload it to the Arduino. To do this, you need to connect the Arduino to your computer using a USB cable.
5. In the IDE, select the type of Arduino you are using from the Tools -> Boards menu.
6. Now verify your code by clicking the ‘tick’ icon at the top of the IDE window, then click the adjacent ‘right’ arrow to compile and upload the code to your Arduino.
Note: You may have to install drivers if your system does not detect the Arduino.
Arduino shields are board that plug into the Arduino to allow you to connect peripheral devices, sensors, and actuators to the Arduino. Below are some popular shields:
- GSM Shield
- Ethernet Shield
- WiFi Shield
- Motor Shield
- Proto Shield
- Joystick Shield
- Bluetooth Shield
- Xbee shield
Components and Accessories
Below is a list of all the components and accessories commonly used with an Arduino to develop projects:
- USB cable
- 9V Battery
- Push Buttons
- Voltage Regulators
- Sensors (IR, temperature etc)
- Jumper wires
- Motors (DC, Servo, BLDC)
- Hex keypad
- Arduino shields