Introduction: Arduino Basic Tutorial for Beginners

1. What is Arduino?

Arduino is a platform for embedded systems, based mostly on 8-bit microcontrollers from the AVR family. The exception is Arduino Due, which uses a 32-bit ARM Cortex core. In other words, it is a printed circuit board with a microcontroller and its outputs capable of operating external devices, eg sensors, motor controllers, displays, etc. Thanks to goldpin connectors, modules can be connected using publicly available connecting cables .

Most versions of Arduino do not require any external programmer. All you need to do is connect to your computer with a miniUSB-USB cable .

One of the advantages of the platform is its own free environment with innumerable libraries, examples, tutorials for handling various types of external devices.

2. Who is the platform for?

Arduino is intended for both beginners and advanced electronic programmers.

The person starting the adventure with this type of system will save a lot of time and nerves when configuring programmers, checking connections, and installing drivers. It is well known that it is best to learn from examples. For Arduino, there are many of them on the project website and on the entire Internet.

More advanced users will like numerous libraries, both default ones (including: EEPROM, Ethernet, Display, Servo, SPI, TWI, WiFi), as well as files made available by producers of electronic modules (eg our supplier - Pololu).

Example:

Support for the popular 16x2 LCD display boils down to a few simple lines of code:

LiquidCrystal lcd (12, 11, 5, 4, 3, 2); // increment of leads

lcd.begin (16, 2); // Specify the 16-column display type, 2 lines

lcd.print ("Hello World"); // Provide text to display

The full code displaying the words "Hello World" and the connection diagram of the display can be found at: Arduino.cc .

3. Which version to choose?

The choice of the version depends on the intended use of the module. In our store are available:

Step 1: Arduino Uno R3

Arduino Uno R3

The simplest version of the module. On the plate you will find:

· Atmega328 microcontroller (32kB Flash, SRAM 2kB, 16MHz clock speed)

· 14 digital inputs / outputs - to which, for example, LEDs, buttons, displays, etc. can be connected.

· 6 PWM outputs - for example for controlling the rotational speed of motors, setting the servo position

· 6 analog inputs - allowing to operate all kinds of sensors, transducers with analogue output

Communication interfaces:

· UART - one of the easiest ways to exchange data with a PC

· I2C / TWI - support for sensors, time circuits

· SPI - communication with fast transducers or external memories

Power supply:

· USB or external source (eg AC adapter)

Arduino Uno is a good choice for relatively simple, small projects. You can successfully implement it, for example, motor control, lighting controller with user interface, LCD display. The module is also recommended to users entering the world of microcontrollers and embedded systems.

Step 2: Arduino Leonardo

Arduino Leonardo

· Another version, on which we can find:

· ATmega32u4 microcontroller (32kB Flash, 2.5kB SRAM, 16MHz clock speed)

· 20 digital inputs / outputs - to which, for example, LEDs, buttons, displays, etc. can be connected.

· 7 PWM outputs

· 12 analog inputs - two times more than the Uno version, it means the possibility of connecting more sensors with an analogue output

Communication interfaces:

· UART - one of the easiest ways to exchange data with a PC

· I2C / TWI - support for sensors, time circuits

· SPI - communication with fast transducers or external memories

· USB - allows you to connect popular computer devices

· Power supply: USB or external source (eg AC adapter)

If our project is to use a device that connects via a USB interface, Arduino Leonardo will be the perfect choice. The system has an integrated USB controller, which distinguishes it from the others.

The producer also provides versions with "low profile". The board has no connectors, the user can solder them at their own discretion. All elements are in surface-soldered housings. The option is useful when our project has to procreate in a small space.

Step 3: Arduino Mega 2560

Arduino Mega 2560

Version designed to implement more extensive projects. It has as many as 54 digital inputs / outputs, more memory and more communication interfaces than Arduino UNO and Leonardo. The plate contains: ATmega2560 from the AVR family (Flash 256kB, SRAM 8kB, EEPROM 4kb clock speed 16MHz)54 general purpose digital inputs / outputs14 PWM outputs16 analog inputs -Communication interfaces:4 xUART - one of the easiest ways to exchange data with a PCI2C / TWI - support for sensors, time circuitsSPI - communication with fast transducers or external memoriesPower supply: USB or external source (eg AC adapter) The module is more expensive than the previous versions, but has more options. Atmega2560 microcontroller has a rich periphery and a large amount of memory. 256kB Flash - allows you to support extended code, 4kB EEPROMU for writing a lot of data.

Step 4: Arduino Mega ADK

Arduino Mega ADK

In addition to the advantages of Arduino Mega, ADK also has the ability to connect to the Android system via a USB interface controlled by the MAX34210 chip. The module specification is similar to Arduino Mega:

· ATmega2560 from the AVR family (Flash 256kB, SRAM 8kB, EEPROM 4kb clock speed 16MHz)

· 54 general purpose digital inputs / outputs

· 14 PWM outputs

· 16 analog inputs

Communication interfaces:

· 4 xUART - one of the easiest ways to exchange data with a PC

· I2C / TWI - support for sensors, time circuits

· SPI - communication with fast transducers or external memories

· Power supply: USB or external source (eg AC adapter)

The ADK version is designed for projects using communicates with Android . The built-in USB controller also allows you to connect a camera, game controller or motion controller.

Step 5: Arduino Leonardo Ethernet

Arduino Leonardo Ethernet

The main advantage of the module is its easy connection to the network. The module has a network socket with an Ethernet controller. There is also a microSD memory card slot on the board . Specification similar to Arduino Leonardo:

· Atmega32u4 microcontroller (32kB Flash, 2.5kB SRAM,

· 16MHz clock speed)

· 20 digital inputs / outputs - to which, for example, LEDs, buttons, displays, etc. can be connected.

· 7 PWM outputs - for example for controlling the rotational speed of motors, setting the servo position

· 12 analog inputs - allowing to operate all kinds of sensors, transducers with analogue output

Communication interfaces:

· UART - one of the easiest ways to exchange data with a PC

· I2C / TWI - support for sensors, time circuits

· SPI - communication with fast transducers or external memories

· Power: external source (eg AC adapter)

The Ethernet version is designed for projects requiring connection to the network. The convenience is also an integrated microSD card slot , on which more data can be stored than in the memory of the microcontroller itself.

Step 6: Arduino Due

Arduino Due

Thanks to Arduino Due, the user can create systems using the ARM 32-bit Cortex M3 microcontroller based on Arduino libraries. The specification is as follows:

· Supply voltage: 7V to 12V (recommended), 6V-20V (maximum)

· Mikrokontroler: AT91 SAM3X8E, rdzeń 32-bit ARM Cortex M3

· The maximum clock frequency: 84MHz

· SRAM memory: 96 kB Flash memory: 512 kB

· Pins I / O: 54

· PWM channels: 12

· Number of analog inputs: 12 (A / D converter channels)

· D / A converter (digital-analogue)

· DMA controller

· Serial interfaces: UART, SPI, I2C, CAN, USB

· Debugger JTAG

The board is dedicated to users who want to get acquainted with the latest solutions in the world of microcontrollers. It has definitely more capabilities than AVR-based versions, rich peripheral circuits, including digital-to-analogue converter.

In addition to the above, Arduino also provides:

Arduino Zero M0 Pro - 32 bit Cortex M0 - Atmel ATSAMD21G18 32-bit microcontroller module equipped with ARM Cortex M-0 core. It has 256 KB Flash memory, 32 KB RAM, 14 digital I / Os, 12 PWM channels, 6 analog inputs and one output, and popular communication interfaces. The module works with 3.3 V.

Arduino Yún - WiFi - Arduino connection and Linux system. The module based on the ATmega32u4 system used in Leonardo allows you to wirelessly program and control the device via the WiFi network and the appropriate library. There is also an Arduino Yun PoE version - powered from an Ethernet network.

Arduino Micro - a miniature module based on Arduino Leonardo, is characterized by small size. It has AVR Atmega32U4 microcontroller. Equipped with 20 digital I / O and popular communication interfaces.

4. Examples of use

- Arduino and orientation in three-dimensional space.

An example of using a 3-axis gyroscope, accelerometer and magnetometer ( MinImu9 system ) for orientation in 3D space.

- Arduino and LCD display.

LCD display support with HD44780 controller using the Arduino module.

- DC motor control using the Arduino platform.

Example of handling modules (H-bridges) used to control the direction and speed of DC motors.

- Connection to an Ethernet network

Arduino connection with Ethernet ENC28J60 module .