edge lab LIVE! starts Tuesday in Munich. Grab a workshop seat and take home the board you build on. Code FRIEND-HACKSTER saves 20%. () Learn more!
Adulfo Amador
Published © MIT

Tank Refillerator

Ever get tired of refilling your aquarium, well now we have a solution. With this you wiill never need to refill your aquarium manually.

IntermediateWork in progress2 hours663
Tank Refillerator

Things used in this project

Hardware components

OLED Click
×1
DS18B20 Programmable Resolution 1-Wire Digital Thermometer
Maxim Integrated DS18B20 Programmable Resolution 1-Wire Digital Thermometer
×1
Submergible Water Pump
×1
Darlington High Power Transistor
Darlington High Power Transistor
×1
Floating Limit Switch
In the project I used a regular push button, but the real application will have a floating limit switch
×1
Pocket Beagle
×1
1N4007 – High Voltage, High Current Rated Diode
1N4007 – High Voltage, High Current Rated Diode
×1
Resistor 1k ohm
Resistor 1k ohm
×1
Resistor 100 ohm
Resistor 100 ohm
×1
Male/Male Jumper Wires
×1
Ultrasonic Sensor - HC-SR04 (Generic)
Ultrasonic Sensor - HC-SR04 (Generic)
In the initial stages of the project, a Grove ultrasonic sensor was used, but was not successfully incorporated into the project. This adafruit ultrasonic sensor should work better because it has supported libraries.
×1

Hand tools and fabrication machines

Epilog Fusion M2 Laser Cutter

Story

Read more

Custom parts and enclosures

Test Aquarium Display

This is the file needed to make the small testing aquarium and reservoir.

Pocket Beagle Enclosure

This is the file needed to create an enclosure for the electronics. There are access holes in the model for the wires that come out.

Schematics

Aquarium_Pump

This is the Schematic of the setup using a breadboard.

Code

DT_Thermistor.dtbo

Tex
No preview (download only).

Temp_Motor

Python
#Adulfo Amador
#Rice University 
#ENGI 301 - Fall 2018

#Copyright 2018 Adulfo Amador

#Permission is hereby granted, free of charge, to any person obtaining a copy of #this software and associated documentation files (the "Software"), to deal in #the Software without restriction, including without limitation the rights to #use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies #of the Software, and to permit persons to whom the Software is furnished to do #so, subject to the following conditions:

#The above copyright notice and this permission notice shall be included in all #copies or substantial portions of the Software.

#THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, #FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE #AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER #LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, #OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE #SOFTWARE.



#imports

import os
import glob
import time
import Adafruit_BBIO.GPIO as GPIO
import time
import random
import os



# ------------------------------------------------------------------------
# Global variables
# ------------------------------------------------------------------------

BUTTON0                      = "P1_29"
MOTOR0                       = "P1_36"

# ------------------------------------------------------------------------
# Main Tasks
# ------------------------------------------------------------------------

 # Initialize Button
 
GPIO.setup(BUTTON0, GPIO.IN)
GPIO.setup(MOTOR0, GPIO.OUT)
    
 
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')

# ------------------------------------------------------------------------
# Temperature Code
# ------------------------------------------------------------------------
 
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')[0]
device_file = device_folder + '/w1_slave'
 
def read_temp_raw():
    f = open(device_file, 'r')
    lines = f.readlines()
    f.close()
    return lines
 
def read_temp():
    lines = read_temp_raw()
    while lines[0].strip()[-3:] != 'YES':
        time.sleep(0.2)
        lines = read_temp_raw()
    equals_pos = lines[1].find('t=')
    if equals_pos != -1:
        temp_string = lines[1][equals_pos+2:]
        temp_c = float(temp_string) / 1000.0
        temp_f = temp_c * 9.0 / 5.0 + 32.0
        return temp_f
        

# ------------------------------------------------------------------------
# Display Image using display.sh script
# ------------------------------------------------------------------------

def temp():
    image_choices = ['Screen_Display.jpg']
    command = 'sudo /var/lib/cloud9/ENGI301/Aquarium_Pump/display.sh ' + image_choices[0]
    print(command)
    os.system(command)
    time.sleep(5)

temp()

# ------------------------------------------------------------------------
# Motor Triggering Code with Button Input
# ------------------------------------------------------------------------


        
input = GPIO.input(BUTTON0)

while True:
    while (GPIO.input(BUTTON0) == 1):
        GPIO.output(MOTOR0, 1)
        print("Motor running")
        time.sleep(1)
        
        if (GPIO.input(BUTTON0) == 0):
            GPIO.output(MOTOR0, 0)
            print("Stopped")
            break
        
    print(read_temp())	
    time.sleep(300)
	
	

        

	
	

display

SH
#!/bin/bash
sudo fbi -T 1 $1

Run_Aquarium_Pump

SH
#!/bin/bash
# --------------------------------------------------------------------------
# <Same documentation / copyright>
# --------------------------------------------------------------------------
cd /var/lib/cloud9/ENGI301/Aquarium_Pump

config-pin p1_29 gpio
config-pin p1_36 gpio 

python Temp_Motor.py

Credits

Adulfo Amador
1 project • 0 followers

Comments