1.x compiling

Setting up environment:

I use Arduino IDE. But I use external editor, no matter for Arduino IDE. 
Currently I have switched to 1.8.5.  It is good practice to create separate environment just for Gateway to separate it from your other projects. Gateway uses sometime slightly modified versions of standard libraries, like Ethernet.

To sum up:
  1. Download Arduino IDE. Latest as of now is 1.8.5. 
  2. In Arduino IDE open File->Preferences, and change "Sketchbook location"  to some unique folder just for OHS.
  3. Download from my GitHub gateway and libraries. Extract them to your newly created folder from step 2.
  4. Gateway uses ATmega1284p, that is not included in standard Arduino Boards Manager. The instruction how to add the board into your Arduino IDE can be found here. Basically just download the zip, and extract its content in /arduino-1.8.5//hardware folder. Use following board to compile sketch "Mighty 1284p 16MHz using Optiboot". 
  5. Gateway uses different Ethernet library, delete the original Ethernet folder from /arduino-1.8.5/libraries and from /arduino-1.8.5/hardware/mighty-1284p/avr/libraries. We will be using only the one found in my libraries you've downloaded.
  6. Open /arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp and change following line:
    #if defined(HAVE_HWSERIAL0)
    #if defined(_HAVE_HWSERIAL0)
    This is needed because Serial0 is somehow hard-coded into core and we need private library for GSM on port Serial0.

Now all is needed to open main_board.ino and try to compile it. All assembled boards come with Arduino bootloader and with latest firmware. They are also fully tested. When you plug a FTDI USB to serial programmer into gateway you can upload your changes directly to board.

Getting sources:

  • Gateway, all libraries required are included. Be aware that I have sometimes included small change in common libraries like Ethernet or Webserver, and all those are required to compile the sketch.
  • Libraries 
  • Code for nodes is also stored on GitHub as single sketches depending on hardware version and accompanied fetaures.


  1. Hello Adam,

    Thanks for this update. I found issue in point 6 in my environment. The library HardwareSerial0.cpp is in directory arduino\hardware\arduino\avr\cores\arduino only, not in mighty-1284p subdirectory. Is it fault in my installation, or misstyping in your guide?


  2. Hello Filip,

    my mistake, copy-paste error :). Yes should be /arduino-1.8.5/hardware/arduino/avr/cores/arduino/HardwareSerial0.cpp