The main core of the Arduino UNO is AVR’s ATMEGA328 microcontroller. It has 32 KB flash memory, which is sufficient for most of the Embedded Applications. It has 28 PINs for the PDIP package and 32 PINs for the TQFP package. It has 23 I/O PINs (TQFP- 25 I/O PINs):
Analog Input Pins:
- PIN A0 to A5. For 32 pin packages, A6 and A7 are extra Analog input PINs. A6 and A7 work only as an Analog input, but PIN A0 to A5 can work as Digital I/P also.
Analog Output PINs ( PWM ):
- PINs – 3, 5, 6, 9, 10, 11
Digital Input/Output PINs:
- PINs 0 to 13, A0 to A5.
I2C Communication:
- A4 ( SDA ) & A5 ( SLC ).
Arduino UNO detailed pin diagram
Detailed Features:
CPU | 8-bit AVR |
Number of Pins | 28 |
Operating Voltage (V) | +1.8 V TO +5.5V |
Number of programmable I/O lines | 23 |
Communication Interface | Master/Slave SPI Serial Interface(D11, D12, D13 PINS) [Can be used for programming this controller] Programmable Serial USART(D0, D1 PINS) [Can be used for programming this controller] Two-wire Serial Interface I2C (A4, A5 PINS) [ Can be used to connect peripheral devices like Servos, sensors and memory devices ] |
JTAG Interface | Not available |
ADC Module | 6 channels, 10-bit resolution ADC |
Timer Module | Two 8-bit counters with Separate Prescaler and compare mode, One 16-bit counter with Separate Prescaler, compare mode and capture mode. |
Analog Comparators | 1 (D6, D7 PINS) |
DAC Module | Nil |
PWM channels | 6 |
External Oscillator | 0-4MHz @ 1.8V to 5.5V 0-10MHz @ 2.7V to 5.5V 0-20MHz @ 4.5V to 5.5V |
Internal Oscillator | 8MHz Calibrated Internal Oscillator |
Program Memory Type | Flash |
Program Memory or Flash memory | 32 Kbytes [10000 write/erase cycles] |
CPU Speed | 1 MIPS for 1 MHz |
RAM | 2 Kbytes Internal SRAM |
EEPROM | 1 Kbytes EEPROM |
Watchdog Timer | Programmable Watchdog Timer with Separate On-chip oscillator |
Program Lock | Yes |
Power Save Modes | Six Modes [Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby] |
Operating Temperature | -40°C to +105°C(+105 being absolute maximum, -40 being the absolute minimum) |
An Introduction to Arduino IDE
After downloading and installing the Arduino IDE, learn basic operational elements of IDE as shown in the following figure:
Arduino programs can be divided into three main parts:
- Structure.
- Values (Variables and Constants).
- Functions.
Structure:
The basic structure of the Arduino Programming Language is fairly simple and runs in at least two parts, or functions, enclose blocks of statements.
- Where setup() is preparation and loop() is the execution.
- Both functions are required for the program to run.
setup()
- Called once when your program starts.
- Used to initialize pin modes, begin serial,…… etc.
- It must be included in the program even if there are no statements to run.
void setup() {
// put your setup code here, to run once:}
loop()
- Loop continuously allowing the program to change, response and controlling the Arduino board.
void loop() {
// put your main code here, to run repeatedly:}
pinMode()
- It is used to define the behaviour of PORT pin either INPUT or OUTPUT.
digitalWrite()
- It is used to make PORT pin either logic HIGH(1) or logic LOW(0).
digitalRead()
- It reads digital logic HIGH (1) or logic LOW(0).
analogRead()
- Atmega328 has 10 bit ADC, therefore it detects Analog voltage and converts it to digital binary no range from 0 to 1023 ( 2^10 ).
analogWrite()
- This function can create an Analog signal, in the form of PWM (Pulse Width Modulation).
Serial.print()
- It is used to send data to outside devices using the serial port. To do so, you need to set up the serial communication baud rate ( data transfer speed in bytes) first (in void setup() as Serial.begin(baud rate)).
delay()
- It is a time delay(wait) in millisecond, i.e. 1000 milliseconds=1 sec.