This article gives you a complete description of the very famous Arduino UNO board. The article discusses the hardware technicalities and programming of the board. If you are a beginner then, you may find this article very useful.
Arduino UNO is an open-source microcontroller board developed by Arduino. cc. Arduino UNO board is a mini-computer that gives a controlled output when provided with some input. One can make a wide range of projects using the Arduino platform. It is inexpensive and easy to use. In order to obtain more out of the Arduino platform, you just need to be familiar with the basics of C or C++ and the basics of circuit connections. You can use the Arduino IDE (Integrated Development Environment) for writing the code for your project and upload it on the board using the same. The Arduino board takes the input from the devices like switches, sensors, etc. and the output is obtained based on the code uploaded on the board.
Below I have given a brief description of Arduino UNO hardware and software. Also, at the end of the article, I have demonstrated the working of the UNO board with a simple example of LED control.
Microcontroller on the board
Arduino UNO boards have the famous ATmega328P installed on it which is an 8-bit Atmel AVR microcontroller based on RISC architecture. It has 32 KB of flash memory where the program gets stored and out of this 32 KB, 0.5 KB is used by the bootloader. Besides this, it has 2KB SRAM and 1 KB EEPROM. ATmega328P has 32 general-purpose registers out of which 31 registers are directly connected to the arithmetic logic unit(ALU). This makes these microcontrollers code efficient and 10 times faster than conventional CISC microcontrollers. It has a clock speed of 16MHz.
Pinout
In order to make proper circuit connections, you need to understand the purpose of each pin. Arduino UNO board has 14 digital pins, 6 analog pins, a power jack, a USB connection, and an ICSP header. These pins allow us to connect the board with different sensors, keypads, LEDs, and more. The pins of the Arduino UNO board can be categorized into 3 classes:
Pulse-width modulation is a modulating technique where messages are converted into pulses. PWM involves two components, frequency, and duty cycle. Frequency determines the number of times the signal fluctuates in a unit time period. The duty cycle determines how long the pulse remains in the HIGH state. The PWM is basically used to control the speed of the DC motor and to control the dimming of LEDs.
Pin 13 is connected to the LED in-built on the board.
Pin 2 and 3 can be used to trigger external interrupt INT0 and INT1.
Arduino UNO has 6 ICSP header pins. ICSP stands for In-circuit serial programming and is used to program Arduino board’s firmware. Also, it has 1 AREF pin.
Communication
Arduino boards can communicate serially with computers and other Arduino boards (not specifically UNO). Atmega328P provides UART TTL which is available in digital pins 0 (receiving pin or RX) and 1 (transmitting pin or TX) for serial communication. In serial communication, data of 1-bit size is transmitted and received at a time.
Communication can also be established via USB cable. The Arduino board has TX and RX which flashes when data is transmitted and received via USB connection only.
ATmega328P also supports I2C and SPI communication
Arduino IDE
Arduino Integrated Development Environment is a software where you can write the code and upload it on your Arduino board. It can be used in Windows, Linux, and Mac operating systems. The environment supports both C and C++ programming languages. Before programming, you need to select which Arduino board are you using in your project. The main code
of the Arduino project is called the sketch. Whenever you compile the sketch a .hex file generated. This .hex file is then uploaded to the microcontroller on the board.
In the above image, you can see the six options that Arduino IDE provides:
A basic Arduino sketch has two functions: void setup() and void loop().
Under the void setup(), you need to write the code that you want to run only once as soon as the program starts running. Below is two basic functions that are often used under in setup() function:
Under the void loop(), you need to write the program that you want to run as long as there is no interruption. Below are some basic functions that are often used under in loop() function:
You can also use arithmetic operators, comparison operators, boolean operators, bitwise operators, and compound operators as per your requirement. The syntax is very much like C++.
Now, for a better understanding, I am going to make a simple project with the Arduino UNO board. Any Arduino project involves three things:
Circuit
I have used the Proteus simulation software for the project simulation. In the above circuit, the digital pin 3 is connected to LED and in between, there is a resistor of 330 ohms. When using the simulation tool there is no need to connect the VIN and GND pin of the Arduino UNO board. But the same is not applicable when making physical connections.
Now, we need to write the program as per the above connection. Suppose we want to make the LED blink continuously at an interval of 1sec.
Code
In the above code, you can see that in the setup function I have set pin 3 as the output pin and its state is continuously being toggled at an interval of 1sec in the loop function.
Output
In the above image, LED glows for the first 1 sec.
In the above image, LED does not glow for the next 1 sec.
In this article, we discussed the Arduino UNO board, how to use Arduino IDE for programming it and lastly, we made a simple LED control project.