Reef Discussion

Rob

Member
Apr 26, 2012
743
424
@--Mark-- Atlas scientific provide the pH circuits and probes. They are also on ebay

although previously mentioned I had all sorts of problems with these devices on my tank when I had an ATI powermodule 6 T5's. It induced voltage into the aquarium which I could not get rid of and the pH and ORP readings showed incorrect values. This setup ran faultlessly on macca's tank which used MH's + I have converted to LED's and the atlas circuits work OK.

############
There is soo many ways to get real world data into the pi I'm drowning in requests outside of this thread. So to make life easier over the next few weeks let me see if I can get macca (who runs my original RPi) to zip up the www directory and somehow host it for people to download. That way the front end is in place and then we can deal with sesnors.

@macca_75 whats the chances of zipping up the /var/www directory and subfolders and hosting it somewhere :) Then in theory all that is needed to do is configure apache on the target RPi to enable cgi which maybe someone can do for us as well. Then if people modify the front end they can post it backup

@The Reefuge Can we host a zip file for people to download from that macca_75 and I have write privledges to ?
 

The Reefuge

Administrator
Jul 9, 2011
4,152
1,929
@--Mark-- Atlas scientific provide the pH circuits and probes. They are also on ebay


@The Reefuge Can we host a zip file for people to download from that macca_75 and I have write privledges to ?
Hello @Rob,

How about we go a little bit further with it. Soon, The Reefuge will be opening micro-communities. This will allow members to set up their own communities within The Reefuge in which they can administrate. This will include things like photography, programming, DIY Tanks, DIY Skimmers, etc. Users can then join communities to get their activity feed to display updates made to these communities.

All community content will be open for everyone to see, regardless of if they are subcribed to the communities or not. This will allow you to create your very own Raspberry community in which you will be able to break your major thread into specific articles and questions and answers. I will also set up an open FTP server for administrators of the Raspberry community to upload and modify files on.

Please PM me if you are happy in doing something like this.

Thanks.
 

Rob

Member
Apr 26, 2012
743
424
The reefuge has provided a FTP link so we can simply post the www directory zip from a RPi that's been running for ~8 months. Luckily the www and its subdirectory contains the rrdtool data store as well so it's kind of self contained once we get this directory backed up.

Macca can backup next week however I'm not available next week so it maybe 2 weeks before we get the www zip on the FTP site. This may also align with splitting the thread into a micro community so we can split up into separate threads so more can contribute with setup tips, front end data collection and web front ends
 

Rob

Member
Apr 26, 2012
743
424
Yes I did buy a camera module however doubt I will use it.

I really want to fast track getting the interface out there (gauges & trending) coupled with this mico-community through the Reefuge. That will then allow me to take the project in a new direction and combine some technologies that will make @MagicJ very happy. So hold off on the RPi camera if you want (although its only 25.00 ) as Im not sure if it will be supported.
 

macca_75

Member
Apr 22, 2012
2,125
844
Yes I did buy a camera module however doubt I will use it.

I really want to fast track getting the interface out there (gauges & trending) coupled with this mico-community through the Reefuge. That will then allow me to take the project in a new direction and combine some technologies that will make @MagicJ very happy. So hold off on the RPi camera if you want (although its only 25.00 ) as Im not sure if it will be supported.
Not sure what your plans are for the gui, but I have it 90% the way there with highcharts and think I have figured out the last remaining issue (to be confirmed) but if I am correct it's just a matter of sticking it together.

Are you stickig with RRDTools or moving to MYSQL?
 

Rob

Member
Apr 26, 2012
743
424
@macca_75 that sounds great, no change from rrdtools for the data store or the ASCII data file. These two provide a great interface piont between the backend services populating data and any GUI we create. As youv'e been using the interface for so long now you will have a better idea on what's important. Looking forward to see a trend object revamp.

Raspberrypi is moving quickly into the home automation environment and we will be able to capitalise on this work over the next 2-3 months, although whatever happens I think the ability for the RPi to log data locally via rrdtools and a web trend interface will always be required.
 

macca_75

Member
Apr 22, 2012
2,125
844
I've been running one of the Atlas ones for 12 months. To be honest I didn't calibrate when I first started - I was interested in trending only.

Anyhow I calibrated 12 months later and the were almost spot on.
 

Rob

Member
Apr 26, 2012
743
424
I see Atlas Scientific now have a raspberryPI howto for the PH and ORP modules etc. This is great and using the example looks too easy. It simplifies my bash script enormously. It uses the python 2.6 serial library which si the preffered scripting for Raspberrypi. (I think I remember reading the name was born from pi = python)

Although I ahve not done mutch over the last few weeks I will post a pic of my Rpi assembly
 

Rob

Member
Apr 26, 2012
743
424
Web Interface
I have finally uploaded the /var/www directory to the reefuge ftp site.

In the past I did have trouble getting the one cgi file to run and setup apache2. However I have cleaned up the directory and file locations for the site and hopefully its alot easier. I just did a standard apache2 apt-get install, just left apache2 with its default virtual sites and only fixed up the server name as per the following
http://simonthepiman.com/how_to_setup_windows_file_server.php I did not install anything else, this site does NOT need php or mysql just apache2 so keep it simple.


The ftp site has a directory www rev 0 -original
If you place all the files and subdirectories in /var/www you are nearly done. There is one directory which is called usr_lib_cgi-bin there is two cgi files in this directory. One called test.cgi and the other aquatrend.cgi. You need to move these files into /usr/lib/cgi-bin I would try the test cgi file out first just to make sure Apache can run cgi files. For the cgi test in your browser type in xxx.xxx.xxx.xxx/cgi-bin/test.cgi That should run the test cgi file. Other than that it should be OK. /var/log/apache2/error.log will assist if something does not work. You may have trouble with file permissions however you should be able to work it out. The web site is very easy now with only a few files required.

Installing these files you should have a fully functional front end. The subdirectory already has an rrd database with data so you can pull up trends etc.

What is not uploaded is the script to gather data and populate rrd database and the text file aqua_tag.txt. You should be able to manually change aquatag.txt values and whilst the web site is in a browser press scan and the gauges will update.

You will need an ftp explorer as the files are not zipped and if you go into the link it will try and 1/2 load index.html and you will not see any files.

you only need this backup of my RPi directory place the contents in /var/www "www rev 0 -original"

http://raspberry.lavapixel.com

I just use the firefox addin (fire ftp) seems to work ok. You should not need a password

The web file does not quite display the slider bar correctlty click on the zoom and it displays, not sure whats this about.

I do plan to replace the dateslider with simple radio buttons 1 day 3 days 7 days or 1 month. and then have a separate page using the date slider function. However datslider does work in this site.
 
Last edited:

gro

Member
Aug 7, 2013
1
0
Hi,

I also have a Raspberry pi for my Aquarium and Terrarium.

There is my contribution:

Code:
#!/usr/bin/env python

import os
import xively
import subprocess
import time
import datetime
import requests
import glob
os.system('modprobe w1-gpio')
os.system('modprobe w1-therm')
FEED_ID = "YOURFEEDID"
API_KEY = "YOURAPIKEY"
# initialize api client
api = xively.XivelyAPIClient(API_KEY)
# function to read the temperature from ds18b20 temperature sensor on i2c
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_temperature():
    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
        return temp_c
# function to return a datastream object. This either creates a new datastream,
# or returns an existing one
def get_datastream(feed):
  try:
    datastream = feed.datastreams.get("TemperatureSensor")
    return datastream
# main program entry point - runs continuously updating our datastream with the
# latest temperature reading
def run():
  feed = api.feeds.get(FEED_ID)
  datastream = get_datastream(feed)
  datastream = get_datastream(feed)
  datastream.max_value = None
  datastream.min_value = None
  while True:
    degreesCelcius = read_temperature()
    datastream.current_value = degreesCelcius
    datastream.at = datetime.datetime.utcnow()
    try:
      datastream.update()
    except requests.HTTPError as e:
      print "HTTPError({0}): {1}".format(e.errno, e.strerror)
    time.sleep(10)
run()
This Python take the information from your DS18B20 sensor and push into your Xively account every 10''

You have to follow this tutorial and then try that code.

Anyone tried with a DHT22?

I will try your way to manage Rob but for the moment I did'nt understand everything I need to do.
 

fishiefarmer

Member
Aug 27, 2013
11
1
Just joined because I am doing something similar with an aquaponics setup (freshwater).

I am using the RPi to monitor temperature, the state of drainage siphons and light (only because it is easy). I am sending the data to open.sen.se where it is displayed. It can be viewed online, but I cannot upload the URL until I have 10 posts. I will get busy posting!

The setup currently has some koi, some mountain minnows, some silver perch and some yabbies.

I will take some pictures and upload images of the interface card I have built and contribute the python code.

I am using thermistors, microswitches, potentiometers and LDRs as sensors. I use an API kit to measure pH and manually input it as the sensors for this are too expensive.
 

macca_75

Member
Apr 22, 2012
2,125
844
Just joined because I am doing something similar with an aquaponics setup (freshwater).

I am using the RPi to monitor temperature, the state of drainage siphons and light (only because it is easy). I am sending the data to open.sen.se where it is displayed. It can be viewed online, but I cannot upload the URL until I have 10 posts. I will get busy posting!

The setup currently has some koi, some mountain minnows, some silver perch and some yabbies.

I will take some pictures and upload images of the interface card I have built and contribute the python code.

I am using thermistors, microswitches, potentiometers and LDRs as sensors. I use an API kit to measure pH and manually input it as the sensors for this are too expensive.
Look forward to the demo.
 

fishiefarmer

Member
Aug 27, 2013
11
1
This is my sump level meter. Basically it is a potentiometer connected to a float. I am not interested in the actual level, vust need to know it is rising and falling as this is an ebb and flow (flood and drain) system. Later on I might add an algorithm to convert angle to height.
 

Attachments