Arduino Based Timer for Aquaponics Pump

Introduction: Arduino Based Timer for Aquaponics Pump

This is a small instructable on Arduino based Timer for Aquaponics Pump.

I have a small aquaponics system setup indoors with continuous flow. The pump is running continuously and I wanted to make a timer which will make the pump run for a certain amount of time and then turn it off for equal amount of time and repeat this.

After 2-3 days of writing code and countless work bench test I was able to make exactly what was required for me. The timer is programmable from 1 Minute to 24 Hours. Please watch the video to see the working of the timer.

Hopefully this will be helpful to others too who are looking for similar projects. This instructable covers only the code and bench test. Making into a complete working device will be covered later in another instructable.

Disclaimer: I have tested the code and found it to be OK. But that doesn't mean it is fool proof. Bugs could be there. I take no responsibility to any damage that can arise from using this project / code. Use at your own risk.

Step 1: Materials Required

1. Arduino UNO

2. 16X2 i2c LCD

3. Micro Switches

4. LED

5. Resistor

6. Dupont Cables

7. Breadboard

Step 2: Set Up

The code was tested on work bench using BreadBoard and Arduino UNO board. My plan is to use Arduino Pro Mini when making into complete product with enclosure.

The connection is not so difficult. Please see below. I have used a LED in place of Relay.

Arduino Pin 13 <----------------> Switch (START)

Arduino Pin 12 <----------------> Switch (STOP)

Arduino Pin 11 <-----------------> Switch (SET)

Arduino Pin 10 <-----------------> Switch (INCREMENT)

Arduino Pin 9 <------------------> Switch (DECREMENT)

Arduino Pin 8 <------------------> + ve LED

Arduino GND <-------------------> -ve LED ( and the second terminals of all the switches)

Arduino +5V <-------------------> VCC of LCD

Arduino GND <-------------------> GND of LCD

Arduino Pin A4 <------------------> SDA of LCD

Arduino Pin A5 <------------------> SCL of LCD

Step 3: Code & Working

The Arduino code is as attached.

A function (count) uses SimpleTimer to wait for 1 second and then increment a variable (second) until it reaches 60, then reset the variable (second) and increment another variable (minutes). The minutes variable is increment until it reaches 60, then resets and increment the hours variable.

The programmed time is compared against this and once reached the timer is reset and the relay output is toggled. Then the timer starts again and continues until it reaches the programmed time and then resets and toggles the relay output.


SET button is used to program the desired time.

INC button is used to increment the time

DEC button is used to decrement the time.

START button is used to START the timer

STOP button is used to STOP the timer

Watch the video to see the working of the timer.

While setting the time the function of INC/DEC button cycles through, i.e if you press DEC at 00:00 it becomes 24:59 and vice versa.

The code also incorporates the functionality of storing the programmed time into EEPROM, so even if the power is disconnected the the programmed time remains saved. And when the power is restored you can directly press the START button and the timer will start counting to the previously SET time.

Step 4: Next Step

Next Step will be to make this into standalone working product. This will be covered later in another instructable.

Hope you liked my instructable and I am open to all sorts of comments.

Thank you for reading through this article.

Be the First to Share


    • Microcontroller Contest

      Microcontroller Contest
    • Halloween Contest

      Halloween Contest
    • Fandom Contest

      Fandom Contest