Microcontroller projects

Arduino tips and tricks

last updated: 22/09/18

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).

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

https://dl.espressif.com/dl/package_esp32_dev_index.json

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

http://arduino.esp8266.com/stable/package_esp8266com_index.json

and

https://mcudude.github.io/MightyCore/package_MCUdude_MightyCore_index.json

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.

To use later Teensy Boards we download Teensyduino from the pjrc homepage and follow the instructions on this page to install it.

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

Programming

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.

Libraries

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....