Arduino

Index

General

Maquinari / Hardware

Alimentació / Power supply

  • (Locoduino)



  • Uno
    Mega
    Nano
    Pro Mini
    (5V or 3.3V model)
    input
    unregulated
    input for onboard regulator
    jack 2.1 or "Vin": 7-12V DC jack 2.1 or "Vin": 7-12V DC "VIN" (pin 30): 6-20V "RAW": 7-12V DC
    USB

    B
    B
    mini-B
    -
    regulated 5V (3.3V in certain models)

    -
    -
    "5V" (pin 27): 5V
    "VCC": 5V (3.3V)
    output
    5V
    output of onboard regulator
    "5V"
    "5V" "5V" (pin 27): 5V
    3.3V 50mA
    output of onboard regulator "3.3V"
    "3.3V" 3.3V (pin 17)

    IOREF
    voltage reference with which the microcontroller operates
    x
    "IOREF"
    REF (pin 16)


Interfícies / Interfaces

Desenvolupament / Development

  • Getting started with Arduino and Genuino products
  • Arduino software
  • Program
  • IDE
    • Instal·lació / Installation
    • Ús / Usage
      • 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
          • cd arduino-1.8.5
          • ./arduino
      • Program
        • Eines -> Informació de la placa
        • Nou programa
          • Blink
          • crearà el codi font:
            • Blink.ino
        • Esbós -> Verifica/Compila
          • crearà
            • Blink.ino.hex
            • ...
        • Esbós -> Puja
          • ...
      • Exemples / Examples
        • Starter kit
        • Tutorials
        • 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)
                  • all graphics
                  • llittle RAM
                  • slow
                  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
                  • fast
                  • no RAM
                  • 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
                  • fast
                  • all graphics
                  • lot of RAM
                  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
      • Biblioteques / Libraries
  • 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:
      • arduino-builder ...
    • Upload (.hex file) to Arduino using avrdude:
      • AVR Tutorial: Starting out with avrdude
      • 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
      • Problemes / Problems
        • avrdude: butterfly_recv(): programmer is not responding
          • Solució / Solution
              • desconnecteu el cable USB; torneu a connectar-lo
              • opció 1 (all software):
                • stty -F /dev/ttyACM0 1200 && sleep 1 && /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_979439/Blink.ino.hex:i
              • opció 2 (hardware + software):
                1. premeu ràpidament dues vegades el botó físic de reset de la placa: la palca es posarà en mode bootloader (led de la placa en parpelleig ràpid) durant uns 8 segons ; durant aquest temps executeu el pas següent / 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 next acion
                2. /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_979439/Blink.ino.hex:i
        • ...
          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
            • Mentre apareixen les línies «PORTS {} / {} => {}», premeu dues vegades ràpidament el botó físic de la placa

DCC

  • ...

http://www.francescpinyol.cat/arduino.html
Primera versió: / First version: 29.XII.2017
Darrera modificació: 8 de desembre de 2018 / Last update: 8th December 2018

Valid HTML 4.01!

Cap a casa / Back home