- Arduino
Products
- Evolution
of Arduino: the family tree
-
|
|
|
memory
|
|
USB |
|
|
|
|
|
interface
|
features
|
preu
|
bits
|
|
freq
|
flash
|
SRAM
|
EEPROM
|
form factor
|
conn
|
controller
|
svg (Fritzing) |
models |
released
|
voltage
|
pinout
(luisllamas)
|
digital I/O
(PWM)
|
analog inputs
|
bluetooth
|
accel
|
WiFi |
|
8
|
ATmega8
|
16MHz |
8KB
|
|
|
arduino |
|
|
|
Serial
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Single-Sided Serial
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
USB
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Extreme
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
NG
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Severino (S3V3)
|
|
|
|
|
|
|
|
|
|
ATmega168
|
|
16KB
|
|
|
arduino
|
|
|
|
NG+ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Bluetooth |
2007
|
5V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Diecimila |
2007
|
5V |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Diecimilanove |
2008
|
5V |
|
|
|
|
|
|
|
16MHz |
|
|
|
|
|
|
|
Pro
|
|
3.3V / 5V
|
|
|
|
|
|
|
|
|
|
|
|
other
|
|
|
|
Mini |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Nano |
|
|
|
|
|
|
|
|
|
8MHz |
|
|
|
|
|
|
|
LilyPad |
2007
|
2.7-5.5V |
|
|
|
|
|
|
|
ATmega328
|
|
32KB |
|
|
arduino |
|
|
|
Duemilanove
|
|
5V |
|
|
|
|
|
|
|
16MHz |
|
|
|
arduino |
B
|
Atmega16U2 |

|
Uno
|
2010
|
|
pighixxx (fck)
bq (pdf)
|
14 (6)
|
6
|
|
|
|
|
|
|
|
|
|
|
|
|
Bluetooth
|
|
|
|
|
|
x
|
|
|
|
16MHz |
|
|
|
arduino |
|
|
|
Ethernet
|
2011
|
|
|
|
|
|
|
|
|
16MHz |
|
|
|
other
|
-
|
- |
|
Pro (Sparkfun: 5V)
|
|
3.3V / 5V |
|
|
|
|
|
|
|
8MHz /
16MHz
|
32kB
|
2kB
|
1kB
|
18 x 33 mm
|
- |
- |
 |
Pro Mini
(Sparkfun: 3.3V,
5V)
|
|
3.3V / 5V |
pighixxx
(fck)
|
|
|
|
|
|
|
16MHz |
|
2KB
|
1KB
|
(w/wo headers)
18 x 30 mm
|
- |
- |
|
Mini
05
|
|
5V |
pighixxx (fck)
bq (pdf)
|
14 (6) |
8
|
|
|
|
|
16MHz |
32KB |
2KB |
1KB |
(with headers)
18 x 45 mm |
mini
|
|

|
Nano
(replaced by Nano
Every)
|
2008
|
5V |
|
22 (6)
|
8
|
-
|
-
|
|
|
8MHz
|
|
|
|
|
|
|
|
Fio
|
2010
|
3.3V |
|
|
|
|
|
|
|
8MHz |
|
|
|
|
|
|
|
LilyPad
|
|
2.7-5.5V
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LilyPad Simple
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LilyPad Simple Snap
|
|
|
|
|
|
|
|
|
|
ATmega32u4
|
16MHz |
32KB |
|
|
arduino |
micro
|
integrated
|
|
Leonardo
|
2012
|
5V |
pighixxx (fck)
|
|
|
|
|
|
|
|
|
2.5KB
|
1KB
|
(w/wo headers)
18 x 48 mm
|
micro |
integrated |

|
Micro
|
|
5V |
pighixxx (fck)
|
20
|
12
|
|
|
|
|
|
|
|
|
|
|
|
|
LilyPad USB
|
|
|
|
|
|
|
|
|
|
16MHz |
32KB |
|
|
|
|
|
|
Esplora
|
2012
|
5V |
pighixxx (fck)
|
|
|
|
|
|
|
ATmega32u4
Atheros AR9331 |
16MHz
400MHz
|
32KB
16MB
|
|
|
arduino |
|
|
|
Yún |
2013
|
5V
|
|
|
|
|
|
|
|
ATmega4809 |
|
48KB |
6KB
|
256 bytes
|
18 x 45 mm |
micro |
ATSAMD11D14A |
fzpz
|
Nano Every
(replaces Nano)
|
2020 |
5V |
pdf
pdf
|
|
|
|
|
|
|
ATmega1280 |
16MHz |
128KB |
|
|
mega
|
|
|
|
Mega
|
|
5V |
|
|
|
|
|
|
|
ATmega2560
|
16MHz |
256KB |
8KB
|
4KB
|
mega |
B
|
|

|
Mega2560
|
2010
|
5V |
pighixxx (fck)
bq (pdf)
|
54 (15)
|
16
|
|
|
|
|
|
|
|
|
|
|
|
|
Mega2560 Wifi R3 |
|
|
|
|
|
|
|
ESP8266EX |
|
|
16MHz |
256KB |
|
|
mega |
|
|
|
ADK
|
2011
|
5V |
|
|
|
|
|
|
|
32
|
ATSAM3X8E
|
84MHz
|
512KB
|
|
|
mega |
|
|
|
Due
|
2012
|
3.3V |
graynomad (forum)
|
|
|
|
|
|
|
32 |
ATSAMD21G18A |
48MHz |
256KB |
|
|
arduino |
|
|
|
Zero
|
2015
|
3.3V |
|
|
|
|
|
|
|
32 |
Intel Curie
|
32MHz
|
196KB
|
|
|
arduino |
|
|
|
Genuino
101
|
2015
|
3.3V
|
|
|
|
LE
|
6-axis
|
|
|
|
ATSAMW25 |
48MHz |
256KB
|
|
|
|
|
|
|
MKR1000 |
?
|
3.3V |
|
|
|
|
|
|
|
|
RP2040 (Arm Cortex M0+) |
133MHz |
2MB |
264kB |
|
|
|
USB 1.1 |
|
Raspberry
Pi Pico |
|
|
pdf |
|
|
|
|
|
|
bits |
|
freq |
flash |
SRAM |
EEPROM |
form factor |
conn |
controller |
|
models |
released |
voltage |
pinout |
digital I/O
(PWM) |
analog inputs |
bluetooth |
accel |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
preu |
NOTES:
- Starter kit
- Adaptadors USB / USB adapters
|
- Getting
started with Arduino and Genuino products
- Arduino
software
- Program
- Serial monitor (without IDE;
or monitoring a second Arduino)
- IDE
- Connexió USB / USB connection
- afegiu el vostre usuari al grup dialout (grup propietari
de /dev/ttyUSBxx) / add your user to group dialout (group
owner of /dev/ttyUSBxx):
sudo usermod -a -G dialout my_user
newgrp dialout
journalctl -f
- connecteu la placa / connect your board
- NodeMCU
- CH340
de gen. 11 18:52:16 localhost kernel:
usb 1-2: ch341-uart converter now attached to
ttyUSB0
lsusb
- Arduino
- Nano:
ID 0403:6001 Future Technology
Devices International, Ltd FT232 Serial (UART) IC
- NodeMCU
- CH340:
ID 1a86:7523 QinHeng Electronics
HL-340 USB-Serial adapter
- Arduino IDE
- Software
- Instal·lació / Installation
- 2.x
- download nighty
build
arduino-ide_nightly-yyyymmdd_Linux_64bit.AppImage
chmod +x
arduino-ide_nightly-yyyymmdd_Linux_64bit.AppImage
./arduino-ide_nightly-yyyymmdd_Linux_64bit.AppImage
- 1.x
- Problemes / Problems
- Fitxers de configuració
- 2.x
- ~/.arduino15/preferences.txt
- 1.x
- Configuració / Setup
- 2.x
- ~/.arduino15/
- it will be created and populated the first
time that IDE is launched
- ~/.arduinoIDE/
- ~/.config/
- Arduino IDE/
- arduino-ide/
-
boards |
info |
File -> Preferences -> Settings ->
Additional boards manager URLs: |
Tools -> Board
-> Boards Manager...
|
|
|
|
|
will install to:
~/.arduino15/packages/ |
Arduino |
|
|
|
|
ESP8266 |
|
https://arduino.esp8266.com/stable/package_esp8266com_index.json |
|
|
ESP32 |
|
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json |
"esp32 by Espressif Systems" |
esp32/hardware/esp32/2.0.5/libraries/... |
- Ús / Usage (Arduino IDE 2.x)
- File
- Sketchbook (from ~/Arduino/)
- Examples
- Built-in Examples
- Examples for ... (selected board) (from
~/.arduino15/...)
- Examples for ESP32S3 Dev Module
- ...
- WebServer
(~/.arduino15/packages/esp32/hardware/esp32/2.0.6/libraries/WebServer/examples/)
- ...
- Examples from Custom Libraries (from
~/Arduino/libraries/)
- Editor
- Verifica
- ESP32
- Install
board
- Setup
- select "ESP32S3 Dev Module"
- Tools (Arduino
IDE Tools Menu)
- USB CDC On Boot: "Enable"
- Flash Size: "16MB (128Mb)"
- Partition Scheme: "Huge APP (3MB No
OTA/1MB SPIFFS)"
- PSRAM: "OPI PSRAM"
- Install libraries
- TFT_eSPI you should use TFT_eSPI provided by LilyGO.
If you use official library (e.g. version ...)
you will get a black screen. IMPORTANT: be
careful that official library is not installed
as an automatic upgrade.
- Ús / Usage (Arduino IDE 1.x)
- Arrencada / Start
- des de la icona de l'escriptori / from desktop
icon
- prèviament heu d'haver executat install.sh /
previous ./install is required
- from command line
arduino (in
/usr/local/bin/arduino)
- Tools
- Placa: ...
- Port: /dev/ttyUSB0
- Preferències / Preferences
- Temes / Themes
- Utilitza un editor extern / Use an exteral editor
- Es pot fer servir qualsevol editor per a
editar el fitxer (p.ex. emacs),
i l'IDE per a verificar-lo i pujar-lo
- Editor
- Verifica
- Program
- Eines -> Informació de la placa
- Obre (4a icona)
- Basics -> Blink
- crearà el codi font:
- Fitxer -> Sketchbook
- projectes propis, desats a ~/Arduino/ (es pot
canviar a Fitxer->Preferències->Ubicació
del Sketchbook)
- Esbós -> Verifica/Compila
- Esbós -> Puja
- Problemes /
Problems
PORTS
{} / {} => {}
Couldn't find a Board on the selected
port. Check that you have the correct port
selected. If it is correct, try
pressing the board's reset button after
initiating the upload.
- Solució / Solution
- Segurament es tracta d'una placa ATmega32u4 (Micro, Leonardo)
- Mentre apareixen les línies «
PORTS
{} / {} => {} », premeu
dues vegades ràpidament el botó
físic de la placa
- ...
avrdude: jtagmkII_getsync(): sign-on
command: status -1
- Workaround
- pugeu blink. Us apareixerà el
missatge «
Cannot locate
"flash" and "boot" memories in
description », però haurà
funcionat
- ara torneu a pujar l'esbós que
voleu pujar
avrdude: jtagmkII_initialize():
Cannot locate "flash" and "boot" memories
in description
- Només és un avís que es pot ignorar /
Just a warning. Can be safely ignored.
- Problemes / Problems
ModuleNotFoundError: No module named 'serial'
- Solució / Solution
sudo dnf install python3-serial
- Command line
- arduino-cli
arduino-1.8.5/hardware/tools/avr/bin
- See detailed logs when using Upload button on Arduino IDE:
/disc/Baixades/arduino-1.8.5/arduino-builder
\
-compile \
-logger=machine \
-hardware /disc/Baixades/arduino-1.8.5/hardware \
-tools /disc/Baixades/arduino-1.8.5/tools-builder \
-tools /disc/Baixades/arduino-1.8.5/hardware/tools/avr
\
-built-in-libraries
/disc/Baixades/arduino-1.8.5/libraries \
-libraries /home/cesc/Arduino/libraries \
-fqbn=arduino:avr:micro \
-vid-pid=0X2341_0X8037 \
-ide-version=10805 \
-build-path /tmp/arduino_build_595924 \
-warnings=all \
-build-cache /tmp/arduino_cache_334524 \
-prefs=build.warn_data_percentage=75 \
-prefs=runtime.tools.arduinoOTA.path=/disc/Baixades/arduino-1.8.5/hardware/tools/avr
\
-prefs=runtime.tools.avrdude.path=/disc/Baixades/arduino-1.8.5/hardware/tools/avr
\
-prefs=runtime.tools.avr-gcc.path=/disc/Baixades/arduino-1.8.5/hardware/tools/avr
\
-verbose \
/disc/Baixades/arduino-1.8.5/examples/01.Basics/Blink/Blink.ino
/disc/Baixades/arduino-1.8.5/hardware/tools/avr/bin/avrdude \
-C/disc/Baixades/arduino-1.8.5/hardware/tools/avr/etc/avrdude.conf
\
-v \
-patmega32u4 \
-cavr109 \
-P/dev/ttyACM0 \
-b57600 \
-D \
-Uflash:w:/tmp/arduino_build_595924/Blink.ino.hex:i
- Compile (.ino -> .hex) using arduino-builder:
- Upload (.hex file) to Arduino using avrdude:
- AVR
Tutorial: Starting out with avrdude
export ARDUINO_ROOT= /disc/Baixades/arduino-1.8.13
avrdude
-C${ARDUINO_ROOT}/hardware/tools/avr/etc/avrdude.conf
-v -patmega32u4 -cavr109 -P/dev/ttyACM0 -b57600 -D
-Uflash:w:/tmp/arduino_build_595924/Blink.ino.hex:i
- Problemes / Problems
avrdude: butterfly_recv(): programmer is not
responding
- Solució / Solution
- desconnecteu el cable USB; torneu a
connectar-lo
- opció 1 (all software):
export ARDUINO_ROOT= /disc/Baixades/arduino-1.8.13
stty -F /dev/ttyACM0 1200
&& sleep 1 &&
${ARDUINO_ROOT}/hardware/tools/avr/bin/avrdude
-C${ARDUINO_ROOT}/hardware/tools/avr/etc/avrdude.conf
-v -patmega32u4 -cavr109
-P/dev/ttyACM0 -b57600 -D
-Uflash:w:/tmp/arduino_build_979439/Blink.ino.hex:i
- opció 2 (hardware + software):
- premeu ràpidament dues vegades el
botó físic de reset de la placa: la
placa es posarà en mode bootloader
(led de la placa en parpelleig ràpid)
durant uns 8 segons; durant aquest
temps executeu el pas número 2 / quick
double press the physical hardware
reset button: th board will be in
bootloader mode (quick flash of board
led) for about 8 seconds; inside this
period of time, perform the step
number 2
- si durant aquests 8 segons feu
lsusb
ID 2a03:0037 dog
hunter AG Arduino Micro
(bootloader)
${ARDUINO_ROOT}/hardware/tools/avr/bin/avrdude
-C${ARDUINO_ROOT}/hardware/tools/avr/etc/avrdude.conf
-v -patmega32u4 -cavr109
-P/dev/ttyACM0 -b57600 -D
-Uflash:w:/tmp/arduino_build_979439/Blink.ino.hex:i
- Biblioteques / Libraries
- Exemples / Examples
- Starter kit
- The Arduino
playground
- Tutorials
- Foundations
and More
- Introduction
- Language Reference
|
|
|
Functions |
Digital
I/O |
- digitalRead()
- digitalWrite()
- pinMode()
|
Analog
I/O |
- analogRead()
- analogReference()
- analogWrite()
|
Zero,
Due & MKR Family |
- analogReadResolution()
- analogWriteResolution()
|
Advanced
I/O |
- noTone()
- pulseIn()
- pulseInLong()
- shiftIn()
- shiftOut()
- tone()
|
Time |
- delay(ms)
- delayMicroseconds()
- micros()
- overflow every 70 minutes
- millis()
|
Math |
- abs(x)
- constrain(x, a, b)
- map(value, fromLow, fromHigh,
toLow, toHigh)
- max(x, y)
- min(x, y)
- pow(base, exponent)
- sq(x)
- sqrt(x)
|
Trigonometry |
- cos(rad)
- sin(rad)
- tan(rad)
|
Characters |
- isAlpha()
- isAlphaNumeric()
- isAscii()
- isControl()
- isDigit()
- isGraph()
- isHexadecimalDigit()
- ilLowerCase()
- isPrintable()
- isPunct()
- isSpace()
- isUpperCase()
- isWhiteSpace()
|
Random
Numbers |
|
Bits
and Bytes |
- bit()
- bitClear()
- bitRead()
- bitSet()
- bitWrite()
- highByte()
- lowByte()
|
External
Interrupts |
- attachInterrupt()
- detachInterrupt()
|
Interrupts |
- interrupts()
- noInterrupts()
|
Communication |
- Serial
- if(Serial), ..., print(),
println(), write(), ...
- SPI
- Stream
- available(), read(), flush(),
...
- Wire (I2C: SDA, SCL)
- #include <Wire.h>
- begin(), end(), ...
|
USB |
|
Variables |
Constants |
- HIGH | LOW
- INPUT | OUTPUT | INPUT_PULLUP
- LED_BUILTIN
- true | false
- Integer Constants
n = 101; // decimal
n = 0b101; // binary
n = 0101 ;
// octal
n = 0x101 ;
// hexadecimal
- n
= 33u
;
// unsigned
- n
= 100000L
;
// long
- n
= 32767ul
;
// unsigned long
- Floating Point Constants
|
Conversion |
- (insigned int)
- (unsigned long)
- byte()
- char()
- float()
- int()
- long()
- word()
|
Data Types |
- array
- bool
- boolean
- byte
- char
- double
- float
- int
- long
- short
- size_t
- string
- String()
- String stringOne = "Hello
String";
- String stringOne = String(255,
BIN)
- ...
- Functions
- charAt(), compareTo(), ...
- Operators
- unsigned char
- unsigned int
- unsigned long
- void
|
Variable Scope & Qualifiers |
- const
- scope
- static
- visible to only one function
- persist between function calls
- volatile
- load the variable from RAM
instead of storage register
|
Utilities |
- PROGMEM
- store data in flash (program)
memory instead of SRAM
- Arduino
Memory Guide
- F() macro
- Serial.print(F("Write
something on the Serial
Monitor that is stored in
FLASH"));
- sizeof()
|
Structure |
Sketch (C++) |
|
Control Structure |
- break
- continue
- do...while
- else
- for (initialisation; condition;
increment)
- goto
- if
- return
- switch...case
- while
|
Furher Syntax |
- #define
- #include
- #include <LibraryFile.h>
- AVR C libraries: avr-libc
- other installed libraries
- #include "LocalFile.h"
- files in the sketch folder
- /**/
- //
- ;
- {}
|
Arithmetic Operations |
|
Comparison Operators |
|
Boolean Operators |
|
Pointer Access Operators |
- & (the address of ...)
- * (the value of address ...)
|
Bitwise Operators |
- & (AND)
- << (left shift)
- >> (right shift)
- ^ (XOR)
- | (OR)
- ~ (NOT)
|
Compound Operators |
- %=
- &=
- *=
- ++
- x++; // increment x by one and
returns the old value of x
- ++x; // increment x by one and
returns the new value of x
- +=
- --
- x--; // decrement x by one and
returns the old value of x
- --x; // decrement x by one and
returns the new value of x
- -=
- /=
- ^=
- |=
|
- Built-In
Examples
- Examples
from Libraries
- Tutorials
on Arduino Project Hub
- Tutoriales
y proyectos con Arduino (Naylamp)
- Pantalles / Screens
- LCD IIC (LCM1602)
- Adafruit
(Pantalla
OLED 1.3' SH1106 128x64)
- u8g2
- Hardware SPI (use specific connections:
D13-SCLK--CLK, D11-MOSI--MOSI)
- U8G2_SH1106_128X64_NONAME_1_4W_HW_SPI(rotation,
cs, dc [, reset])
- U8G2_SH1106_128X64_NONAME_2_4W_HW_SPI(rotation,
cs, dc [, reset])
- U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI(rotation,
cs, dc [, reset])
- Software SPI (use specified pins: clock, data)
- U8G2_SH1106_128X64_NONAME_1_4W_SW_SPI(rotation,
clock, data, cs, dc [, reset])
- U8G2_SH1106_128X64_NONAME_2_4W_SW_SPI(rotation,
clock, data, cs, dc [, reset])
- U8G2_SH1106_128X64_NONAME_F_4W_SW_SPI(rotation,
clock, data, cs, dc [, reset])
- Modes
-
mode
|
pros
|
cons
|
constructor
|
example
|
page
buffer (picture loop)
|
|
|
1
|
void
setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.firstPage();
do {
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,24,"Hello World!");
} while ( u8g2.nextPage() );
}
|
u8x8
character
|
|
- no graphics
- no all displays
|
2
|
void
setup(void) {
u8x8.begin();
}
void loop(void) {
u8x8.setFont(u8x8_font_chroma48medium8_r);
u8x8.drawString(0,1,"Hello
World!");
}
|
full
buffer
|
|
|
F
|
void
setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,20,"Hello
World!");
u8g2.sendBuffer();
}
|
- Example
- Connections (
4W_HW_SPI )
-
OLED
|
Arduino
|
GND
|
GND
|
VCC
|
5V
|
CLK
|
D13
|
MOSI
|
D11
|
RES
|
D8
|
DC
|
D9
|
CS
|
D10
|
- IDE: Examples / U8g2
- uncomment:
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI
u8g2(U8G2_R0, /* cs=*/ 10, /*
dc=*/ 9, /* reset=*/ 8);
- Basic program
#include
<Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>
// free choice
#define PIN_CS 10
#define PIN_DC 9
#define PIN_RESET 8
// HW => CLK=D13, MOSI=D11
U8G2_SH1106_128X64_NONAME_F_4W_HW_SPI
u8g2(U8G2_R0, PIN_CS, PIN_DC,
PIN_RESET);
void setup(void) {
u8g2.begin();
}
void loop(void) {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_ncenB14_tr);
u8g2.drawStr(0,20,"Bon dia!");
u8g2.drawCircle(20, 40, 10);
u8g2.sendBuffer();
}
- Interfacing
& displaying a custom graphic on an
0.96″ I2C OLED with Arduino
- u8glib
|