INTRODUCTION TO ARDUINO

2. HARDWARE

Many board models are on the market; most of them use AT mega processors. Furthermore, you can find some boards with other processors, which ones are associated with other companies, like Arduino 101, which has an Intel Curie microprocessor.

1.1.  BOARDS COMPARISON

Some of most used boards are:

·         UNO: The UNO is the best board to get started with electronics and coding. If this is your first experience tinkering with the platform, the UNO is the most robust board you can start playing with

·         ZERO: The Zero is a simple and powerful 32-bit extension of the platform established by the UNO.

·         MKR1000: Is a powerful board that combines the functionality of the Zero and the Wi-Fi Shield.

·         MICRO: The Micro is the smallest board of the family, easy to integrate it in everyday objects to make them interactive.

·         MEGA: The MEGA 2560 is designed for projects that are more complex. With 54 digital I/O pins, 16 analog inputs and a larger space for your sketch it is the recommended board for 3D printers and robotics projects.

·         LILYPAD: The LilyPad Arduino is designed for e-textiles and wearable projects. It can be sewn to fabric and similarly, sensors and actuators with conductive thread.


Name

Processor

Operating/Input
Voltage

CPU Speed

Analog In/Out

Digital IO/PWM

EEPROM [kB]

SRAM [kB]

Flash [kB]

USB

UART

LilyPad

ATmega168V
ATmega328P

2.7-5.5 V /
2.7-5.5 V

8MHz

6/0

14/6

0.512

1

16

-

-

LilyPad USB

ATmega32U4

3.3 V / 3.8-5 V

8 MHz

4/0

9/4

1

2.5

32

Micro

-

Mega 2560

ATmega2560

5 V / 7-12 V

16 MHz

16/0

54/15

4

8

256

Regular

4

Micro

ATmega32U4

5 V / 7-12 V

16 MHz

12/0

20/7

1

2.5

32

Micro

1

MKR1000

SAMD21 Cortex-M0+

3.3 V/ 5V 

48MHz 

7/1

8/4

-

32

256

Micro

1

Uno

ATmega328P

5 V / 7-12 V

16 MHz

6/0

14/6

1

2

32

Regular

1

Zero

ATSAMD21G18

3.3 V / 7-12 V

48 MHz

6/1

14/10

-

32

256

2 Micro

2


(Information extracted from https://www.arduino.cc/en/Products/Compare)

1.2.  ARDUINO UNO

1.2.1.     GENERAL

This course is based on Arduino UNO. The UNO has ATmega328P processor 14 digital Input/output pins (6 of them can be used as PWM outputs), 6 analog Inputs, 16MHz quartz osciller, a connector to power supply and a USB connection.

1.2.2.     CHARACTERISTICS

Characteristic

Description

Microcontroller

ATmega328P

Operating Voltage

5V

Input Voltage (recommended)

7-12V

Input Voltage (limit)

6-20V

Digital I/O Pins

14 (of which 6 provide PWM output)

Analog Input Pins

6

DC Current per I/O Pin

20 mA

DC Current for 3.3V Pin

50 mA

Flash Memory

32 KB (ATmega328P)
of which 0.5 KB used by bootloader

SRAM

2 KB (ATmega328P)

EEPROM

1 KB (ATmega328P)

Clock Speed

16 MHz

Length

68.6 mm

Width

53.4 mm

Weight

25 g



1.2.3.     POWER

The Arduino/Genuino Uno board can be powered via the USB connection or with an external power supply. The power source is selected automatically.

External (non-USB) power can come either from an AC-to-DC adapter (wall-wart) or from 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.

The power pins are as follows:

·         Vin: The input voltage to the Arduino/Genuino board when it’s using an external power source (as opposed to 5 volts from the USB connection or other regulated power source). You can supply voltage through this pin, or, if supplying voltage via the power jack, access it through this pin.

·         5V: This pin outputs a regulated 5V from the regulator on the board. The board can be supplied with power either from the DC power jack (7 - 12V), the USB connector (5V), or the VIN pin of the board (7-12V). Supplying voltage via the 5V or 3.3V pins bypasses the regulator, and can damage your board. We don’t advise it.

·         3V3: A 3.3 volt supply generated by the on-board regulator. Maximum current draw is 50 mA.

·         GND: Ground pins.

·         IOREF: This pin on the Arduino/Genuino board provides the voltage reference with which the microcontroller operates. A properly configured shield can read the IOREF pin voltage and select the appropriate power source or enable voltage translators on the outputs to work with the 5V or 3.3V.

·         (Information extracted from https://www.arduino.cc/en/Main/ArduinoBoardUno)

 

1.2.4.     MEMORY

The ATmega328 has 32 KB (with 0.5 KB occupied by the bootloader). It also has 2 KB of SRAM and 1 KB of EEPROM (which can be read and written with the EEPROM library).

1.2.5.     INPUT AND OUTPUT

Firstly, Arduino is a microcontroller platform, this means that the external pins correspond to a microcontroller internal pins. You can see the equivalence at the following image.

 

Each of the 14 digital pins on the Uno can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive 20 mA as recommended operating condition and has an internal pull-up resistor (disconnected by default) of 20-50k ohm. A maximum of 40mA is the value that must not be exceeded on any I/O pin to avoid permanent damage to the microcontroller.

In addition, some pins have specialized functions:

·         Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip.

·         External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.

·         PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.

·         SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication using the SPI library.

·         LED: 13. There is a built-in LED driven by digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it’s off.

·         TWI (I2C): A4 or SDA pin and A5 or SCL pin. Support TWI communication using the Wire library.

The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10 bits of resolution (i.e. 1024 different values). By default they measure from ground to 5 volts, though is it possible to change the upper end of their range using the AREF pin and the analogReference() function. There are a couple of other pins on the board:

·         AREF: It is the reference voltage for the analog inputs. Used with analogReference().

·         Reset: Bring this line LOW to reset the microcontroller. Typically used to add a reset button to shields which block the one on the board.

(Information extracted from https://www.arduino.cc/en/Main/ArduinoBoardUno)

1.2.6.     SOFTWARE RESET

Rather than requiring a physical press of the reset button before an upload, the Arduino/Genuino Uno board is designed in a way that allows it to be reset by software running on a connected computer. One of the hardware flow control lines (DTR) of the ATmega8U2/16U2 is connected to the reset line of the ATmega328 via a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to reset the chip. The Arduino Software (IDE) uses this capability to allow you to upload code by simply pressing the upload button in the interface toolbar. This means that the bootloader can have a shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload.

(Information extracted from https://www.arduino.cc/en/Main/ArduinoBoardUno)

1.2.7.     COMMUNICATIONS

Arduino UNO can communicate with a computer, other Arduino  or other microcontrollers via UART  TTL serial communication, which one is proporcionated by ATmega328 pins 0 and 1 and also you can canalize this communication to  USB port to communicate directly with PC. You can receive simple data text on Serial monitor (include on Arduino software).

On the other hand, you can use SoftwareSerial library to communicate via serial with any couple of pins.

Secondly, Arduino UNO also supports I2C (TWI) and SPI communication.

(Information extracted from https://www.arduino.cc/en/Main/ArduinoBoardUno)

1.2.8.     HOW YOU CAN BREAK ARDUINO UNO?

This part contains information, which one you have not to do ever. Only some examples are cited. But you must be careful in all your connections.

·         Short circuit I/O pin with GND: If you connect output configured pin without any resistance to GND pin you will go to overload and destroy the corresponding microcontroller pin.

·         Short circuit two I/O pins mutually: This is a similar case to a short circuit with GND. When you do this connection without resistance, you are overloading the pin.

·         Apply overvoltage to I/O pins: You can break the Arduino board if you apply a higher voltage than 5V to any I/O pin, a higher than 5V on Vin pin or higher than 3.3V on 3.3V pin. These pins do not have any protection to overvoltage.

·         Invert voltage polarity: If you connect Vin to GND on power supply and GND of Arduino to a 5V on power supply. You are inverting the polarity.

·         Overcome the total Max current: The microcontroller can suffer injuries if the current overcome 20mA on each pin or 200mA in total. You can see this in summary specifications.