Aquarium monitor/controller

So several years back I created my first DIY home automation device using a raspberry pi for a college class. The project I ended up creating was an aquarium controller/monitor with the following specs.

rpi2

  • water temperature
  • basking area temperature
  • UVB light monitoring
  • Water leak sensor
  • control of an 8 relay board for the follow
    • Basking lights
    • UVB light
    • water heaters
    • night basking lamp
    • water filter

I should mention this aquarium is for a red eared slider (turtle)

This device worked great for several years but eventually the SD card failed. This was a fun project and what first got me started with home automation, but it looks awful and didn’t last.

Image of original controller box https://photos.app.goo.gl/VEG6xvS1P6m2MrK17

Luckily for me I had already bought all of the hardware to create a new one using an Arduino. So, as part of my new aquarium build which happened to be under way when the old controller failed, I created a new tank controller with the following requirements.

  1. No updates. i.e. No OS so Raspberry Pi was not an option.
  2. Network. (So I could get the status via Home Assistant)
  3. RTC. (Works even if the network is down) Don’t want my turtle to die because the Internet isn’t working…
  4. 8 relay control for standard 120v outlets
  5. 3 temperature sensors (Water, basking area, internal controller temperature)
  6. water leak sensor (If my canister filter is leaking turn it off)
  7. water level sensor (One day I would like to auto fill the tank)
  8. Current sensor (Amps in use.)

I decided on the following hardware

  • Arduino Mega - needed too make analog pins so couldn’t use esp8266
  • Ethernet shield - Ethernet shield was cheaper than WiFi
  • 3 DS18B20 (Water, Basking, and Internal temp) - they make these water proof
  • DS3231 RTC for keeping the current time between power outages/reboots
  • Analog water level sensor for leak detection - These are cheap and I am using to detect the presence of water no the water level so it works pretty good.
  • float sensor for water level detection - only needed a binary on/off (need to add water) indicator
  • non-invasive current sensor for detecting total amps in use by the aquarium - added for curiosity mostly

Picture of the new box in place under my tank https://photos.app.goo.gl/Tg5aA32zAbLCTA4E6

The code isn’t great but it is working. Located here https://github.com/w1ll1am23/ArduinoAquariumController

All of the “automations” for this run locally which was something I wanted. Home Assistant has the ability to change things but doesn’t perform the automations. This is so if HA is down my turtle doesn’t end up dying from lack of heat or whatever. All of my temperatures are monitored via HA and I get alerts if things are off. Since the controller is using a RTC it also works without internet to schedule my day/night light changes. The RTC is updated during startup if network is connected and NTP is successful. It also handles daylight savings time changes.

Some things i found out along the way

  1. Ethernet shields suck and so do EOP adapters.
    I ended up buying a cheap wifi router and setting it up as a ethernet WiFi adapter so the router connects to the controller via ethernet and then to my WiFi. This was still cheaper than a WiFi shield for the Mega and solved my flaky network issue I was having with my power-over-ethernet adapters.

  2. MQTT is way better than aREST
    I originally used aREST as my method of talking to the controller but found out it didn’t handle updates to multiple sensors very well and would lockup. Switched to MQTT and things went much smoother.

  3. The current sensor is very accurate, I compared to a killowatt meter I have and it was less than .1 kWh off after 24 hours.

I still have several things I want to improve/add for example I am working on an auto feeder that I can use while I am on vacation.

Let me know what you think!

6 Likes