benmason
Posts: 25
Joined: Sat Jan 19, 2013 7:40 pm

aquarium temperature sensor with email

Sat Jan 19, 2013 8:07 pm

Hi All,

I am soon buying a tank to house some turtles. I would like to project a system where my pi monitors the air and water temperature via DS18B20 waterproof sensors.

Ideally I would like the pi to email me a warning stating when either of the sensors are outside of set range (25-29 degrees Celsius.)

I have read http://www.cl.cam.ac.uk/freshers/raspbe ... mperature/ and believe this would work but I need your help working with multiple single wire sensors and with making the pi email when required.

All assistance and comments welcomed.

Best wishes

Ben

yop
Posts: 16
Joined: Fri Jan 18, 2013 11:50 pm

Re: aquarium temperature sensor with email

Sat Jan 19, 2013 9:35 pm

I discovered thinkerforge product yesterday (I know i do ads but i find it so cool)

They provide cheap modulable things you can plug to your rasp; you should have a look , they got temps sensor and IR temps sensor so you can mesure, the glass temp and maybe 20cm under water or maybe a stone or something?

albatros
Posts: 32
Joined: Wed Jan 02, 2013 5:46 pm
Location: Germany

Re: aquarium temperature sensor with email

Sat Jan 19, 2013 10:03 pm

Hi,

I started with my Pi and FHEM http://fhem.de/fhem.html some days ago. I wish I would have found it earlier, because then I would have used it for my two tanks with snakes to controll lights and heating. So I think FHEM could be very usefull for you.

Regards

Uwe

benmason
Posts: 25
Joined: Sat Jan 19, 2013 7:40 pm

Re: aquarium temperature sensor with email

Sun Jan 20, 2013 12:45 am

Thank you both for your replies, some interesting potential especially with regards automating the heating of the tank.

I will be trying to keep this project as streamline as possible at least for the first attempt, as such ideally I need to work out how to take a reading from the sensor and through a process of continuous monitoring set the above limits. I imagine it to be along the lines of let "Air Temp" = (sensor 1 address) if "Air Temp"= >25.000 then run a script. That script should then send an email warning stating "Air Temp=" to a specifies address. I think I would like the script to take a reading every 30 minutes.

It seems a fairly simple set of processes however I am right at the start of my programming experience.

Can anyone point me towards a tutorial for setting up email notification of sensor readings?

anddav87
Posts: 11
Joined: Tue Jun 26, 2012 7:50 pm
Location: Benfleet, Essex, UK
Contact: Website

Re: aquarium temperature sensor with email

Wed Mar 13, 2013 9:42 am

Hi

If you haven't already found a solution, try this that I just uploaded:

https://github.com/anddav87/SendTempWarn

Cheers

Andy

bouncymat
Posts: 38
Joined: Thu Feb 28, 2013 8:24 am

Re: aquarium temperature sensor with email

Wed Mar 13, 2013 1:05 pm

this code (adapted from adafruit tutorial) will read multiple temp sensors

Code: Select all

import os
import glob
import time
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
base_dir = '/sys/bus/w1/devices/'
device_folder = glob.glob(base_dir + '28*')

numberof=len(device_folder)
device_file=[0]*numberof
temp_c=[0]*numberof

print numberof

for i in range (0,numberof):
    device_file[i] = device_folder[i] + '/w1_slave'

def read_temp_raw(value):
    f = open(device_file[value], 'r')
    lines = f.readlines()
    f.close()
    return lines

def read_temp():
    for ii in range (0,numberof):
        lines = read_temp_raw(ii)
        while lines[0].strip()[-3:] != 'YES':
            time.sleep(0.2)
            lines = read_temp_raw(ii)
        equals_pos = lines[1].find('t=')
        if equals_pos != -1:
            temp_string = lines[1][equals_pos+2:]
            temp_c[ii] = float(temp_string) / 1000.0
    return temp_c

while True:
    print(read_temp())
    time.sleep(1)
i am very new to programming so please excuse any silly bits of code.

Return to “Automation, sensing and robotics”