RobotGeek TeamWade Filewich
Published © CC0

Aquarium Auto Refill With Arduino

This Arduino pump tutorial shows a simple example of how to use a float switch and RobotGeek pumping station to refill a reservoir.

BeginnerShowcase (no instructions)1 hour16,196
Aquarium Auto Refill With Arduino

Things used in this project

Hardware components

RobotGeek Pumping Station
×1
Seeed Studio Water Level Switch
×1
RobotGeek 3.5mm Silicone Tubing
×1
RobotGeek Small Workbench
×1
RobotGeek Geekduino
RobotGeek Geekduino
×1
Arduino UNO
Arduino UNO
OPTION: Can be used in place of Geekduino
×1
RobotGeek Sensor Shield
RobotGeek Sensor Shield
×1
RobotGeek Duino Mount
×1
RobotGeek 300mm 3-pin Sensor Cable 10 pack
×1
RobotGeek 3-Pin Coupler - 25 Pack
×1
RobotGeek LED Driver
RobotGeek LED Driver
×1
RobotGeek DC Squid Cable
×1
RobotGeek 6V/2A Power Supply
×1

Software apps and online services

Arduino IDE
Arduino IDE

Story

Read more

Schematics

Wiring Aquarium Auto Refill

Wiring Aquarium Auto Refill

Code

Code snippet #1

Plain text
/***********************************************************************************
 * Aquarium Pump Refil Demo
 *                       _______________
 *                      |  ___________  |
 * _____________________| |____       | |
 * |  U       <><             |       | |
 * |                          |       | |
 * | ><>          <><         |      _|_|_
 * |   <><                    |      |   |
 * |__________________________|      |___|
 *
 *  This demo will show you how to control a RobotGeek Pumping Station (or any other
 *  motor/pump via relay) based on input from a float switch. This will allow you to
 *  build an automated Aqurium refil pump, refilling your aquarium whenever it gets 
 *  to low.
 *
 *  Wiring
 *  Pin 2 - Float Switch
 *  Pin 4 - RobotGeek Pushbutton relay/pumping station 1
 *  Pin 7 - RobotGeek LED 
 *
 *  Control Behavior:
 *    If the float switch is not floating (i.e. empty tank) then turn on the pump and led
 *    If the float switch is floating (i.e. full tank) turn off the pump and LED
 *
 *  External Resources
 *
 ***********************************************************************************/
//define the input/output pins
#define FLOAT_SWITCH_PIN 2
#define PUMP_1_PIN 4
#define LED_PIN 7

//setup runs once
void setup()
{
  //setup input pins for float switch 
  //Too use a bare switch with no external pullup resistor, set the pin mode to INPUT_PULLUP to use internal pull resistors. This will invert the standard high/low behavior
  pinMode(FLOAT_SWITCH_PIN, INPUT_PULLUP);
  
  //setup output pins for relays/pumping station and LED board
  pinMode(PUMP_1_PIN, OUTPUT);
  pinMode(LED_PIN, OUTPUT);
  
}

//loop() runs indefinitely 
void loop()
{
  //check to see the state of the float switch. These states are assuming the pin is using an internal pullup resistor. 
  // LOW corresdponds to the float switch being at its lowest point (i.e. low water)
  if(digitalRead(FLOAT_SWITCH_PIN) == LOW)
  {
     digitalWrite(PUMP_1_PIN, HIGH); //turn on the pump
     digitalWrite(LED_PIN, HIGH);    //turn on the LED
  }
  
  //otherwise the float switch is HIGH
  // HIGH corresponds to the float switch being at its higest point (i.e. full water)
  else
  {
     digitalWrite(PUMP_1_PIN, LOW); //turn off the pump
     digitalWrite(LED_PIN, LOW);    //turn off the LED
  }
}

Github file

https://github.com/robotgeek/aquariumPumpDemo/archive/master.zip

Credits

RobotGeek Team

RobotGeek Team

35 projects • 208 followers
The RobotGeek team is a 6-man operation that wants to make it even easier to use Arduino to make electronics and robots.
Wade Filewich

Wade Filewich

35 projects • 102 followers
I make technology that makes plants grow

Comments