Introduction: AquaEco

Back Story

It is always a challenge with pets especially when you are going for a long trip. I have an aquarium at home and it needs maintenance every other week (at a minimum). By the time I was back from my one month India trip, my aquarium was a mess, the water level dropped by half, there was algae growth because the light was left on and the only thing that saved my fish was the automatic feeder I bought before I left. It took a complete weekend to get it cleaned and I realized I needed to fix this.

I needed something to maintain and monitor my Aquarium Eco-system with minimal supervision, and so the idea behind AquaEco was born.


The basic requirements for a planted aquarium to be self-sustainable are

1. Automatic feeder (based on the fish types and tank size, this needs to be configurable)

2. Temperature control (based on fish type)

3. Controlling the lighting (especially for planted aquarium)

4. Controlling the Water level

5. Water filtration

6. CO2, Ph, Ammonia levels etc.

With AquaEco, we intend to make the life easier for an Aquarium enthusiast. We plan to handle the first 4 items listed as part of the first prototype and will add more info as we need more sensors and plug them in as needed.

Step 1: What You Need?

1. Intel Edison Board

2. IoT Analytics toolkit. ( website registration)

3. Extension Board to get easy access to the ports

4. Temperature sensor

5. Four channel relay module (

6. Servo to control the feeder (

7. Arduino or Intel IoT Eclipse environment

Step 2: Getting Hardware Ready

1. Plug the Temperature sensor in the extension board into an Analog Pin, which you would configure as input in software. On the board look for A0~A4 (we used A0)

2. Plug in the Servo into another analog pin (there are other servos which run with digital PWM pins, it depends on the servo you pick). We chose to plug it in A3.

3. Each channel of the 4 channel relay can be used to control any 120V high-current AC devices via the 5V GPIO outputs coming from the Intel Galileo board. We used digital pin 3 (D3) to control the light control. Look in below section for the instructions on how this is hooked up.

Step 3: Setting Up the Relay

The relay will be used to control the lights, heater, water pump and filtration unit independently. The image above shows how the wiring needs to be done. A specific digital gpio is used to control the power to each of these units.

The second picture shows how the we modified a cheap power socket to control the lighting.

Step 4: Software

Instead of explaining the entire code, we intend to focus on the key sw which controls the main hardware units used in this project.

1. Temperature monitoring

Below is a simple function from the project which reads the temperature from the sensor and converts it to celcius. The intel MRAA library is used to interact with the analog io.

float ReadTemperature(mraa::Aio *t)

float resistance=0.0f;

float temperature=0.0f;

int a=t->read();

const int B=3975;

resistance=(float)(1023-a)*10000/a; //get the resistance of the sensor;

temperature=1/(log(resistance/10000)/B+1/298.15)-273.15;//convert to temperature via datasheet ;


return temperature;


2. Servo control

Below is a code snippet in which we use the Intel UPM module to control the servo.

g_servo = new upm::ES08A(3);
int angle = 20;

int cnt=0;

// This code a slow and steady servo motion, while feeding the fish.

// The angles depend on the unit and the orientation of the feeder so change these as needed.

if (g_servo)

while (angle < 180)


angle = angle==0?angle=90:0;


//angle += 170;





3. GPIO init for relay

relGpio = new mraa::Gpio(3,true,false);
if (!relGpio)


printf("Failed to create digital pin\n");

return -1;


response = relGpio->dir(mraa::DIR_OUT);

if (response != MRAA_SUCCESS)

mraa_result_print((mraa_result_t) MRAA_SUCCESS);

// The actual relay switch turn on/off is done by the below code:

relGpio->write(relay_switch); // 0 = relay_switch_on, 1 = relay_switch_off

Step 5: Connecting With Intel Analytics

Intel analytics provide a simple easy to upload and let the users monitor the data. In case of this project we uploaded the temperature, the water on/off, light on/off events, fish-feeding done. This way the user can have a real time updates of all the information about the events happening with his/her aquarium.

Once connected with the Intel analytics agent, the code to update the data is a very simple single line. For eg. this is the code to send the temperature data

iotkit.send("temp", temp);

More information about this can be found in here...

Step 6: Credits

Thanks to everyone at Intel IoT @ Mountain View for helping out on this project during the Hackathon, we had a blast!

The code for this project has been attached as well.

The next steps that we are planning for are to add remote management of the events in addition to remote monitoring and adding support to more sensors (like Ph balance, Ammonia monitoring etc)

Team Members:

Subhash Gutti

Harish Gowda

Uma Reddy