Microcontroller projects

Arduino tips and tricks

last updated: 10/05/19

Install Arduino portable on a USB Stick

Download the latest Arduino software from Arduino.cc and extract the compressed folder. You can do this on a USB Stick. Now switch to the Arduino folder and create a folder with the name portable inside the Arduino folder. A portable installation allows to carry around your personal set of sketches, cores and libraries, to be used on any computer without affecting it with your files (see here).


Download the newest Teensyduino version from pjrc.com and follow the instructions on this page to install it.

ESP32, ESP8266 and ATMegas

To be able to use Arduino with ESP32 we add the ESP32 framework simply by adding a text line to to "File > Preferences > Additional Boards Manager URLs:". Enter the string


into Additional Board Manager URLs: field. You can add multiple URLs, separating them with commas. So we also add the strings




to be able to use ESP8266 and ATMega (m16, m32, m64, m128) devices.

Now open Boards Manager from Tools > Board: > Boards Manager... and scroll down. Install ESP32 and ESP8266 and Mightycore platform.

After the installation we select our Board from Tools > Board).

UDEV rules

In Linux we need to set up the udev rules to access our devices without being root. The text file name begins with a number (01-99) defining the ranking and ends with .rules (e.g. 15-lolin_wemos.rules). It has to be copied to /etc/udev/rules.d. Reboot your computer after changing rules.

Here a udev file for several mc's: (14-my_mc_rules.rules)

    # Teensy by Paul https://www.pjrc.com/teensy/49-teensy.rules
    ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{ID_MM_DEVICE_IGNORE}="1"
    ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", ENV{MTP_NO_PROBE}="1"
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", MODE:="0666"
    KERNEL=="ttyACM*", ATTRS{idVendor}=="16c0", ATTRS{idProduct}=="04[789]?", MODE:="0666"
    # FTDI 232
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", MODE="0666"
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE="0666"
    # LOLIN Wemos D1 mini, ESP32 (QinHeng Electronics HL-340 USB-Serial adapter)
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", GROUP="plugdev", MODE="0666"
    # LOLIN D1 mini pro
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", GROUP="plugdev", MODE="0666"
    # atmega32u4 DFU
    SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ff4", GROUP="plugdev", MODE="0660"
    # at90usb1286/1287 AVR DFU
    SUBSYSTEM=="usb", ATTR{idVendor}=="03eb", ATTR{idProduct}=="2ffb", GROUP="plugdev", MODE="0660"
    # Atmel weigu_vendor (AT90usbkey Saleski)
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="0001", GROUP="plugdev", MODE="0666"
    SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="0002", GROUP="plugdev", MODE="0666"

If you have a board with a new chip, get the idVendor and the idProduct with the command:


and expand the file.


In Arduino the C or C++ code files are named "sketch" have the extension .ino and must be contained in a folder with the same name (without .ino).

You find your sketches in the folder portable/sketchbook in your Arduino folder. If you open a new sketch (xxx.ino) without folder (File > Open), Arduino will create the folder for you.

After opening a sketch (File > Open, File > Sketchbook or File > Examples) we click on the Arduino Upload button arrow to the right to compile and upload the sketch.

Hex and list files

In Linux, the hex file can be found in the /tmp directory. If compiling for Teensy we find a .lst file containing the assembler code. For the other Arduino boards this file is missing. We can get it from the .elf file with the following command:

    avr-objdump -S Blink.ino.elf > list.txt


We often need external libraries for our sensors. To install a library in Arduino is quite simple.

In newer Arduino versions click on : Tools > Manage Libraries... (older versions: sketch > Iclude Library > Manage Libraries...). In the search-field you type the name of your sensor or library. Often you can chose between more libraries. After installing the library look at the library examples in File > Examples.

To install a library that is not found with Arduino search, we download the library as .zip-file (e.g. github) and install it with Sketch > Include Library > Add .ZIP Library....