Installing the Arduino Libraries – macOS

by Jon Murphy


Before you install the libraries, it would be a good idea to think about how you will organise your Emon data. When you installed the Arduino IDE, it created a folder Arduino and beneath it a folder libraries in your Home directory. If you’re happy with that, then you should install the libraries in there.

However, I prefer to have a folder that contains everything related to OpenEnergyMonitor. That folder, which I've called OEM is at the top level in my personal area, i.e. Home/OEM. Beneath that I have folders for Drawings, Manuals & Leaflets, and importantly that which concerns us here, Software. The Software folder contains sub-folders that will eventually contain more sub-folders for sketches for the various modules, and a libraries folder for the Arduino Libraries. This is the structure:

 Home
  │
  └── OEM
       │
       └─── Drawings
       └─── Manuals
       └─── Software
               │
               └─── emonPi
               └─── emonTH
               └─── emonTx
               └─── libraries

It is most important that the libraries folder is at the same level in the hierarchy as the folders, or some ancestor of the folders, that will eventually contain the sketches. The parent of libraries, in this example called Software is what the Arduino documentation and the IDE refers to as the Sketchbook. You can choose whatever name you want for this folder.

Important: This is NOT the same 'libraries' folder that is part of the Arduino IDE. If you put the OEM libraries in there, they will work but when you update the Arduino IDE, by default it installs in a completely new folder and you will have to move or copy these libraries. For that reason it is not recommended.

Downloading the Libraries

Many libraries are required, this is the full list:

Go to each of the websites in turn. Download the zip file for each to your usual place – on GitHub the button is on the right-hand side. Click Clone or Download followed by Download ZIP:

windows-lib-2

Installing the Libraries

When you have downloaded all the files, go to your download location and from there you need to extract the contents of each Zip file in turn: Double-click on the zip file, a window will open showing the contents. Extract that folder into the libraries folder.

Renaming the Libraries

The Arduino IDE does not allow hyphens '-' in the library folder names.

macos-2

Therefore you must rename the folders to the names below. You should end up with this:

macos-3

Note: If you wish, you can now delete the zip files that you downloaded.

Check the Libraries

If your Arduino IDE is running, close all open windows and shut it down completely. Start (or restart) the IDE. First you must tell the IDE where your Sketchbook is located. Click on File > Preferences and at the top for Sketchbook location browse to and select your Software folder, then dismiss the Preferences window with OK. Click on Sketch > Include Library and you should see the list of libraries. The ones you just installed should be listed under Contributed libraries.

Note: The IDE only checks the libraries at start-up. Each time you change or add a library, you must completely shut down and restart the IDE.