DIY Raspberry PI Tank Monitor Project

Discussion in 'Equipment / DIY / Reviews' started by Rob, Jun 5, 2012.

  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Users Viewing Thread (Users: 0, Guests: 0)

  1. macca_75

    macca_75 Member

    Messages:
    2,277
    Ratings:
    +1,200
    Country:
    Australia
    State:
    Vic
    You mean when I sprayed salt water all over everything 240V :(

    It's all good now though. We really do need to build the spare Pi I have with a clean image ;)
  2. macca_75

    macca_75 Member

    Messages:
    2,277
    Ratings:
    +1,200
    Country:
    Australia
    State:
    Vic
    @Rob - pH gauge doesn't appear to be reading the correct value either.

    Oh - and I need to add that previous period dashed line thing
  3. Rob

    Rob Member

    Messages:
    875
    Ratings:
    +703
    Country:
    Australia
    State:
    Victoria
    Anybody feel like adding a webcam to the Aquapi. real easy just grab an old webcam, runs directly from the usb port. I simply loaded "motion" disabled motion detection and simply use the snapshot function (every 15 mintues) and its ability to stream the image on a specific port.
    I'm using the profilux web page as a container however can obvisouly call this up via a web browser direct. Can confirm it works on IOS, chrome and F.Fox

    Aquapi_webcam.png
    • Like Like x 1
  4. Sam Parker

    Sam Parker Moderator

    Messages:
    4,896
    Ratings:
    +4,655
    Country:
    Australia
    State:
    Victoria
  5. Moreno5

    Moreno5 Member

    Messages:
    19
    Ratings:
    +0
    Country:
    United Kingdom
    I agree, Rob this looks superb. Loving your interface. Very slick!
  6. Rob

    Rob Member

    Messages:
    875
    Ratings:
    +703
    Country:
    Australia
    State:
    Victoria
    This is the GHL profilux std interface. Profilux allows you to specify a IP camera address. I just put my RPi ip and the port number I'm using to stream the webcam through its interface. RPi will supplement this interface with btter long term trends. I am going to re jig RPi web page to use same colour layout so it all looks the same site.
  7. Rob

    Rob Member

    Messages:
    875
    Ratings:
    +703
    Country:
    Australia
    State:
    Victoria
    OK, now got the webcam tuned a little better for picture quailty and using "motion" application on the raspberrypi you can overlay text on the video stream. Now where "cook'n" lets get the temp,ph or orp showing on the video stream. This could also be done using imagemagic a lot nicer on the snapshot images, post processing the picture" however the motion application can overlay text in realtime on the videostream directly 9kind of just like how it overlays time/date. The motion application setup can be changed on-the-fly using its http config engine. That is you just send motions setup commands via http requests and a specific port number and the motion config will update. I use the following simple bash script to retrieve data from my profilux (A simple string of ph orp temp") and then send this string to motions text parameters

    Code:
    #!/bin/bash
    while true ;do
      data=`curl -s -d name="XXX" -d pass="XXX" 192.168.1.xx:xx/sensordata.html`
      /usr/bin/wget --delete-after "http://192.168.1.xx:9080/0/config/set?text_left=Aquaruium Data\n$data" 2>/dev/null
    sleep 900
    done
    
    In my case the line "data=`curl...." just brings back a text string from my profilux computer. If you had ph or temp coming from atlas or 1wire devices you simply create a text string of any data you want to display.


    The result (I did a printscreen, this is not a snapshot but a videostream grab)
    stream with tank params.png
    • Like Like x 1
  8. Buddy

    Buddy Member

    Messages:
    3,433
    Ratings:
    +2,587
    Country:
    Australia
    State:
    VIc
    Reading this thread is gonna make me spend money :banghead
    • Like Like x 1
  9. macca_75

    macca_75 Member

    Messages:
    2,277
    Ratings:
    +1,200
    Country:
    Australia
    State:
    Vic
    I replied earlier @Rob but not sure where it went. Have you tried specifying a True Type font instead of using the default - it will scale better and not be so jagged when you increase the size.
  10. Rob

    Rob Member

    Messages:
    875
    Ratings:
    +703
    Country:
    Australia
    State:
    Victoria
    Over the last 12 months the acceleration in embedded products have sky rocketed. I never thought I would be streaming tank images wanting to create wifi bridges on top of what started out to be some simple logging which ran on a modified 260mhz network storage box (linksys NSLU2) aka slug 10 years ago.

    I think my needs have outgrown the 700mhz Raspberrypi however still wanting something compact and low power, Welcome to the goodness of 1.7GHZ, Quadcore 2 GB Ram Odroid -and still only $59.00

    KEY FEATURES

    * The Powerful Linux Computer
    * 1.7GHz Quad-Core processor and 2GByte RAM
    * 10/100Mbps Ethernet with RJ-45 LAN Jack
    * 3 x High speed USB2.0 Host ports
    * Audio codec with headphone jack on board
    * XUbuntu 13.10 or Android 4.x Operating System
    * Size : 83 x 48 mm, Weight : 48g including heat sink
    * Package includes the main board and the heat sink

    201312222305368236.jpg

    Cant wait to get my hands on this little powerhouse.... Better still its got an arduino IO expander so mixes best of both worlds. I can feel another thread coming on, Goodbye Raspberrypi (the logging interface with rrdtools and the gauge frontend which I use with RPi is just web stuff so will work on any web server)
    • Like Like x 1
  11. Sam Parker

    Sam Parker Moderator

    Messages:
    4,896
    Ratings:
    +4,655
    Country:
    Australia
    State:
    Victoria
    Quad core goodness! Looking forward to seeing what you can do with that bad boy :)
  12. Eric Harding

    Eric Harding Member

    Messages:
    1
    Ratings:
    +0
    Country:
    United States
    State:
    CA
    Where can one download the source for this project
  13. Rob

    Rob Member

    Messages:
    875
    Ratings:
    +703
    Country:
    Australia
    State:
    Victoria
    Started up the odroid today and it simply booted to a "desktop" environment. Wow this thing is fast, web surfacing, web cam in another window and a word processor running and still all windows were fluid. Starts in <10 seconds to full desktop, also has XBMC preinstalled. This thing would make a great custom NAS box as well.

    With the speed of this thing the raspberrypi is like a snail. Now in saying that macca has run the RPi now for way over a year and I do not believe he has had any trouble with it all. here's hoping Odroid is as stable, cannot see why not. One thing I have noticed with the Odroid is the desktop environment is loaded with applications and package management. It will be interesting to see if I can stay out of the command prompt and load / setup applications from the GUI. oh.. did I mention how FAST this thing is ! haha

    I think this thing could easily have multiple webcams, a single web cam only consumed maybe ~20% of one of the 4 cores. I understand each core is 1.7GHZ
    • Like Like x 1
  14. Moreno5

    Moreno5 Member

    Messages:
    19
    Ratings:
    +0
    Country:
    United Kingdom
    Guys, do we have the source code up anywhere yet for this project?

    Also did we manage to get a write up sorted?
  15. Airst

    Airst Member

    Messages:
    1
    Ratings:
    +1
    Country:
    Australia
    Would be keen to see how your odroid controller goes.

    I was picking one up to act as media server for my home network, but might grab an additional one at a later date for tank monitoring :).
    • Like Like x 1
  16. Clownfishy

    Clownfishy Member

    Messages:
    98
    Ratings:
    +16
    Country:
    United Kingdom
    State:
    Gloucestershire
    For those interested in adapting the AquaPi to post its temp data to Xively, below are some notes from the documentation I started to produce. Donating is a little screwed as it is a cut and paste but can share out a link to the doc if required.

    AquaPi

    Table Of Contents
    Hardware Build
    Hardware Requirements
    Software Build
    Raspbian
    Wifi Configuration
    Raspbian Configuration
    1-Wire Configuration
    OWFS 1 Wire Filesystem







    Hardware Build
    Hardware Requirements
    The AquaPi requires the following hardware to be purchased.

    Raspberry Pi Style A or B (I used style B)



    Software Build
    Raspbian
    The first thing you will need to start to build your AquaPi is an SD Card built with the Raspbian operating system. For those new to Raspberry Pi's, Raspbian is a Linux based operating system distribution which is used to start up your Raspberry Pi. To put it another way, the Raspberry Pi is the hardware, Raspbian is the base software to power the Raspberry Pi hardware and then applications are layered on top of the base operating system software to run the AquaPi.
    This guide provides some basic information on building the SD Card but for further detail, please refer to the Raspberry Pi website.
    References:
    Raspberry Pi SD Card Setup
    http://elinux.org/RPi_Easy_SD_Card_Setup
    Raspbian Download
    http://www.raspberrypi.org/downloads


    Note: The following instructions have been written installing AquaPi from a Ubuntu Linux PC.

    Install Raspbain by copying the Raspbian image to the SD Card:
    sudo dd bs=4M if=image-name-you-downloaded of=/dev/device-name-mounted-by-linux
    Note: Note that when specifying “of=/dev/device-name-mounted-by-linux” this is the device name not the partition name.

    Wifi Configuration
    If you wish your Raspberry Pi to connect to your home network router wirelessly, the Raspbian operating system must know the configuration of your home network. This information is stored in a file named interfaces and can be found in the directory /etc/network. Edit this file using your favorite Linux text editor and amend the file to the following configuration.
    auto wlan0
    iface wlan0 inet dhcp
    wpa-ssid the-name-of-your-wireless-network
    wpa-psk the-password-used-to-connect-to-your-wireless-password
    wireless-power off
    Although beyond the scope of this document, you may wish to configure your home wireless router to allocate the same IP address to your Raspberry Pi each time it is rebooted by assigning your chosen IP address to the MAC address from the Raspberry Pi wireless USB adapter. If you choose not to do this, your Raspberry Pi will be allocated a random IP address each time it is rebooted. However you wish to configure the IP address, make a note of the address as it will be needed in order to login to your Raspberry Pi.

    Raspbian Configuration
    Once you have powered on your Raspberry Pi, you should now be able to connect to it from another Linux computer using ssh. To do this run the command
    ssh -l pi the-ip-address-of-your-Raspberry-Pi
    Example: ssh -l pi 192.168.0.200
    You will be prompted for a password which is
    raspberry
    Once logged in, you have the ability to configure the Raspbian operating system with some basic settings and to do this type
    sudo rpi-update
    UPDATE_SELF=0 rpi-update
    sudo raspi-config
    The basic configuration is to expand the Raspbian image which will ensure Raspbian uses all the space available on the SD Card. You can also change things such as the username and password which is used to log into the Raspberry Pi and setting the hostname of the Raspberry Pi.
    After another reboot, it is time to ensure that Raspbian is updated with any patched software that have been released since the Raspbian image was created. This should be done on a regular basis to ensure your Raspberry Pi’s software is secure. To do this type the following commands and answer Yes to any prompts asking you to install software.
    sudo apt-get update
    sudo apt-get upgrade
    Reboot your Raspberry Pi by entering the command
    sudo reboot
    Once rebooted, connect to your Raspberry Pi again
    ssh -l pi the-ip-address-of-your-Raspberry-Pi
    Example: ssh -l pi 192.168.0.200
    Now run the following command to remove all the old Raspian packages
    sudo apt-get autoclean
    1-Wire Configuration
    Raspian needs a number of configuration changes and additional software in order for it to communicate to the 1-wire Pi board. The first configuration change is to the raspi-blacklist.conf file. To edit this file enter:
    sudo nano /etc/modprobe.d/raspi-blacklist.conf
    Add # before the line “blacklist i2c-bcm2708” and then save this file.
    Example: #blacklist i2c-bcm2708
    Now we need to make a change to the modules file. To edit this file enter:
    sudo nano /etc/modules
    Add new line containing the following and then save the file.
    i2c-dev
    Now install some additional software but entering the command:
    sudo apt-get install automake autoconf autotools-dev gcc-4.7 libtool libusb-dev libfuse-dev swig python2.6-dev tcl8.4-dev php5-dev i2c-tools
    Once this software has been installed, reboot the Raspberry Pi using the command:
    sudo reboot
    After the Raspberry Pi has completed its reboot, connect to the Raspberry Pi and enter the command:
    sudo i2cdetect -y 1
    If everything is working correctly, the 1wire board should connect to the Raspberry Pi at I2C address 18 and successfully display:
    0 1 2 3 4 5 6 7 8 9 a b c d e f
    00: -- -- -- -- -- -- -- -- -- -- -- -- --
    10: -- -- -- -- -- -- -- -- 18 -- -- -- -- -- -- --
    20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    70: -- -- -- -- -- -- -- --


    OWFS 1 Wire Filesystem

    Now the base Raspbian operating system is installed, configured and updated we are now ready to move onto the next step and layer the OWFS file system software onto Raspbian.
    First, from your Linux computer, download the latest 1-wire filesystem from
    http://owfs.org/index.php?page=download

    You will then need to transfer this file to your Raspberry Pi by using the command
    scp 1-wire-filename Raspberry-Pi-username@ the-ip-address-of-your-Raspberry-Pi:/usr/src
    Example: scp owfs-2.9p1.tar.gz pi@192.168.0.200:~
    The password you are prompted for is the password you set on your Raspberry Pi if you changed it. If not, the password will be raspberry.
    The 1-wire filesystem you transferred to the Raspberry Pi will be compressed also known as tar. You will now need to uncompress, untar the file before you can begin setting up the 1-wire filesystem. To do this type the following on your Raspberry Pi:
    cd /usr/src
    tar xvzf 1-wire-filename
    Example: tar xvzf owfs-2.9p1.tar.gz
    Now type the following commands below to compile the 1-wire software:
    cd 1-wire-filename
    sudo ./configure
    Note: This command will take approximately 3 minutes to complete.
    sudo make
    Note: This command will take approximately 30 minutes to complete.
    sudo make install
    Note: This command will take approximately 3 minutes to complete.
    sudo mkdir /mnt/1wire
    sudo nano /etc/fuse.conf
    Update the line “#user_allow_other” and remove the # from the start, then save your changes.

    END OF DOCUMENT
    MORE TO FOLLOW SHORTLY




    sudo /opt/owfs/bin/owfs --i2c=ALL:ALL --allow_other /mnt/1wire/
    sudo /opt/owfs/bin/owfs --i2c=ALL:ALL --allow_other /mnt/1wire/


    # Starts OWFS
    /opt/owfs/bin/owserver -p 3001 --i2c=/dev/i2c-1:ALL
    /opt/owfs/bin/owhttpd -s 3001 -p 3002

    # Setup Serial Port
    stty -F /dev/ttyAMA0 raw 38400 cs8 -ignpar -cstopb eol 255 eof 255





    sudo apt-get install sqlite3
    sudo apt-get install ftp
    wlan

    Cron
    @reboot sudo sh /home/pi/wlan.sh
    @reboot sudo python /home/pi/xively_tutorial/aquapixreef.py
    @reboot sudo python /home/pi/xively_tutorial/aquapixroom.py
    @reboot sudo python /home/pi/xively_tutorial/aquapixcabinet.py
    @reboot sudo python /home/pi/xively_tutorial/aquapixleft.py
    @reboot sudo python /home/pi/xively_tutorial/aquapixright.py
    @reboot sudo sh /home/pi/aquapi.sh
    * * * * * sudo sh /home/pi/aquapiup.sh
    @hourly sudo /sbin/reboot


    wget http://downloads.sourceforge.net/project/owfs/owfs/2.8p17/owfs-2.8p17.tar.gz
    /USR.SRC



    Glossary
    Operating System
    Distribution
    MAC Address
    IP Address
    • Like Like x 1
  17. Simon Simpson

    Simon Simpson Member

    Messages:
    3
    Ratings:
    +0
    Country:
    United Kingdom
    State:
    west yorkshire
    Yes Please Interested in the doc

    Thanks
    Simon
  18. Clownfishy

    Clownfishy Member

    Messages:
    98
    Ratings:
    +16
    Country:
    United Kingdom
    State:
    Gloucestershire
    • Like Like x 1
  19. Simon Simpson

    Simon Simpson Member

    Messages:
    3
    Ratings:
    +0
    Country:
    United Kingdom
    State:
    west yorkshire
    nice one thanks :)
  20. Rob

    Rob Member

    Messages:
    875
    Ratings:
    +703
    Country:
    Australia
    State:
    Victoria
    I came across an old pic of my FW web site back in 2007... I may try and establish some more of the reporting functins I had with respect to water changes and summary data. This site was hosted on something called a SLUG. Which was a 256mhz linksys NAS which was hacked to run linux.

    THIS IS NOT RASPBERRYPI however an example of what can be achieved. My current site obviously takes it current form from my original Discus Tank monitor.
    aimg.photobucket.com_albums_v319_rjconway_newweb1.jpg
    aimg.photobucket.com_albums_v319_rjconway_newweb2.jpg


    The auto water change reports were pretty cool. I now let my profilux handle these however for my FW it was a simple script running on the server, (with appropriate failsafes)

    I ahve been pretty slack lately in terms of my RPI and after my current dosing project will get back on board.
    • Like Like x 1

Share This Page