Setting up the Arduino Environments
This guide details how prepare your computer for uploading firmware to the OpenEnergyMonitor hardware modules after you've assembled them. The hardware modules are all based on an open source prototyping platform called Arduino.
Arduino is one of the projects that really kickstarted the open hardware movement. The simplicity of programming and uploading code to the ATMEL microcontroller made possible by the Arduino hardware and Arduino IDE (Integrated Development Environment) made electronics accessible to a much wider audience, from programmers to artists. The decision to open source it inspired and enabled others, including us, to do so in turn.
1) Install the Arduino IDE
If your OS is Windows, there's a dedicated guide here: Installing the Arduino IDE – Windows 8.1 & 10
The "Get Started" section of the Arduino website has a wealth of information on installing the IDE on most operating systems: http://arduino.cc/en/Guide/HomePage. Be sure to read that before continuing.
USB to UART cable drivers
If you're using the cable sold through the OpenEnergyMonitor Shop, the drivers for Windows and Mac can be downloaded here: http://www.silabs.com/products/mcu/Pages/USBtoUARTBridgeVCPDrivers.aspx .
No drivers are needed for Linux.
Make sure you restart the Arduino IDE after installing the drivers.
Set the sketchbook location
When you first start the IDE, you may be asked if you would like it to create a sketchbook. Arduino calls the programs you write sketches and the sketchbook is the default folder that holds them. The sketchbook will likely be located in your home directory on Linux, and your "My Documents" folder on Windows.
If you need to check or change the location e.g. moving it to your desktop for easy access, go to File > Preferences and set the location. When you click OK at this point, the IDE will automatically create a libraries folder in your sketchbook if one does not already exist,
2) Installing the required software libraries and firmware
There are two different ways of installing the required libraries and firmware. The first is the familiar method of using your internet browser to download the required files, The second, which may seem complicated, will save you a great deal of time, is using a software tool called git. Once you are familiar with git, it's easy to keep the software up to date.
Installing Libraries and Firmware with your browser
Installing Libraries and Firmware using git
Introduction to git: A gentle guide to Git and GitHub
To update any of the libraries or downloaded firmware with git, execute the command git pull origin master in the library or firmware folder, via a terminal session.
Git clients for windows and mac: http://git-scm.com/downloads
3) Uploading code to your hardware
Board and Serial Port
Make sure the Board is set to Arduino UNO and that tools Serial Port is set to the serial port that appeared when you connected your emonTx.
Upload the code
Click on the 'arrow pointing to the right' button.
On Linux, if Serial Port is disabled, make sure you have permissions to access serial ports. On Ubuntu 12.04 I had to add my user to the "dialout" group.
There is a wealth of information online regarding installing Ubuntu. A Google search of: Arduino + your OS + version may help you resolve problems.
4) Installation summary
You should now have the Arduino IDE installed on your computer (version 1.0.3 or later) and a folder called sketchbook with the following items in it:
If they are all there, restart the Arduino IDE, then you'll be ready to upload code to the hardware modules.