Remote Terminal Units (RTUs) are the low-level work horses of the HAPI platform. They communicate with sensors and pass the information up the stack to users and higher level computers. RTUs also take commands from higher levels and convert them into real-world actions such as turning pumps and switching off lights.
While many embedded micro-controllers can fill this roll, the HAPI team has selected the Arduino Mega 2560 as the initial platform for low-level operations.

The firmware code for HAPI v2.1 RTUs includes support for the many common sensors and controls, as well as default state management.

Sensor Support

  • Facility-level Environment
    • DHT-22 Digital temperature and humidity sensors
    • Low-cost Thermistors (air temperature)
    • Low-cost Photo-resistors (light levels)
  • Reservoir Conditions
    • pH Probes
    • Digital waterproof temperature sensors
    • Float Switches

Many more types of sensors can be easily integrated with the HAPI platform.


The v2.1 firmware allocates 20 digital I/O pins for controlling assets such as lights, water pumps, air pumps, dosing pumps and other electrical equipment. Asset control is achieved through using these dedicated pins to manipulate electrical relays on both AC and DC circuits.

Default State Management

Assets that are controlled by an RTU can be configured to default to a user-defined state when the RTU powers on. This means that in the case of a power outage, when the RTU powers up lights and pumps that need to be on will be turned on while assets that should activate on power-up will remain off.

Network Communications

Support for RTU communications in v2.1 is limited to Ethernet over copper wire (e.g. CAT6). Other communications protocols have been developed and implemented over the last couple of years. However, in order to keep this version of the platform as simple, low-cost and reliable as possible, we've settled on only Ethernet at this time. Subsequent versions of the stack will incorporate more communications approaches based on user-input, technological advances and developer decisions.

Idle Mode

There are times when a user wants to ensure that an RTU will not turn assets on (or off) for a certain period of time. Maintenance sessions are a good example, in that you wouldn't want other users or computers telling the RTU to turn on a water pump while you are working on it. At the same time, you may not necessarily want to shutdown an RTU just to swap a pump or change some light bulbs.

For such cases, the RTU supports an Idle Mode. When an RTU is put into Idle Mode, it will not execute any commands that change the state of an output pin. Nor can an RTU be remotely reset while in Idle Mode. However, users and programs can still query the RTU for status and sensor data.

The HAPI v2.1 Command Language

The HAPI platform boasts a small, robust command language that can be employed by a user or another computer to get make an RTU perform certain tasks.
aoc – Analog Output Control
Description: Controls a pulse-width modulated output
pin: 3 digits representing the pin to control
value: 3 digits representing the value to write as output
Example: aoc009118 Sets the pwm output value of pin 9 to 118

  • doc – Digital Output Control
    Description: Controls a digital output
    pin: 3 digits representing the pin to control
    value: 1 digit representing the value to write as output
    time (optional): 3 digits representing the time (in sec.) to maintain the pin state

    • doc0121 Sets the output value of pin 12 to 1
    • doc0070100 Sets pin 7 LOW for 100 seconds
  • gpm – Get Pin Modes
    Description: Gets the pin modes specified on the RTU
    Example: gpm
  • idl – Idle Mode
    Description: Puts the RTU in Idle Mode (not implemented)
    Example: idl
  • res – reset
    Description: Resets the RTU
    Example: res
  • sta – status
    Description: Returns network and memory information
    Example: sta

Education and Support


HAPI (Hydro­ponic Automa­tion Plat­form Ini­tia­tive) is an open-source project of Maya Culpa, LLC.