Open source DIY Reef aquarium controller - build guide and progress

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
Ive spent the better part of last year working on a project that I have called Marine Assistant, an innovative open-source reef aquarium monitoring and control system designed for DIY enthusiasts. Inspired by other similar projects like the AquaPi or reef-pi I did my own improvement to the design and its now almost ready for prime time, Marine Assistant integrates seamlessly with Home Assistant to provide automation and monitoring of your aquarium's vital parameters.

v2 case (v15~recovered) PCB.png
v2 case (v15~recovered).png



What the hardware has:
  • 6x float switch inputs
  • 1x optical water level sensor
  • 5x temperature sensor inputs
  • 2x leak sensor inputs
  • 4x Analog ports for pH,ORP,EC and TDS
  • 1x echo distance sensor port
  • 4x 12v switchable outlets
  • 2x customisable buttons
  • 1x buzzer for alarms
  • spare 5v and 12v outputs
How it handles mains voltage?
Simple....Smart plugs. They are widely available and well established, they have power monitoring and setting automations is also no problem. Hard wiring is on my todo list but this works fine!

Ive designed a case that is 3d printed, printed in PLA. The .STL files will be up on Thingiverse, makerworld and printables soon.....

Ive now had mine running and monitoring my reef tank in its current version for the last couple of months and its been flawless....Ifyou're interested in participating or want to stay updated on the progress, please Check out the github for files (Uploading more files everyday at the moment):

https://github.com/marine-assistant/Marineassistant

Im currently still working on a theme for home assistant and creating a nice dashboard, Who uses Home assistant for aquarium monitoring?

v2 case (v15~recovered)CASE3.png
Dashboard_N.png



My aim with this thread is to document the build so that anyone can recreate the controller, trying to standardise as much as possible, Ill be updating this thread with project progress......
 

Peace River

Thrive Master
View Badges
Joined
Apr 29, 2014
Messages
24,734
Reaction score
172,778
Location
USA
Rating - 100%
1   0   0
This is an exciting project! Good luck on the adventure!!!
 
OP
OP
Lukes Saltwater Tank

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
Do I see it correctly that it only exposes the sensors to home assistant? And all automations have to be done from the HA server?

Yes that is correct, you can however put a raspberry pi inside the case to have it all in one.

If you already have home assistant then you can use that and leave the pi unpopulated in the case.
 

KoenE

Community Member
View Badges
Joined
Feb 1, 2025
Messages
48
Reaction score
59
Location
Netherlands
Rating - 0%
0   0   0
I will play as the advocate of the devil for a moment because this project has a massive amount of potential in my eyes, but it currently has a major flaw in my opinion as well. The good news, it should be possible to fix with a lot of coding (never good news without a sad part😅).

I feel like that the current setup is prone to failure, when power fails you're always cooked without backup power so I'm not counting that one :). But now you've created a situation where you also became dependent on the wifi signal to be up all the time (knowing wifi, it won't😭). Because if it doesn't stay up, things can go wrong if happens at the wrong moment.
In my opinion you want to run your functions locally on the same esp (I expected it to be developed that way due to safety/failsafe reasons), without the need of automations in HA. I have had the wifi go down at home multiple times already while ethernet and power were up, this meant automation triggers would be send because HA was able to run, but without a wireless network, no esp or other wifi device like a smart plug would receive anything. For me it was only my automatic feeder that would stop feedings, and that my lamp for my mangrove wouldn't turn on or off, but if you're running your thermostat or ato this way, your tank could be cooked or flooded if the wifi goes down while it's running. Backup failsafes etc in the automations wouldn't work as well, because the signal wouldn't transmit.
I think that's currently the major flaw which is possible to fix, but it would maybe also need a pcb redesign because you would need relays to run a thermostat or ato (although there were mosfets I think so you could connect those to relays).
I was very interested in this because I'm also trying to run my new tank 100% on HA now using an ESP, and having a dedicated pcb is nice and clean, but for me it needs to be  standalone as well, and how marineassistent is configured now, that's not the case unfortunately. It is a fixable problem though, but you'll loose some flexibility and the code on the esp will become much more complicated. I think I'm already at 150 lines of code on my esp with just the thermostat and ATO running, and those don't include failsafes yet. I will have to rewrite my code all the way to be able to do that in a reliable way. Which will be done in the future. The values can be updated through HA, and I can check my temperature, but all code is run locally on the esp and independently from HA. I think that's the way to go to have a reliable and stable HA supported reef tank controller.
 

PhilTee

New Member
View Badges
Joined
Apr 19, 2025
Messages
1
Reaction score
1
Location
Petawawa
Rating - 0%
0   0   0
Joined the form because stumbling across this. I love home assistant and have developed some small parts of this kind of thing to use home assistant to monitor and control some od my tanks but yours looks awesome. Will definitely be following and testing.
 
OP
OP
Lukes Saltwater Tank

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
I will play as the advocate of the devil for a moment because this project has a massive amount of potential in my eyes, but it currently has a major flaw in my opinion as well. The good news, it should be possible to fix with a lot of coding (never good news without a sad part😅).

I feel like that the current setup is prone to failure, when power fails you're always cooked without backup power so I'm not counting that one :). But now you've created a situation where you also became dependent on the wifi signal to be up all the time (knowing wifi, it won't😭). Because if it doesn't stay up, things can go wrong if happens at the wrong moment.
In my opinion you want to run your functions locally on the same esp (I expected it to be developed that way due to safety/failsafe reasons), without the need of automations in HA. I have had the wifi go down at home multiple times already while ethernet and power were up, this meant automation triggers would be send because HA was able to run, but without a wireless network, no esp or other wifi device like a smart plug would receive anything. For me it was only my automatic feeder that would stop feedings, and that my lamp for my mangrove wouldn't turn on or off, but if you're running your thermostat or ato this way, your tank could be cooked or flooded if the wifi goes down while it's running. Backup failsafes etc in the automations wouldn't work as well, because the signal wouldn't transmit.
I think that's currently the major flaw which is possible to fix, but it would maybe also need a pcb redesign because you would need relays to run a thermostat or ato (although there were mosfets I think so you could connect those to relays).
I was very interested in this because I'm also trying to run my new tank 100% on HA now using an ESP, and having a dedicated pcb is nice and clean, but for me it needs to be  standalone as well, and how marineassistent is configured now, that's not the case unfortunately. It is a fixable problem though, but you'll loose some flexibility and the code on the esp will become much more complicated. I think I'm already at 150 lines of code on my esp with just the thermostat and ATO running, and those don't include failsafes yet. I will have to rewrite my code all the way to be able to do that in a reliable way. Which will be done in the future. The values can be updated through HA, and I can check my temperature, but all code is run locally on the esp and independently from HA. I think that's the way to go to have a reliable and stable HA supported reef tank controller.
Thanks KoenE For your thoughts, I am yet to test this myself but I dont belive this is actually a big problem, the way I understand this is that the automations run on the ESP itself and dont "need" Wifi. Everything that is hard wired to the ESP hardware should work just fine.

For reference see here: https://esphome.io/automations/actions.html
At the bottom of that page you will find:

"Do Automations Work Without a Network Connection
This is a common question and the answer is YES! All automations you define in ESPHome are executed on the microcontroller itself and will continue to work even if the Wi-Fi network is down or the MQTT server is not reachable."


Where I will agree with you is on the WIfi smart plugs, they talk directly to the Raspberry pi and need the wifi to recieve the automations, for this reason the end goal is to have everything hard wired to the esp32. However there are also ways around this, these have a last state setting which can be set to either on / off /last known. Being a DIY project the smart plugs are also a much safer option.

That being said I would love to see you ESPhome Code, If you have your automations hard coded in there that is something ive not come across before.

The project is still in development and is all open source so it will evolve over time!
 
OP
OP
Lukes Saltwater Tank

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
Joined the form because stumbling across this. I love home assistant and have developed some small parts of this kind of thing to use home assistant to monitor and control some od my tanks but yours looks awesome. Will definitely be following and testing.
Thanks... welcome to the journey! Im having a little break over Easter but I have some nice updates in the pipeline! ;)
 

firechild

Active Member
View Badges
Joined
Nov 23, 2020
Messages
267
Reaction score
349
Location
Sydney
Rating - 0%
0   0   0
Thanks KoenE For your thoughts, I am yet to test this myself but I dont belive this is actually a big problem, the way I understand this is that the automations run on the ESP itself and dont "need" Wifi. Everything that is hard wired to the ESP hardware should work just fine.

For reference see here: https://esphome.io/automations/actions.html
At the bottom of that page you will find:

"Do Automations Work Without a Network Connection
This is a common question and the answer is YES! All automations you define in ESPHome are executed on the microcontroller itself and will continue to work even if the Wi-Fi network is down or the MQTT server is not reachable."


Where I will agree with you is on the WIfi smart plugs, they talk directly to the Raspberry pi and need the wifi to recieve the automations, for this reason the end goal is to have everything hard wired to the esp32. However there are also ways around this, these have a last state setting which can be set to either on / off /last known. Being a DIY project the smart plugs are also a much safer option.

That being said I would love to see you ESPhome Code, If you have your automations hard coded in there that is something ive not come across before.

The project is still in development and is all open source so it will evolve over time!
The way around this would be to not use smart plugs, rather an ESPhome driven relay board to create a custom power strip. A 2, 4 or 8 relay board would be quite cheap and provided you are comfortable working with 230V, would be quite simple to set up.
 
OP
OP
Lukes Saltwater Tank

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
The way around this would be to not use smart plugs, rather an ESPhome driven relay board to create a custom power strip. A 2, 4 or 8 relay board would be quite cheap and provided you are comfortable working with 230V, would be quite simple to set up.
That is the plan, I just want to make a good guide for this too to make it as safe as possible!
 

KoenE

Community Member
View Badges
Joined
Feb 1, 2025
Messages
48
Reaction score
59
Location
Netherlands
Rating - 0%
0   0   0
Good morning @Lukes Saltwater Tank ,
I think there is a small misunderstanding, as I think you are writing the automations seperate from the esphome code? I'm hardcoding everything in the esphome builder, and I think you are writing them separately via integrations -> esp -> automations? I don't know for sure if those last automations run from homeassistant the same as node red does (all triggers from HA to esp's etc. I run from node red in HA), I'm not super experienced with HA yet, basicly I'm always looking just for the part I need🙈. But if those last automations run on HA instead of the esp (like the automations made in node red), then they won't trigger when there is no connection, is my experience.

"Do Automations Work Without a Network Connection
This is a common question and the answer is YES! All automations you define in ESPHome are executed on the microcontroller itself and will continue to work even if the Wi-Fi network is down or the MQTT server is not reachable."
The key answer is in this orange part I think, with the examples on the page it looks like they hardcode the automations directly in the esphome code (like I'm doing currently). I don't think the automations made in HA count as well, but finding a conclusive answer for it is slightly difficult. And I don't know HA well enough to know as well.

This is a snippet from my current code:
1000162509.jpg

Sorry for the picture instead of raw code, my phone wouldn't let me copy more than one rule of code at a time...
This for example is currently the code for the ato, I have to build in some extra safeties, like max amount of triggers during a certain amount of time as I'm fixing the pump runtime per trigger, another options was to use a filter for the sensor, as it will trigger on off on off due to rippling in the water when filling. And this was the easiest way for me to fix the on off issue, and now it runs around once every 45 minutes to keep up with evaporation.
But having it coded this way, the code will definitely run when the wifi is down, as both sensors and pump are physically connected to the esp.
I think this is also the most regular way to program it as well, just like all the example projects on the esphome page.
 
OP
OP
Lukes Saltwater Tank

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
Good morning @Lukes Saltwater Tank ,
I think there is a small misunderstanding, as I think you are writing the automations seperate from the esphome code? I'm hardcoding everything in the esphome builder, and I think you are writing them separately via integrations -> esp -> automations? I don't know for sure if those last automations run from homeassistant the same as node red does (all triggers from HA to esp's etc. I run from node red in HA), I'm not super experienced with HA yet, basicly I'm always looking just for the part I need🙈. But if those last automations run on HA instead of the esp (like the automations made in node red), then they won't trigger when there is no connection, is my experience.


The key answer is in this orange part I think, with the examples on the page it looks like they hardcode the automations directly in the esphome code (like I'm doing currently). I don't think the automations made in HA count as well, but finding a conclusive answer for it is slightly difficult. And I don't know HA well enough to know as well.

This is a snippet from my current code:
1000162509.jpg

Sorry for the picture instead of raw code, my phone wouldn't let me copy more than one rule of code at a time...
This for example is currently the code for the ato, I have to build in some extra safeties, like max amount of triggers during a certain amount of time as I'm fixing the pump runtime per trigger, another options was to use a filter for the sensor, as it will trigger on off on off due to rippling in the water when filling. And this was the easiest way for me to fix the on off issue, and now it runs around once every 45 minutes to keep up with evaporation.
But having it coded this way, the code will definitely run when the wifi is down, as both sensors and pump are physically connected to the esp.
I think this is also the most regular way to program it as well, just like all the example projects on the esphome page.
Ah OK I see now what you mean, I will have to look into this in more detail!

Luke you say though this isn't really a long term problem, it can be coded out. I have to think about how to do it properly though maybe with cards on the dashboard to change settings. I want it easy for everyone to copy in their own setup.

I'll read into this some more and do some tests of my own first.
 

KoenE

Community Member
View Badges
Joined
Feb 1, 2025
Messages
48
Reaction score
59
Location
Netherlands
Rating - 0%
0   0   0
Luke you say though this isn't really a long term problem, it can be coded out. I have to think about how to do it properly though maybe with cards on the dashboard to change settings. I want it easy for everyone to copy in their own setup.
This is definitely possible, as I have it configured that way as well (even though I was too lazy to make the cards yet and I change my settings via the webserver of the esp itself). Every value you can make a number if you like, I hardcoded a few of them at the moment like the boundary values between where I can set my temperature goals for the thermostat (between 23 and 27 degr C). Making it easy and foolproof is smart XD
 

keepingfishwithnoidea

Well-Known Member
View Badges
Joined
Oct 4, 2024
Messages
633
Reaction score
398
Location
Maldives
Rating - 0%
0   0   0
I'm following as i am currently working on one of these, if you need any help dm me :beaming-face-with-smiling-eyes: also I'm not that ignorant man who trusted his tanks on ai now:grinning-face-with-sweat:.
 
OP
OP
Lukes Saltwater Tank

Lukes Saltwater Tank

Community Member
View Badges
Joined
Dec 7, 2022
Messages
62
Reaction score
42
Location
Germany
Rating - 0%
0   0   0
Ok, so I think it's time for a little update...


The main hardware is in the hands of testers, and together a couple of issues have been worked out and resolved. The main issue with the current hardware is the integration of the analog sensors. It has been designed in the spirit of being DIY-friendly and open-source, but that brings its own range of problems.

Getting a range of different sensors to work together and not interfere with one another has proven to be very difficult. Currently, I'm running a range of sensors from DF Robot. They also have little isolator boards, and the results so far have been very good. The only problem is the price point—doing it like this means it gets quite pricey.

The next version, which I'm working on, will have the sensor hardware and isolation circuitry onboard. You will just need to connect a probe with a BNC connector.
Other than that, mine has been running on my tank now for a good few months without issue. It runs my ATO, tops up the ATO reservoir, monitors temp, pH, ORP, EC, and the TDS of my RO water, monitors power usage, and controls everything via automations in Home Assistant.


Parallel to the main project, I've been working on an auto-feeder that integrates with Home Assistant too. I'll make a separate post for this when it's ready, but it'll be in the same spirit of DIY, with a build guide and "how-to." The code will be open-source too!
 

Attachments

  • IMG_20250615_201622.jpg
    IMG_20250615_201622.jpg
    196.1 KB · Views: 123
  • IMG_20250622_205041.jpg
    IMG_20250622_205041.jpg
    74.1 KB · Views: 106

TOP 10 Trending Threads

WHAT AMOUNT OF LIVE ROCK AND SAND SHOULD BE PRIORITIZED FOR OPTIMAL BIODIVERSITY/FILTRATION?

  • 100% live rock + bagged sand

    Votes: 37 27.4%
  • 100% dry rock + 100% live sand

    Votes: 46 34.1%
  • 50/50 live/dry rock, 50/50 live/bagged sand

    Votes: 30 22.2%
  • 75% live rock, 25% live sand

    Votes: 12 8.9%
  • 25% live rock, 75% live sand

    Votes: 10 7.4%
Back
Top