close-circle
Close
0%
0%

aquaPionics

An Open Source Aquaponics Control System with sensors galore and control of the water valve. With a dashboard, data-logging and alerts too!

Similar projects worth following
This is the prototype for our Waterelf project - now part of wegrow.social kickstarter!

Aquaponics systems need to be carefully tended to keep them working well as both the fish and the hydroponic plants need a consistent environment. We've made a solution - a control and monitoring system - from a number of open-source elements and created software to integrate them together.

This project began with a request from the Incredible AquaGarden, who were busy building an aquaponics system as part of their project located next to the high school in Todmorden, UK. After researching the subject I advised that the available solutions were only half what they needed and suggested that instead I build them a system. I thought I'd be finished by Christmas - and here we are, a year later and the system still isn't quite finished!

But during this year I've had more fun (and more frustration) than I could imagine, I've been able to work with Naomi (who is a genuine programming wizard) which has been fab; and together we've made an amazing system that's fully open-source. I can honestly say that I'm really proud of what we've achieved, and that's priceless.

Now we're ready to tell the world about our project, hopefully gaining qudos, improvements and collaborators. We've learned a lot with our first system that will make our second system (under construction) a hundred times better.

One of the first things I did was to try to get a grip on the detail of what the system was going to be. An initial design decision was whether to base our project on Arduino or Raspberry Pi. Only these platforms seemed to offer the easy-to-access libraries we would need to interface to the wide variety of sensors we needed. I resolved this dilemma by choosing them both! I used a system diagram to help me plan out each sensor and how it would connect:

The system uses an Arduino Mega (massive 'rispetto' to them!) to connect to most of the sensors. We wrote code that collects sensor readings every second and sends them over ethernet using the MQTT protocol. We chose MQTT because it's a lightweight solution that's a great fit for our needs, and there are high quality libraries available for Arduino and Raspberry Pi.

Something we appreciate is that although there is a boat-load of great code available for these platforms, not all of it is ready for production. We've learned the hard way that you have to review the code you use and where it's coming from to get confidence that it's going to work - day in, day out. There is a big difference between a quick proof-of-concept sketch and a well tested, debugged and maintained library.

Some of the sensors connect directly to the Arduino such as the water and air temperature, the power measurements and the analog and digital water level switches. Some of the more specialised sensors connect via the Aquarium Ultra shield from Practical Maker:

This open source shield provides an interface to a pH probe, an ORP probe (for sensing Oxygen level) and an EC probe (for sensing dissolved nutrients). It also gives a nice set of connections to many of the Arduino's other I/O pins. Since we got a shield last year the design seems to have changed and the price reduced.

The Raspberry Pi receives the data from the Arduino but also has some sensors to monitor itself - and the control elements that affect the system. I designed and built a board that drives a relay and LED lights, and provides an LCD interface. In the end we used a separate relay board and decided not to use the LCD - and the lights are still awaiting a good solution to underwater video! But the experience was very useful - both in terms of circuit design/build and system design.

During installation I found out that the sensor cable lengths had to double to 10m - and this caused problems with the pH sensor and the light level sensor. I decided that the way forward was wireless, and so I designed and built sensors based on JeeNodes from JeeLabs. As they are derived from Arduino it was relatively easy to transition to them, and soon we had a light sensor and pH sensor communicating over wireless to the Raspberry Pi.

I used the excellent pH sensor board from Sparky's Widgets but had to hack it in

the literal sense - with a hacksaw! - to make it fit into the case I wanted to use. Luckily the board files are available...

Read more »

  • 1 × Arduino Mega We needed the extra IO that the Mega provides
  • 1 × Arduarium Controller Ultimate v1 of this board was used
  • 1 × Arduino Ethernet Shield Allows the Arduino to talk over a wired network
  • 2 × JeeNode v6 with 868MHz RFM12B radio Each wireless sensor has one of these beauties
  • 2 × Adafruit 1200mAh LiPo battery By sleeping 99.93% of the time these batteries last for years

View all 18 components

  • Wuthering Bytes presentation

    Gareth Coleman08/20/2014 at 08:19 0 comments

    We've just got back from a fabulous weekend technology festival in Hebden Bridge. Wuthering Bytes was two days of talks and a day of workshops, and this year we were privileged to be asked to speak on Saturday and run a workshop on Sunday.

    I'll post a link to the presentation when it's published over the next few days as we had 20 minutes to give an overview of the system that might help fill in any gaps in the documentation. BTW if anything isn't clear then please do leave a comment and I can expand on that bit.

    The system behaved impeccably even with everyone watching it although we didn't have time to do the live demo we hoped for. The workshop was great fun although exhausting and we were very fortunate to have two contributions from workshop participants during the day!

    Anton Whalley re-wrote our database and API to use mySQL rather than Cassandra. We talked about several options and eventually decided that it had been fun working with a really big scale noSQL datastore, but we didn't really need to fight it's restrictions. And Beth McMillan made a start on some graphs, which we're really grateful for.

    I had loads of interesting conversations with people - including one with a grey-beard developer of proprietary hardware who told me that Arduino's were 'just toys' and that open source hardware didn't achieve the levels of quality that commercial products require! (With hindsight I think he must misunderstand how the Arduino is conceived - as a development board - he seemed very bothered  about EMC compliance!)

    I replied that the thing I loved about working in an open way was the potential to co-operate - and that this advantage was the key leverage point. Just the next day we get valuable contributions from people who have just heard a bit about the project, and want to help out! To get that sort of help, you need to be both open and worthwhile, and I'm proud to say that both we and our aquaPionics project are.

  • System 1 vs System 2

    Gareth Coleman08/13/2014 at 11:11 0 comments

    I've referred to our system a bit loosely and also mentioned in the comments of a better way of doing things that we've developed so I'll just clarify this now. Our original system (we're now calling this system 1) was fully wired - and it worked great on the bench! However, installation proved a real challenge as we had to route the cables over the ceiling, adding another unexpected 5m to the length of them. Some of the sensors didn't mind this - the 1-wire protocol used by the DS18B20 temperature sensors coped fine for example. But the I2C communication to the TSL2561 light sensors was intermittent and some of the other sensors seemed a bit less reliable as well.

    After a lot of research and trying out some circuits I settled on using a wireless solution from JeeLabs called the JeeNode. I wanted to use an open source solution partly on principle but mainly on very practical grounds. The JeeNodes have a vibrant community of hackers, many experts among them, who are invaluable in getting stuff working quickly. With a closed-source platform you are dependant on the vendors to help you, and they might be busy or just not that bothered. We are also thinking of making our own boards one day and of course, open source hardware makes it explicitly easy to do these things.

    Also JeeNodes are a derivative of Arduino, so we could carry on using the libraries and code we'd developed without having to port anything over. The radio side is handled by a well coded library developed by JCW at JeeLabs, and we had good confidence in it. The radio chip used can also be added to a Raspberry Pi with little difficulty or expense, as it uses SPI to communicate. The add-on board we use is tiny and costs only slightly more than the radio module itself, you can see it  here plugged directly into the Pi's GPIO pins:

    Once we'd got a couple of wireless sensors built the advantages started to really stack up. Most importantly for us was the decoupling of sensors and base station - we could use multiple sensors and not worry about I2C address conflicts, running out of analog pins etc. We can even foresee having multiple redundant sensors and redundant base stations - a Redundant Array of Inexpensive Hardware. If one sensor fails then it can be replaced without affecting the rest of the system - no need for downtime while the new one is wired in.

    We're calling this wireless approach system 2 - and we're recommending it for all new projects and systems. The system running in Todmorden that is monitored by the dashboard has a mixture of wired and wireless sensors - you might call it a system 1.5! Hope that helps clarify where we're up to - now on with the hacking!

  • Open Data API published

    Gareth Coleman08/09/2014 at 19:15 0 comments

    Today we're publishing our open data API. We've used Swagger to document it - but wait - there's more! Swagger also provides a way to use the API right in your browser - complete with headers, body, response codes. Try it out!

    Aquaponics Open Data API

    We are very keen to get feedback, suggestions, improvements and collaborators in true open-source fashion.

    We've got more info about the system and the API at our website, l0l.org.uk

  • System back up again

    Gareth Coleman08/05/2014 at 10:04 0 comments

    Just back from a visit to Todmorden to do some emergency repairs on the system. Apologies if you've found the dashboard empty over the last few days - it's fixed now. Over the last week or so the power has been going up and down like a yo-yo - partly due to work carried out on the school site and partly due to supply problems affecting most of the town. As a result, the Raspberry Pi suffered corruption of it's SD card based filing system - and the backup SD card we prepared for just such an eventuality also failed soon after swapping it over.

    After a few frustrating hours talking to folks over the phone and getting them to turn it off and on again, swap cards etc. I decided that a visit was needed - and I found that the Raspberry Pi had suffered a major failure and wouldn't boot no matter what I did. I'm not sure why this happened - it could be related to the power black- (and brown-) outs or it could be due to the valiant attempts of collaborators to act as my remote hands under phone guidance.

    The system is quite cramped in it's box and it's quite possible that the metal pcb support pillars made a short circuit or that the extension board was connected up to the wrong pins. Luckily I was carrying a spare Raspberry Pi - something that is only practical with such a cheap platform - and once this was installed I could repair the filing system and reboot. We've ordered a couple of cheap uninterruptible power supplies that should keep the power going even when the grid fails us, and they'll also condition the power in case of further brown-outs.

    However one bonus of the trip was I was given some chilli-peppers that were grown in another part of the project - guess I'm going to have to make some hot open-sauce!

View all 4 project logs

  • 1
    Step 1

    Many project construction details are on our website l0l.org.uk. Here I'll just quickly outline how to make a v2 base-station and a single wireless sensor, you'll also need some more software from our git repositories.

  • 2
    Step 2

    Assemble a base-station from a Raspberry Pi B+, sd-card, power supply and rfm12b dongle. You can use a JeeLink or a directly connected board.

  • 3
    Step 3

    Download the thingbox.io image to the sd-card and boot the Pi. If you're using a direct connection you'll have to enable SPI and install the drivers - instructions here.

View all 7 instructions

Enjoy this project?

Share

Discussions

Brian Wharton wrote 01/04/2017 at 15:14 point

What are you using for your PH and O2 probes?  are you actively using this?  On the PH probe, how often do you service/recalibrate it?  thanks...brian

  Are you sure? yes | no

Robert wrote 09/01/2016 at 14:38 point

Is this project still be actively worked on? Is Version 3 still in the works? Would love to try a build, but would need some feedback and questions would no doubt arise (already have!). Any update, no matter how short, would be appreciated!  Thanks!

  Are you sure? yes | no

Billie Bricks wrote 03/15/2016 at 07:30 point

Dear Gareth, Naomi,

Found your build here on Hackaday. Kudoz!! ;)

I checked the repository for the Arduino Mega code, but found no entry's for the pH and EC modules on the Arduarium Controller Ultimate in the code. 

Saw that you continued with the jeenodes, but was wondering if you have a version where the pH modules do work as I Happen to have a Arduarium Controller Ultimate lying around. 

With kind regards,

Billie

  Are you sure? yes | no

Gareth Coleman wrote 03/15/2016 at 15:37 point

Hello there Billie - sorry no - we never developed that part and by the time we did - we were using jeenodes. Thanks for the kudoz tho!

  Are you sure? yes | no

Billie Bricks wrote 03/15/2016 at 16:33 point

No problem. I already programmed the sketch for the Arduino mega, but now I'm all into RPI and thought it would be cool to use the processing power to make a nicer touchscreen  application and web-interface for the hardware.

Just learning python and my C++ isn't as pro looking as Naomi's. The code for the aquaponics-arduino for example just gives me the chills ;)

I wish you the very best with your endeavours and I will keep an eye out for coming updates!!

With kind regards,

Billie

  Are you sure? yes | no

Chris Crosswhite wrote 06/19/2015 at 20:06 point

Swagger is now located at swagger.io

  Are you sure? yes | no

wgl3ra wrote 10/24/2014 at 15:49 point
Hi Gareth - very interested in building "system 2"....would like to hear more.

Thanks,
Gregor

  Are you sure? yes | no

Gareth Coleman wrote 11/30/2014 at 14:58 point
Hey Gregor - we're documenting our work on system2 over at aquaponicslab.org - however I've just discovered the ESP8266 and so I think it might have to be a rethink of everything and go to a system 3!!!! Watch out for the future - it's arriving.

  Are you sure? yes | no

Chris Crosswhite wrote 06/19/2015 at 20:07 point

Any progress?

  Are you sure? yes | no

Blecky wrote 08/18/2014 at 17:51 point
I built something like this in the past (definitely more simple though). One thing I added was ephemeral calculations (using pyephem) to determine the sunrise and sunset times to control the day light and night light (moon). You could add something like that too!

  Are you sure? yes | no

Gareth Coleman wrote 08/20/2014 at 09:28 point
It might be useful to add in the daylight information - but we aren't controlling the lights (yet!). When we have control of the lighting that adds to the natural daylight we might investigate this. Can you explain how this information would help us? Thanks!

  Are you sure? yes | no

Gareth Coleman wrote 08/05/2014 at 10:22 point
Thanks for the comment Jasurbek - you are very welcome to build any or all parts of our system - we'd be honoured! But system 2 is so much better, I would suggest that you build that instead - it's cheaper, simpler and better. Most of the details are on our website l0l.org.uk but feel free to contact us directly and then we can give you individual support. We'd hate for you to have to make our mistakes all over again - it's much better that you make your own, brand new mistakes and then we (and others) can learn from those in turn!!

  Are you sure? yes | no

Jasurbek wrote 08/05/2014 at 01:52 point
Very good project!!! I hope I can build this in future

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates