Matthew C Good : Musician, Software Engineer, Hobbyist.

A Sneak-Peak at the FishApp

As many of you are aware of by now, I have a (un)healthy obsession with fish. I also have a terrible memory. And the ability to program web applications. And the tendency to enjoy taking ideas all the way to their logical conclusions.

Possessing any of these attributes in isolation is not so bad of a thing.  But when all of them combine into one person, well…  You end up with some really oddball (yet fun) projects.

Bearing all that in mind, I’d like to tell you about a project I’m in the middle of right now – the FishApp.  FishApp started out as a PHP/MySQL web application that I created to help keep track of the water quality in my fish tank, and to view changes in water parameters over time (to identify trends and causal relationships, for example).  That didn’t sound like such a difficult project…

FishApp Screenshot

FishApp Screenshot

This is where things started getting out of hand (in a good way).  I decided that there may be other fish nerds on the internet who may want to use the service, so I added multi-user capability to the FishApp.  Which meant I had to make everything more user-friendly and build out the Admin area a little btter.  I had to give users the option to upload a fish tank picture (and resize it for them, etc).  And what if they had multiple tanks?  And so on.  All of those features are currently built into the fishapp.  We’ll see if anyone decides to use it or not!

There’s nothing too crazy going on in the FishApp code.  The graphs are generated by Flot (using a custom PHP wrapper I wrote and dubbed “phlot”).  There’s jQuery and the jQuery UI tools all over the admin area, and of course a rather simple MySQL database in the back.

There were a few technical challenges to address, however.  The last graph on the page displays the average “age” of the water in your fish tank.  It is a good idea to periodically change out some of the water in the fish tank for fresh water (to reduce things like Nitrates and accumulated minerals).  This reduces the weighted average age of the water in your fish tank.  This is my favorite feature, as it adds a visual display to an important piece of information that is normally invisible.

I also wanted the app  to send reminders to do maintenance tasks now and then.  However, if you have a large fish tank, you may only do a water change once a month, but if you have a small tank, you may want to do it every week.  I needed to give the users the opportunity to decided their own parameters for alerts.  In addition, I wanted users to be able to get an alert when their tank’s water age reached a certain number of days.  The SQL code necessary to aggregate across all the different maintenance types and tanks and users became quite large, however well-placed database indexes keep things running smoothly.

If you haven’t nodded off yet, you might be thinking that I’ve just about pushed this idea as far as it can go.  You would be mistaken.

Sometime in the middle of the project, I discovered this awesome open-source hardware/software microcontroller project called Arduino.  The Arduino project does what frustrated software engineers have longed to do since they days they first fired up QBasic on their friends’ computers – interface with the REAL WORLD.  Easily.  You can program the Arduino using a comfortable C-like language in its easy-to-use development environment.  It can read sensor values, move servos, control motors, light LEDs, make sounds, etc.  Anything you can wire up to it, you can use (basically).  People were doing cool stuff like improving their espresso machines, building real-life pong interfaces, tweeting their energy usage, and the like.  So naturally I decided my fish tank had to be web-enabled.

I am still in the middle of this section of the project, but here are some ideas of what I plan on doing with the FishApp:

  • Use an ultrasonic distance sensor & some code to determine when I have just done a water change, and automatically post JSON data to the FishApp’s API.  No more forgetting to put water changes into the app.
  • Monitor the tank’s temperature over time using a neat little National Semiconductor chip.  I should be able to detect and diagnose any big swings in temperature in real time.
  • Control some LED moonlights for my tank, both on a programmed schedule, and using an infrared remote control.
  • Allow web users to feed my fish a special treat (once a day) by pushing a button on the web page.  AJAX + Arduino + Servos for the win!
  • Set up a FishCam – a webcam to view the action in the tank.
  • Every now and then, tweet what is going on in the fish tank.
  • Buy a PH probe and graph real-time PH values (especially important if I decide to do some CO2 injection in the tank at some point).
  • Build a turbidity meter to measure the water clarity (following instructions from an awesome Forrest Mims electronics book).

As you can see, the list goes on and one.  The first few features are already in development, the rest may follow afterward.

As I said, the FishApp is not finished.  It is not very polished currently, and not really ready for prime-time.  I just wanted to post this blog to give a sneak-peak of what’s in the works.  Now go check it out!

5 Responses

  1. Jason says:

    Dude…you’re nuts. I love it. I’ll tell you one thing; I hope somehow, somewhere in the future, I get to work with you on something. Because I think that would be a blast.

    If you ever have an idea you’d like to collaborate with me on, let me know. I do have what I believe to be an original idea stored up that may interest you…and I’d love to work with you on it. If you’ve got time for a side project, let me know. 🙂

  2. admin says:

    Haha yes. I am nuts! But I like it…

    If all goes well, I may be doing some contract work in the near future on a site, and I’ve also got a mixing project that needs to be done ASAP as well as finishing moving in (wife and I just moved to NC). It looks like I’m swamped for at least a month or two. I’m kinda curious about your idea though. If you email me I promise I won’t steal it. 🙂

  3. […] looks like the FishApp is already providing me with some really neat and useful insights into my aquarium.  I recently […]

  4. Jose says:

    Hey,
    Nice job!
    This is a very good use for the Arduino, could you share the plans for the PH probe and the other probes too?
    I would like to learn from your work so that I can add salinity, redox, etc…
    I would also recommend you to try R, the statistics package, for handling your data and create some nice graphics.
    Peace,
    Jose

  5. matt says:

    Hi Jose, thanks for the comment. I haven’t started any work on the pH meter yet, but I bookmarked these web pages:
    http://www.66pacific.com/ph/ph_1.htm
    http://www.66pacific.com/ph/simplest_ph.aspx
    and a rather full-blown implementation
    http://code.google.com/p/phduino/
    The last link also has a nice list of references.

    Apparently the first one uses some pretty high voltages and currents – so please don’t kill yourself if you follow that one. I might not do that one either.

    I have heard of R and have been meaning to check it out. I’ll have to give it a go (and finish that darn O’Reilly Statistics book I started reading).

    Hope that helps! I’ve just about got the temperature sensor posting to my website – but I’ve been having some power supply fluctuation issues, I think. Another blog post will be following soon on that.

Leave a Reply