Getting Started with Arduino
Watch the Video Tutorial: Getting started with Arduino
Arduino is the open source electronics prototyping platform. It has become popular in the world of hobbyists, students, artists, programmers and professionals. Arduino was born as an easy tool for fast prototyping, aimed at students without a background in electronics and programming. As soon as it reached a wider community, the Arduino board started changing to adapt to new needs and challenges, differentiating its offer from simple 8-bit boards to products for Internet of Things (IoT) applications, wearable, 3D printing, and embedded environments. All Arduino boards are completely open-source, empowering users to build them independently and eventually adapt them to their particular needs. The software, too, is open-source, and it is growing through the contributions of users worldwide.
Some Arduino boards
Figure 1: Arduino Uno R3
The Arduino Uno board is inexpensive (about $30) and quite tolerant of common novice mistakes. There are currently a couple of Arduino boards, the cheapest and the simplest to start with is the Arduino Uno board shown above on figure 1. This board is based on ATmega328 microcontroller. It has a USB interface, 6 analog input pins and 14 digital input output pins which allows the user to extend connection with other boards. Arduino Uno provides an external polyfuse for the protection of the computer’s USB. The fuse will break automatically when more than 500mA of current passed to the USB port and it will remain until the short or overload is removed.
Figure 2: Description of Arduino Uno Board
- The Arduino microcontroller stays in its socket. It can be replaced, if damaged, but the Arduino SMD Edition, you can’t replace the Arduino microcontroller. The microcontroller used is the ATmega 328 it has 32KB of flash memory for storing the program. 2KB of SRAM and 1KB of EEPROM are also available.
- The USB connector is used to power the board from your computer’s USB port if an external power supplier is not used and also to transfer the program code from your computer into the Arduino.
- External (non-USB) power can come either from an AC-to-DC adapter or battery. The adapter can be connected by plugging a 2.1mm center-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 from 6 to 20 volts. If supplied with less than 7V, however, the 5V pin may supply less than five volts and the board may become unstable. If using more than 12V, the voltage regulator may overheat and damage the board. The recommended range is 7 to 12 volts.
- Digital I/O pins (pins 0–13): These pins can be either inputs or outputs. Inputs are used to read information from sensors, while outputs are used to control actuators. You will specify the direction (in or out) in the sketch (Arduino programming code is called Sketch) you create in the IDE. Digital inputs can only read one of two values, and digital outputs can only output one of two values (HIGH and LOW).
- Analogue In pins (pins 0–5): The analogue input pins are used for reading voltage measurements from analogue sensors such as temperature sensors. In contrast to digital inputs, which can only have two values HIGH and LOW, analogue inputs can measure 1,024 different levels of voltage.
- Analogue Out pins (pins 3, 5, 6, 9, 10, and 11): These are actually six of the digital pins that can perform a third function: they can provide analogue output. As with the digital I/O pins, you specify what the pin should do in your sketch.
You can learn more from Arduino Website.
Arduino Mega 2560
Figure 3: Arduino Mega 2560
The MEGA 2560 is designed for more complex projects. With 54 digital I/O pins, 16 analog inputs and a larger space for your sketch. This gives your projects plenty of room and opportunities.
Figure 4: Arduino Yún
Arduino YÚN is the perfect board to use when designing connected devices and, more in general, Internet of Things projects. It combines the power of Linux with the ease of use of Arduino. The board has built-in Ethernet and WiFi support, a USB-A port, micro-SD card slot, 20 digital input/output pins (of which 7 can be used as PWM outputs and 12 as analog inputs), a 16 MHz crystal oscillator, a micro USB connection, an ICSP header, and a 3 reset buttons.
Some Arduino shields
Shields are boards that can be plugged on top of the Arduino PCB extending its capabilities.
Arduino GSM Shield
Figure 5: Arduino GSM Shield
The Arduino GSM shield allows an Arduino board to connect to the internet, send and receive SMS, and make voice calls using the GSM library. Figure 6 below shows the GSM Shield plugged on top of the Arduino board.
Figure 6: GSM Shield plugged on top of the Arduino board
Arduino Ethernet Shield
Figure 7: Arduino Ethernet Shield
The Arduino Ethernet Shield allows an Arduino board to connect to the internet. It has a standard RJ-45 connection, with an integrated line transformer and Power over Ethernet enabled.
Arduino Motor Shield
Figure 8: Arduino Motor Shield
The Arduino Motor Shield is based on the L298, which is a dual full-bridge driver designed to drive inductive loads such as relays, solenoids, DC and stepping motors. It lets you drive two DC motors with your Arduino board, controlling the speed and direction of each one independently. You can also measure the motor current absorption of each motor, among other features.
Watch the Video Tutorial: Installing the Software
A sketch is the name that Arduino uses for a program. It’s the unit of code that is uploaded to and run on an Arduino board to execute what you have specified. To write this program, you need to install the Arduino software, known as the Integrated Development Environment (IDE), this software is free. You can download it from Arduino website. This software can run on Windows, Macintosh and Linux.
Installing the Arduino IDE
You need to download the correct version for your operating system, and then proceed with the appropriate instructions on your screen. If you are using a Windows operating system, you’ll be shown a licence, read and accept the agreements, click next and follow the instructions. After the files are installed, a window will pop up asking for permission to install the drivers. Click Install. When the installer has completed, click Close to finish.
After installation, connect your Arduino Uno to your computer via a USB cable. The green LED labeled PWR on the board should come on, and the yellow LED labeled L should start blinking. The Found New Hardware Wizard window comes up, and Windows should automatically find the right drivers and allocate a COM PORT number as shown on figure 9 below, the Arduino Uno board was allocated COM8. This number might be different from one computer to another.
Figure 9: Arduino Uno on COM8
You can also confirm this Port number under Ports (COM & LPT) in device manager ( right-click your My Computer and select Device manage) as shown on figure 10 below.
Figure 10: Arduino Uno on COM8 in device manager
If you are using windows 8 or 10 operating system, you might experience a problem installing drivers automatically, you’ll get some message like Windows x64 doesn’t accept “untrusted drivers” you’ll have to disable Windows driver signature before you can install your drivers.
On the Arduino Uno board, there are 4 on-board LEDs. One for indicating power, two (RX and TX) for indicating serial communication between Computer and Arduino. The remaining one is connected to PIN : 13. Thus when the digital pin 13 is HIGH, LED turns ON and when it is LOW, LED will be OFF. Let us create a simple sketch to blink this on-board LED ON and OFF at an interval of 1 second.
- Open the Arduino IDE
- Then make sure your board is selected to Arduino/Genuino Uno. If you are using a different board, select it accordingly
- Select the correct COM Port that your board is using. In this demonstration, we selected COM8. Open Tools menu >> Port: >> Change the current port (possibly COM1) to the correct one.
- Arduino IDE comes with a lot of examples, we will open the Blink example. Open File >> Examples >> 01.Basics >> Blink
- It will open the sketch (code) for blinking on board LED connected to PIN : 13
- Now you can compile the sketch by clicking on the Verify Button. If the compilation process is completed successfully, “Done Compiling will be displayed on the bottom left of your IDE.
- Now we can upload the sketch to Arduino Board by simply clicking on the Upload Button. You can see that the RX and TX LEDs on your board is blinking indicating data transfer. A message “Done Uploading” will be displayed at the bottom of the IDE on completion. Automatic reset of the Arduino board will happen after uploading the program. Then you’ll see the on-board LED connected to pin 13 blinking ON and OFF.