Aqua328 flexible aquarium controller

A flexible and adaptable controller for Aquariums or other stuff based on the ATMega328P

Similar projects worth following
A controller for aquariums; Can control 3 lights (eg waterproof high-intensity RGB strips, or some other combo plus a Fan (or another light circuit..) from a 12/24v supply.

This was built for use with a tank that lives in a charity / info centre in Amsterdam. It has no 'clock', instead it relies on the staff pressing a button every morning to trigger a 8 hour light period. A sensor monitors the water temperature and a display shows this, plus status info.

The controller fades the lights to avoid sudden illumination changes; has over temperature protections and a speaker to alert the staff to actions and problems, but is otherwise unobtrusive.


My target aquarium is a Juwel Rekord 800; a common 110 liter tank with a hood, lights and feeding hatch. The built-in fluorescent lighting has been stripped out, and LED strips installed in their place. 

I installed a fan into the old channel that held the original lighting starter wiring; it takes external air in and blows it (fairly gently, it's a 40mm radial fan) onto the water surface at one end of the tank. The same channel conceals all the wiring and the controller itself is mounted above this, power comes from an external 24v PSU brick mounted safely away from the tank.

A temperature sensor hangs below the lid in the water; It has been soldered to a three core cable then waterproofed by sealing with heatshrink filled with silicon aquarium sealant. A discreet reedswitch (sealed magnetic switch) detects when the feeding hatch / lid is opened.


  • DIP package ATMega328P (ie. same chip as arduino Uno) and packs a built in 5V regulator and FTDI connector for programming and serial debug or control.
  • The four High-power LED/Fan mosfets are all on PWM outputs for intensity control.
  • Both the I2C and OneWire interfaces are brought out for Displays and Temperature sensors to use; there are positions for pull-up resistors as needed.
  • The two remaining PWM lines drive a simple buzzer/speaker driver and the LCD backlight.
  • An analog pin and three digital pins are made available for switches, light sensors etc, All connectors have power pins to simplify wiring.


  • The water temperature is read 3x per second and displayed, the display is also updated with icons and info messages to display the tank, fan and lid status. 
  • Audio beeps and simple tunes are played to provide feedback on user actions and alerts about automatic actions,
  • Lights are turned on by a button press, they then take 1/2 an hour to fade fully up, run for 7.5 hours and spend the next 1/2 hour fading down. A button press while on begins the fade-down sequence immediately.
    • The lights fade up Red first, then the Green/White channel, and finally Blue. The sequence is the same when fading down, Red first, Blue last.
    • If the tank temperature rises above 28C the lights fade down to reduce their heating effect, by 30C they are fully off.
  • The button has a 1 second de-bounce / hold-down time delay to avoid accidental operation, when pressed during the fade up/down cycles it accelerates them so they complete over a few seconds. 
    • During the main 'on' phase it can be pressed and held to run down the timer, useful if the tank is reset during a water change, etc.
  • The (optional) fan will start to run at 33% when the temperature exceeds 27C, it will speed up proportionally over the next two degrees until it reaches 100% at 29C.
    • The fan also 'pulses' at 33% for 30 seconds every five minutes when the lights are on to cool down the air-gap under the lid and improve oxygenation, when the lights are off it does this every 20 minutes.
  • The (optional) lid switch is actually on the feeding hatch. It plays a notification when opened to alert staff if a guest is 'fiddling'.  There is a lid reminder beep every five minutes while open.
    • While the lid is open a button press triggers a maintenance mode which disables the fan and fast-fades the lights off, closing the lid exits this mode.
    • If the lid has not been opened for 24 hours a notification beep sounds every five minutes and the display says 'Please Feed", after 48 hours it is three beeps every three minutes, and displays 'Feed us Now'. 
    • All delays and trigger temperatures are clearly defined, commented and modifiable in the main code file, hardware definitions are broken out into a separate pin definition header file.
  • A full serial debug and logging interface is provided, button and lid actions can be simulated. All system data is periodically logged in a defined format with millis() timestamps. All user and automatic actions are recorded and timestamped too.

gzip - 14.10 kB - 01/23/2021 at 13:47


Zip Archive - 16.30 kB - 01/23/2021 at 13:47


Zip Archive - 16.40 kB - 10/20/2020 at 14:49


gzip - 13.86 kB - 10/20/2020 at 14:49


Zip Archive - 15.59 kB - 07/28/2020 at 14:57


View all 6 files

  • v3.1 is a thing

    Owen01/23/2021 at 13:47 0 comments

    I've just created a roundup release (v3.1) with some UI fixes in it relating to maintenance mode; this is the code version I currently run and it is proving stable and reliable.

  • A new release, alarm/alerts have been added

    Owen10/20/2020 at 14:55 0 comments

    IA few months down the road and I realised I wanted to add some alerts; for over and under temperature. Really designed to give some protection from heater failures, 

    I also removed the 'off' function, totally unneeded and easy to hit accidentally. Now I just say 'already on' and go straight to the countdown reduce (speedup) function.

    Apart from that, and some tweaks to the loop timings, syntax etc. It's unchanged. But I decided to make this a major release since It seems like a good point to do that.

  • Complete

    Owen07/28/2020 at 14:56 0 comments

    V2.2 has been released, get it from GitHub or the files section.

    I think this is it; I've been running the tank for several months and using it myself, getting feedback from the staff at the shop, etc.. And I just committed a final few changes based on that.

    I have one (self pedantic) change I want to make, to make the optional hardware easier to configure and more consistent in how you do it. So a there may be a v2.3, but I do not currently plan on doing any further work on the functionality.

  • Close to Finished.

    Owen06/23/2020 at 20:06 0 comments

    I now have a lid switch fitted to the aquarium (a waterproofed reedswitch triggered by a magnet in the lid flap)

    And I have done a load of work using the time loops I implemented in v2.0 to add reminders for Feeding, simple beeps and a message after 24 hrs, more aggressive beeps and message after 48 hrs. Opening the lid clears the message.

    The lid plays a tune when opened and beeps periodically as a reminder until closed.

    When the lid is open pressing the button triggers a maintenance mode which fades the light rapidly off and disables the fan until the lid is closed, 

    Finally; long pressing and holding the button when the lights are On rapidly decreases the on timer to allow a shorter off period to be set if power was turned off during maintenance.

    I'll test this on my proto-board and then on the actual tank. If all is good I'll release v2.1 and mark this complete for now.

  • 2.0 is nearly here

    Owen06/02/2020 at 13:56 0 comments

    Significant work has been done,

    The internal 'loop()' of the code has been re-worked to implement a state machine based on the LED status, and running at a fixed(ish) rate. Lots of timers are then used to check temperatures, adjust fans, sense buttons etc. The new architecture has made adding new features (lid open/close, feeding reminder) later.

    Auto off after 7.5hrs is implemented, with a countdown timer.

    (Demo/Debug rig with a Teensy Pro (5v+FTDI) that I develop on.)

    Hardware-wise the LCD backlight drive now comes from the spare PWM pin on the board. Allowing the backlight to be faded down at night.

    This also involved changing the sound library to a 'timer free tone' version since using tunes was killing the PWM signal to the backlight *and* the fan... not good. But the solution is quite nice and I have swapped out the cheezy tunes fro some simple ones based on the WindowsXP system sounds :-)

  • V1.1 is out

    Owen04/11/2020 at 10:30 0 comments

    Ok; So I have got the first 'production' release out.

    The tank now has a fan and ducting installed. The problems with the sound circuit are resolved (and the Hardware/PCB has been updated for this) .

    I've implemented Fan and Sound subsystems in the software, complete with status displays and a 'speedup' for the light on/off cycle.

  • Up and Running (Mk I)

    Owen03/06/2020 at 14:44 0 comments

    So; V1.0 is running on the Aquarium, the LED strips (ones sold as Aquarium strips, very dense LED's) give an excellent light. 

    Temperature (only water, at present) is displayed/updated by a once per second loop, the lights run up or down following a button press ; no clock, this aquarium is attended all day. 

    There are four strips, two are RGB, one bright white and one warm white. The Green and White channels are bonded together, the Red and Blue are independent. During fade-up and Fade down the Red channel runs first, then the Green/White and finally the Blue. The whole process takes half an hour or so. The LCD shows the light and cycle status.

    There is internal ducting in place for a fan/ventilator system, but the fan itself needs fitting, the case needs securing and then some Software work is needed to implement fan cycling, light auto-off, maintenance mode and lid alarms.

    The Audio circuit needs a re-work, there is a speaker in place in the case but the driver for it is overloaded (gets VERY hot) so it is currently disconnected while I breadboard up and then implement a solution.

  • A case for this

    Owen02/23/2020 at 20:41 0 comments

    A Case has been made, and added to the hardware repo (in the 'Case' folder..

    I've also added a tiny little spacer piece to level the LCD display in the case.

  • Hardware Buildup

    Owen02/11/2020 at 14:57 0 comments

    Finally getting round to an initial build-out. 

    I must /fix/ the speaker circuit while doing this, the transistor is badly biased and gets too hot.

  • It works; now for some uploads and details

    Owen10/20/2019 at 18:18 0 comments

    Okidoki, No decent pictures yet, but I have assembled the board, got the arduino working at 8Mhz (IDE tricks, I'll document). I'm only running at that because I have several 8meg crystals and this is an ideal project to use them up. Speed is not a factor here.

    I've tested the LCD, but still need to test the mosfets, speaker and all other ports, a conductivity test with my multi-meter showed no faults or shorts. The unit also powers and runs off a 24v supply with no problems. 

    One Issue is that I forgot that manual resets are a 'thing', so I'll probably add a connector point for a reset pulldown switch before I publish., there is plenty of space in that area of the board.

    I also see bigger changes I'd like to make for the v2 board, which is theone I intend to build for my home aquarium. I will move the CPU more central to give more space around it, duplicate the I2C and Onewire port connectors, bring out even more 'spare' io lines, possibly add an ISP connector.  But I plan to keep the power in/out connectors and FTDI in the same place, and keep the same 70x70 mountholes and 80x80 form factor.

View all 13 project logs

Enjoy this project?



Similar Projects

Does this project spark your interest?

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