Reef Discussion

Rob

Member
Apr 26, 2012
743
424
Edit April 2013.. I have an updated installation instruction on Page 5

I have progressed a little in setting up the RaspberryPI with the latest firmware. I have 1wire enabled to get temperature inputs and also enabled the serial port to direct connect to the Atlas Scientific pH and ORP devices.

Some setup notes once you have the RPi booted :
Code:
Update Packages
apt-get update
apt-get upgrade
 
Static IP
http://stuffaboutcode.blogspot.com.au/2012/05/raspberry-pi-setting-static-ip-address.html
 
nano /etc/network/interfaces
  # iface eth0 inet dhcp
 
  iface eth0 inet static
    address 192.168.1.xx  <- update to suit your network
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    gateway 192.168.1.1
 
 
Install apache
http://fusionstrike.com/2012/installing-apache2-raspberry-pi-debian
 
groupadd www-data
  usermod -a -G www-data www-data
  apt-get update
  apt-get install apache2
 
Install SAMBA
http://elinux.org/R-Pi_NAS
 
 
I2C (RASPBIAN)
http://nathan.chantrell.net/20120602/raspberry-pi-io-expander-board/
http://www.bootc.net/projects/raspberry-pi-kernel/
 
  nano  /etc/modprobe.d/raspi-blacklist.conf
  comment out the line: blacklist i2c-bcm2708
  nano  /etc/modules    add new line containing: i2c-dev
  sudo apt-get install i2c-tools
  sudo adduser pi i2c
  i2cdetect -y 0
 
 
OWFS  One Wire File System
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=7713
 
  apt-get install autoconf libtool libusb-dev libfuse-dev ed
  cd /usr/local/src
  wget http://downloads.sourceforge.net/project/owfs/owfs/2.8p17/owfs-2.8p17.tar.gz
  tar zxvf owfs-2.8p17.tar.gz
  cd owfs-2.8p17
    ./configure
    make
    sudo make install
 
 
Create owstart script and enable   
http://www.ehow.com/how_8721059_write-autorun-script-linux.html
  Create file (owstart)
    /opt/owfs/bin/owserver -p 3001 --i2c=/dev/i2c-0:ALL
    /opt/owfs/bin/owhttpd  -s 3001 -p 3002
    #/opt/owfs/bin/owdir  -s 3001
    stty -F /dev/ttyAMA0 raw 38400 cs8 -ignpar -cstopb eol 255 eof 255
 
  place script in the /etc/init.d/
    chmod 755 /etc/init.d/script.sh
      create the necessary symbolic links runs on system boot:
      update-rc.d owstart defaults
 
Disable Kernal Messages Sent to Serial Port dev/tty/AMA0
http://www.irrational.net/2012/04/19/using-the-raspberry-pis-serial-port/
 
sudo nano /boot/cmdline.txt
      Deleted the two parameters involving the serial port (ttyAMA0) to get the following:
      dwc_otg.lpm_enable=0 rpitestmode=1 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait
 
    sudo nano /etc/inittab
      Commented out the following line:
        2:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
 
 
Install SERIAL TEST CONSOLE
apt-get install minicom setserial
 
COMMS to ATLAS SCIENTIFIC SERIAL DEVICE
  hexadecimal 0a, line feed.
  hexadecimal 0d  carriage return.
 
  #!/bin/bash
  stty -F /dev/ttyAMA0 raw 38400 cs8 -ignpar -cstopb eol 255 eof 255
  printf "\x72\xff\x0D" >/dev/ttyAMA0        ;take 1 reading Command "r"
  printf "\x43\xff\x0D" >/dev/ttyAMA0        ;take continuous reading Command "c"
  printf "\x65\xff\x0D" >/dev/ttyAMA0        ;take continuous reading Command "e"
 
 
END
 

Rob

Member
Apr 26, 2012
743
424
This weekend I managed to get the raspberry PI installed in a small box and finally connected to the net. Everything is self contained including a small wireless bridge to enable it to communicate to the router. From the raspberryPI side everything is working OK including the web interface trending etc. I strapped a temperature probe to the heater so I will also trend heater on/off. The temperature increases sharply when the heater is on so easily determine its state.

aimg.photobucket.com_albums_v319_rjconway_raspberrypi_1.jpg



The setup is not without its issues through :( It seems that my ATI T5 lights) induce a voltage into the tank large enough to upset the orp and to a smaller extent the ph measurements. Looking it up on the net shows the fluorescent tubes being so close to the water surface can induce this voltage. I know its the lights as when the lights come on my trend shows a large deviation. If I simply place the probes in a beaker of water on top of the sump the light on/off has no effect, placing the probes in the sump the light on/off changes the reading. I will test for a few days with the probes simply in a beaker of water in the sumps section to ensure its to do with the water and not anything else. I did try grounding the water with a probe however changed very little so I removed the ground probe.

If my tests over the enxt few days prove its definitely a potential (voltage) in the water column I may have to pump some water (off my reactor pump) and get it to flow through a sample chamber containing the probes. The trick will be to isolate the chamber from the water in the sump so I can take a reading. If I dripped the water into the chamber and it dripped out of the chamber that would do it.

This is my basic interface, shows the measurements in gauges then click a gauge you see the trend. I have a date slider where you can change the date however as you click and slide the start and end times this does not work on ipad or iphone. So I plan on getting rid of the date slider and maybe simply have a couple of buttons to select the time span, 8 hours, 1 day 3 days 1 week, 1 month etc.

aimg.photobucket.com_albums_v319_rjconway_Rpiinterface.jpg


At least I am now online and can concentrate on getting the measurements correct.


Rob
 

macca_75

Member
Apr 22, 2012
2,125
844
Looking good. It;s taken a while but if anyone could figure it out it would be you.

Might have to go and check it out online - assuming the link remains the same as the old one.
 

MagicJ

Moderator
Jul 11, 2011
9,650
3,761
Hobart, Tasmania
Rob there is a fairly good write-up in the September edition of Australian Personal Computer on the Raspberry PI which might be of interest to you.

In reading about the capabilities of the PI I am more convinced that the Arduino is a better product as a controller ;)
 

Rob

Member
Apr 26, 2012
743
424
Thanks I'll take a look at APC, have not read that for years

Arduino as an aquarium controller yes I agree..
RaspberryPI as a monitor and non essential control it should be OK however I am not there just yet. As it runs a standard web server its very easy to setup a Web/ iphone GUI plus you can easily change the program over ethernet without having to plug in and download compiled code.
 

Rob

Member
Apr 26, 2012
743
424
Update for the week:

ph & ORP These measurements are still causing me issues. Nothing to do with RaspberryPI but having issues with stable readings. My T5 lights are causing issues with the mv readings of the two sensors. I am going to try another "isolated" pH and orp transmitter in the coming weeks

Temperatures. These measurements are great using three $5.00 1wire sensors. The sensors are all within 0.1 deg C accuracy between themselves and I have installed these in the tank. They are all rock solid no erroneous readings as these sensors are not effected by any leakage or induced "voltage" in the tank water. I have simply wire-tied one sensor to the jagar heater. I will at some stage get the RaspberryPI to simply sate heater is on or off based upon a temperature change. You can see below the heater temperature does vary by +-3 degrees when the heater is on or off. Thus it is very easy for the Rpi to sense over say 30 second interval is a +2 change = ON and a -2 change = OFF.

Anyhow here is a formatted graph of the temperature I can now see online. The room temperature sensor is not shielded from the breeze and is on the floor so if the front/back doors etc is open it cools down rapidly.
aimg.photobucket.com_albums_v319_rjconway_aqua_1.png


It will be another 1~2 weeks until I get ph orp and rh calcs reliable. So stay tuned
 

Rob

Member
Apr 26, 2012
743
424
In monitoring the heater cycles maybe this will become a good indication on when the heater thermostat is on the way out and time to change. Nothing like getting some data to enhance predictive failures. On this graph I see the heater did not switch on for a while.

aimg.photobucket.com_albums_v319_rjconway_aqua_2.png

didn't really want to post another temperature image however could not go back and edit my previous post. !
 

Kypeli

Member
Sep 23, 2012
6
2
Turku, Finland
Just wanted to say I am very excited to learn about this project! I received my Raspberry Pi and being a somewhat of a geek with a aquarium, this is exactly the kind of project I want to try out as well. How's the project gone and do you have any updates?

I got the same water-proof temp sensor as you are using, but as I plan on starting small, I'll just connect it directly to one of the GPIOs on the board without a breakout board. For what it's worth, I think it should be pretty easy with these instructions: UPDATE: Err, cannot post URLs. Oh well...

If (or when) I add more sensors, a breakout board (with I2C right?) sounds like to right way to go.
 

Rob

Member
Apr 26, 2012
743
424
Hi Kypeli,
The project is 95% complete. I did have trouble with the ORP reading in my tank, nothing to do with RPi however my ATI T5 lights effected the readings. I have just loaned this unit to a fellow reefer and its running 100% ORP & pH.

For the temperature measurements I do not know if you can direct connect 1wire to te GPIO. I would really recomend a 1wire - I2C driver and use OWFS package. 1wire temperature just works with this arrangement.

I hope you progress your project and happy to help. I will not be developing this any further as I am "time poor" thus cannot develop the system further.

Rob
Send me a PM if you have any specific questions
 

ydeschoe

Member
Dec 23, 2012
3
0
Rob,

I've read this post and I've also ordered a Raspberry PI. Where can I find the full instructions and code to have this setup.

currently I'm running all onto a NLSU2 but want to migrate the full setup + adding the possibility to read out the PH of a swimming pool + fish pond.
 

Rob

Member
Apr 26, 2012
743
424
PM your email address and I'll send some setup notes. owfs runs fine on the raspberrypi so if your have it running on an nslu2 the pi should be easier.
 

ydeschoe

Member
Dec 23, 2012
3
0
PM your email address and I'll send some setup notes. owfs runs fine on the raspberrypi so if your have it running on an nslu2 the pi should be easier.
Rob, I'm not able to send a PM as not enough post yet. Could you send me a PM with your e-mail and I will then reply via mail
 

Norman

Member
Dec 29, 2012
4
0
Hello Rob! I'm highly interested in all information I can get about your project. I'm also thinking about advancing the system to control the pH level via a magnetic valve on my CO2 bottle. But by now I don't know much about sensors and actors and their usage with the PI. Since I can not send you a PM, please send me your e-mail address or other sources for information about your project!

thank you very much and kind regards from Germany ;)
Norman
 

DanH

Member
Jan 20, 2013
1
1
Hi Rob, I am a student at the University of Sydney / Sydney Institute of Marine Science, I just got a Raspberry Pi with the idea to do exactly as you have done, and use it to remotely monitor my fish experiments, I also planned to do similar as Norman described, ie I wish to extend the capability to control the pH using a relay and gas solenoid valve. If you are willing to share it, your code would be a huge help in getting started! Please PM me your email address if you are able to help!

Cheers,

Dan