Moteino-setup

From wikipost

Starting to use some Moteinos always left me a bit searching for a clear and simple guide on how to set up the boards.txt and libraries in the Arduino IDE.

We distinguish two specific features of the Arduino IDE:

> use custom boards (Moteino, Anarduino, etc..)

- Having a way to easily select a custom board will allow you to program these boards without having to worry about which microcontroller is on the board or how they are wired.

- In order to program a sketch to a custom board you select the corresponding board in the Arduino IDE menu at: Tools - Boards -

- custom boards need to be added to the 'hardware' folder (either in the user's sketchbook's or arduino's program's 'hardware' folder)


> use custom libraries (Dallas, LCD, etc..)

- To add sensors or functions to your sketch you can load specific libraries. These will have the proper protocols coded in and work seamlessly with Arduino code. Libraries usually don't care on which board they run.

- In order to make use of a custom library you reference to them in your code with the '#include' statement

- custom libraries need to be added to the 'libraries' folder (either in the user's sketchbook's or arduino's program's 'libraries' folder)


To add support for Moteino in the Arduino IDE we need to add both 'hardware' and 'libraries'.

  • the 'hardware' (Moteino Core files) will add the Moteino and Moteino MEGA boards to the list of selectable boards
  • the 'libaries' (RFM69 and SPIFlash) will allow the sketches to communicate with the HopeRF Radio Module (and optional EEPROM module for OTA programming)



There are two ways to add the 'hardware' to Arduino.

  • copy files manually into the Arduino hardware folder
  • with the new Arduino Board Manager (available in version 1.6.x and up)



Manual Method (boards and libraries)

Step 1 - Install the Moteino Core files into the Arduino installation folder

  • download and unzip the core file:

Moteino Core: File:Moteino 1.0.6.zip (local copy)

Github source: https://github.com/LowPowerLab/Moteino/tree/master/MEGA/Core

Enter the unzipped 'Moteino' directory and:

  • rename the 'avr' directory to 'moteino'
  • move the newly named 'moteino' directory into ~/sketchbook/hardware/



Step 2 - Install the RFM69, LowPower and SPIFlash libraries

  • download and unzip these three files:

RFM69: File:RFM69-master.zip (local copy)

Github source: https://github.com/LowPowerLab/RFM69


LowPower: File:LowPower-master.zip (local copy)

Github source: https://github.com/LowPowerLab/LowPower


SPIFlash: File:SPIFlash-master.zip (local copy)

Github source: https://github.com/LowPowerLab/SPIFlash


  • after unzipping, rename the RFM69-master folder to just 'RFM69'
  • do the same with the unzipped LowPower-master and SPIFlash-master folders



Step 3 - check for proper workings

Start up the Arduino IDE and confirm that:

  • the Moteino and Moteino MEGA boards can be selected from the list of boards
  • in the Libraries menu you can see the RFM69, Low-Power and SPIFlash libraries



Easy Method (boards only)

Step 1 - Install the Moteino Core files into the Arduino installation folder

There's actually only one step to this..

  • Open the Arduino IDE and from the menu select File - Preferences
  • Click OK and in the menu now go to: Tools - Board - Board Manager
  • wait until the download has completed and from the list select the 'Moteino' entry and click 'Install'
  • once the installation has completed you can now select the Moteino boards from the boards menu



That's it!


One more thing for actually using the Moteinos:

The RFM69 library is suitable for both the 20mW RFM69(C)W and the 100mW RFM69H(C)W modules (The 'C' only indicates Compatibility with the older RFM12B footprint, functionality wise they are the same).

If you have the higher-powered 100mW version (RFM69HCW or RFM69HW) make sure to include the IS_RFM69HW define in your code:

 #define IS_RFM69HW    //uncomment only for RFM69HW! Remove/comment if you have RFM69W!


The Moteino demo code also clearly indicates this.