Arduino Platform
In questa pagina 7
What Arduino is
- A family of single-board microcontrollers based on the Atmel AVR family of microcontrollers (see Embedded Systems and MicrocontrollersAn embedded system is a computing system built for one specific function inside a larger system, made of a powering system, a processing unit (microcontroller or system-on-chip), memory, sensors and actuators, human-machine interfaces and transceivers.Embedded Systems and Microcontrollers → for the general concepts).
- Developed at the Interaction Design Institute of Ivrea by Massimo Banzi (and others) in 2005.
- The name comes from the bar in Ivrea where the founders used to meet; the bar, in turn, was named after the king of Italy Arduino d'Ivrea.
- The basic platform integrates the microcontroller with:
- pins connected to its input and output ports,
- a voltage regulator,
- possibly a USB connection.
- The hardware platform is inseparable from the Integrated Development Environment (IDE): the board is programmed from the Arduino IDE (website www.arduino.cc), see Lab 7 - Programming ArduinoLaboratory 7 introduces Arduino programming with setup and loop, the basic instructions and data types, the Blink sketch with LED resistor sizing, push buttons and a three-LED selector sketch.Lab 7 - Programming Arduino →.
- It exists in more than 20 different versions. The slides present three: UNO, Mega and Micro.
Arduino UNO
Main features (as listed on the slide):
| Item | Value |
|---|---|
| Microcontroller | ATMega328P |
| Digital I/O pins | 14 (numbered 0-13) |
| Analog input pins | 6 (numbered 0-5, i.e. A0-A5) |
| "Analog output" pins | 6, numbers 3, 5, 6, 9, 10, 12 as written on the slide |
| Programming connector | ICSP (In-Circuit Serial Programming) |
| Other connectors | one USB connector, one power plug |
| Controls | one reset button |
Caution on the "analog output" pins: the "analog output" is obtained by PWM (Pulse Width Modulation, see Lab 8 - Analog Output and Sensors with ArduinoLaboratory 8 covers digital input modes, PWM analog output with analogWrite (LED fading), the 10-bit analogRead input, the map and constrain functions, trimmer and photoresistor exercises, the LM35 temperature sensor and two additional exercises (hysteresis and potentiometer-controlled data logger).Lab 8 - Analog Output and Sensors with Arduino →). The list printed on this slide (3, 5, 6, 9, 10, 12) differs from the PWM pins stated in Lab 8, which are 3, 5, 6, 9, 10 and 11. The pinout drawing on the slides (PWM pins marked with a "~" and a tilde wave symbol) shows PWM on 3, 5, 6, 9, 10, 11; pin 12 in the lecture slide is most likely a typo for 11. Use the Lab 8 list.
The UNO is shown on the slides in five views:
- a photograph of the board, with the USB connector (type B) on the left, the DC power plug in the lower left, the reset button at the top left, the digital header on the top edge (pins 0-13, GND, AREF, SDA, SCL) and the power/analog header on the bottom edge;
- the electrical schematic (Arduino UNO Rev3), which contains the 5 V and 3.3 V regulators, the USB-to-serial section, the 16 MHz crystal and the ATMEGA328P-PU itself (illegible at this resolution in detail, so not transcribed);
- the PCB layout (top copper, with the four mounting holes MH1-MH4);
- a 3D rendering of the board;
- the UNO pinout drawing (see below).
Pinout drawing (UNO PINOUT sheet)
Elements legible on the sheet:
- Power jack: 7-12 V depending on current drawn, 2.1 mm plug (pins VIN and GND).
- Warnings: absolute maximum per pin 40 mA, recommended 20 mA; absolute maximum 200 mA for the entire package; the power sum for each pin's group should not exceed 100 mA.
- IOREF provides a logic reference voltage for shields that use it; it is connected to the 5 V bus (R3 only).
- Power header, from the left: IOREF, RESET, 3V3, 5V, GND, GND, VIN.
- Analog header: A0-A5; A4 is also SDA and A5 is also SCL (I2C, see Lab 10 - Arduino Standalone and Serial ProtocolsLaboratory 10 builds a standalone ATMega328P on a breadboard (16 MHz crystal, bootloader via ArduinoISP, or 8 MHz internal clock) and introduces the synchronous serial protocols I2C and SPI used to connect Arduino boards and peripherals.Lab 10 - Arduino Standalone and Serial Protocols →). Each analog pin maps to an ATmega port pin (A0 = PC0 ... A5 = PC5).
- Digital header: pins 0 (RX) and 1 (TX) are connected to the ATmega and used for USB programming and communication with it; pins 3, 5, 6, 9, 10, 11 are marked as PWM pins; pin 13 carries the on-board LED (and SCK), pins 11, 12, 13 are MOSI, MISO, SCK of the SPI bus, pin 10 is SS.
- A legend distinguishes power, GND, serial pin, analog pin, control, INT, physical pin, port pin, pin function, interrupt pin and PWM pin.
ATMega328P block diagram
The slide reproduces the internal architecture of the microcontroller. Blocks, all connected to an 8-bit data bus:
- Program Counter and Flash Program Memory, followed by the Instruction Register and the Instruction Decoder, which produces the control lines;
- Status and Control;
- 32 x 8 General Purpose Registers, feeding the ALU;
- Data SRAM and EEPROM;
- Direct Addressing and Indirect Addressing paths from the instruction register / registers to the data space;
- peripheral blocks: Interrupt Unit, SPI Unit, Watchdog Timer, Analog Comparator, I/O Module 1, 2, ..., n and I/O Lines.
Arduino Mega
Shown only as a photograph of the board (the slide gives no numeric specification; the markings in the picture read ARDUINO MEGA 2560). It is a larger board with a much larger microcontroller and extra headers along the right side (digital pins 22-53).
Arduino Micro
| Item | Value |
|---|---|
| Microcontroller | ATMega32U4 |
| Digital I/O pins | 20 |
| Analog input pins | 12 |
| "Analog output" (PWM) pins | 7 |
| Connectors | micro USB, ICSP |
| Controls | reset button |
Shields
- Shields are boards that add functionality to the Arduino.
- They have a standard format that matches the pinout of the Arduino UNO, so they plug on top of the board.
Examples shown on the slides (one photograph each, with no technical data):
| Shield | What the photograph shows |
|---|---|
| LCD Shield | 16-column display with six push buttons (SELECT, LEFT, UP, DOWN, RIGHT, RST) and a contrast trimmer |
| Motor Shield | board with screw/connector blocks for motors |
| Ethernet Shield | RJ45 Ethernet jack and a micro-SD card slot |
| Data Logger Shield | SD card slot, battery holder for the real-time clock, prototyping area |
| GSM Shield | SIM900 module with external antenna, audio jacks |
(The GSM shield is the link with cellular technologies of Data Transmission Technologies - Wired, Wireless, LAN and WANSurvey of the data transmission technologies used to connect measurement and IoT nodes, from local ones (RFID, NFC, Bluetooth, WiFi, ZigBee) to wide-area ones (LoRa, SigFox, GSM/GPRS, UMTS, LTE, LTE-M, NB-IoT, 5G), with frequencies, ranges and bit rates.Data Transmission Technologies - Wired, Wireless, LAN and WAN →; the Ethernet shield with wired LANs.)
Where this is used in the course
- Basic programming and I/O: Lab 7 - Programming ArduinoLaboratory 7 introduces Arduino programming with setup and loop, the basic instructions and data types, the Blink sketch with LED resistor sizing, push buttons and a three-LED selector sketch.Lab 7 - Programming Arduino →, Lab 8 - Analog Output and Sensors with ArduinoLaboratory 8 covers digital input modes, PWM analog output with analogWrite (LED fading), the 10-bit analogRead input, the map and constrain functions, trimmer and photoresistor exercises, the LM35 temperature sensor and two additional exercises (hysteresis and potentiometer-controlled data logger).Lab 8 - Analog Output and Sensors with Arduino →.
- Libraries, sensors and the LCD: Lab 9 - Arduino Libraries and Sensor IntegrationLaboratory 9 shows how to install and write Arduino libraries, connect the DHT11 temperature and humidity sensor, wire a 16-pin HD44780 LCD with a contrast trimmer, drive it with the LiquidCrystal library and combine sensor and display.Lab 9 - Arduino Libraries and Sensor Integration →.
- Using the bare chip and serial buses: Lab 10 - Arduino Standalone and Serial ProtocolsLaboratory 10 builds a standalone ATMega328P on a breadboard (16 MHz crystal, bootloader via ArduinoISP, or 8 MHz internal clock) and introduces the synchronous serial protocols I2C and SPI used to connect Arduino boards and peripherals.Lab 10 - Arduino Standalone and Serial Protocols →.
- Network connection: Lab 11 - WiFi and Internet with ArduinoLaboratory 11 connects an Arduino UNO to WiFi through an ESP8266-01 module (pinout, 3.3 V level shifting and supply, baud rate fix with AT commands), tests the WiFiEsp library examples and posts sensor data to the dweet.io cloud service with an HTTP GET request.Lab 11 - WiFi and Internet with Arduino →.
Versione ripasso
- Arduino = family of single-board microcontrollers based on the Atmel AVR family (general concepts: Embedded Systems and MicrocontrollersAn embedded system is a computing system built for one specific function inside a larger system, made of a powering system, a processing unit (microcontroller or system-on-chip), memory, sensors and actuators, human-machine interfaces and transceivers.Embedded Systems and Microcontrollers →). Created in 2005 at the Interaction Design Institute of Ivrea (Banzi and others). More than 20 versions exist; the slides show UNO, Mega and Micro.
- Board = microcontroller + I/O pins + voltage regulator + (usually) USB. The hardware is inseparable from the IDE (www.arduino.cc), see Lab 7 - Programming ArduinoLaboratory 7 introduces Arduino programming with setup and loop, the basic instructions and data types, the Blink sketch with LED resistor sizing, push buttons and a three-LED selector sketch.Lab 7 - Programming Arduino →.
- UNO:
- ATMega328P; 14 digital I/O (0-13); 6 analog inputs (A0-A5);
- "analog output" (PWM) pins: 3, 5, 6, 9, 10, 11 (the lecture slide prints 12 instead of 11; use the list of Lab 8 - Analog Output and Sensors with ArduinoLaboratory 8 covers digital input modes, PWM analog output with analogWrite (LED fading), the 10-bit analogRead input, the map and constrain functions, trimmer and photoresistor exercises, the LM35 temperature sensor and two additional exercises (hysteresis and potentiometer-controlled data logger).Lab 8 - Analog Output and Sensors with Arduino →);
- ICSP connector, one USB connector, power plug, reset button.
- UNO pinout limits: 40 mA absolute maximum per pin (20 mA recommended); 200 mA for the whole package; power jack 7-12 V.
- UNO special pins: 0 (RX) and 1 (TX) are wired to the ATmega for USB programming and serial; A4 = SDA and A5 = SCL (I2C, see Lab 10 - Arduino Standalone and Serial ProtocolsLaboratory 10 builds a standalone ATMega328P on a breadboard (16 MHz crystal, bootloader via ArduinoISP, or 8 MHz internal clock) and introduces the synchronous serial protocols I2C and SPI used to connect Arduino boards and peripherals.Lab 10 - Arduino Standalone and Serial Protocols →); 10-13 = SS, MOSI, MISO, SCK (SPI); 13 also drives the on-board LED.
- ATMega328P block diagram (8-bit data bus): flash program memory, decoder, 32 x 8 registers feeding the ALU, SRAM, EEPROM, interrupt, SPI, watchdog, analog comparator, I/O modules.
- Mega: larger board with a bigger microcontroller; the slide gives no numbers.
- Micro: ATMega32U4, 20 digital I/O, 12 analog inputs, 7 PWM outputs, micro USB, ICSP, reset button.
- Shields: boards with the UNO-compatible pinout that plug on top of it: LCD, motor, Ethernet, data logger, GSM (see Data Transmission Technologies - Wired, Wireless, LAN and WANSurvey of the data transmission technologies used to connect measurement and IoT nodes, from local ones (RFID, NFC, Bluetooth, WiFi, ZigBee) to wide-area ones (LoRa, SigFox, GSM/GPRS, UMTS, LTE, LTE-M, NB-IoT, 5G), with frequencies, ranges and bit rates.Data Transmission Technologies - Wired, Wireless, LAN and WAN →).
- Libraries, sensors and LCD: Lab 9 - Arduino Libraries and Sensor IntegrationLaboratory 9 shows how to install and write Arduino libraries, connect the DHT11 temperature and humidity sensor, wire a 16-pin HD44780 LCD with a contrast trimmer, drive it with the LiquidCrystal library and combine sensor and display.Lab 9 - Arduino Libraries and Sensor Integration →; network: Lab 11 - WiFi and Internet with ArduinoLaboratory 11 connects an Arduino UNO to WiFi through an ESP8266-01 module (pinout, 3.3 V level shifting and supply, baud rate fix with AT commands), tests the WiFiEsp library examples and posts sensor data to the dweet.io cloud service with an HTTP GET request.Lab 11 - WiFi and Internet with Arduino →.
- Typical mistakes:
- reading "analog output" as a true DAC: it is PWM;
- using the pin list of the slide (pin 12) instead of the PWM pins 3, 5, 6, 9, 10, 11;
- exceeding 20 mA per pin.
Teoria collegata
- Arduino in the Microelectronics Laboratory
- Serial Interfaces for Arduino - UART, I2C and SPI
- Course Overview and Measurement Fundamentals
- Data Transmission Technologies - Wired, Wireless, LAN and WAN
- Embedded Systems and Microcontrollers
- Instrumentation and Measurement Technologies
- Lab 7 - Programming Arduino
- Lab 8 - Analog Output and Sensors with Arduino
- Lab 9 - Arduino Libraries and Sensor Integration
- Lab 10 - Arduino Standalone and Serial Protocols
- Lab 11 - WiFi and Internet with Arduino