Project in progress
IoT Aquarium Light Controller

IoT Aquarium Light Controller © GPL3+

Controlling your aquarium lighting with cron, Android, web-browsers and others.

  • 28 respects

Components and supplies

About this project

I've been trying to automatize some tasks related to my aquarium-keeping (such as fish-feeding, light control) while desiring to provide remote access to some of its properties (such as current water temperature and light incidence). With suchlike sensors and actuators, I could:

  • better handle artificial light activation (now I have a mechanical timer controlling it, like almost everybody else, which turns on and off the aquarium's light on scheduled hours), be eco-friendly and only switch it on when truly needed (when natural light is week due to presence of clouds or after sunset);
  • better care of fish-feeding, providing always the same amount of feed sharp on time.
  • cross data between temperature and light incidence over time and be able to look for better places to position the aquarium;
  • ...spare lots of time not having to do all that by myself!

In my earliest attempts, I used a Seeduino with an Ethernet Shield coupled with a stepper motor (being my ration feeder), a LDR(light) sensor, a PIR motion sensor and two relays. I also put, naively, two LEDs and two tactile buttons in the circuit for being able to control it thought a physical interface. I think I put so many components at the circuit that I run out of IO pins in the Arduino. Long story short, I had all kind of troubles (on the top of my mind: insufficient current supply, messy PCB with plenty of short circuit, libraries using the same timers (Ethernet shield, Stepper motor and Timers), Arduino freezing up, lots of frustration and components wasted). Today I see that my first mistake was to be too greedy about the project. I definitely should had been more simple...

Long time ago I played with Raspberry talking to Arduino trough the nrf2411 module. As I have a central Raspberry at home, already remotely accessible and with the nrf2411 module plugged in and ready to go, I decided to take advantage of it instead of using an ESP8266. (nrf2411 is also cheaper and also consumes much less energy).

The plan, this time, was simple. I designed a RGB LED strip with 6x WS2812b that I'd like to remotely control. I designed a case for it using OpenSCAD, 3d-printed and mounted the LEDs in it. Then I covered it with plastic film and hot-glued the edges in attempting to protect the circuit from the moisture it's going to be exposed of.

Assembled 6-RGB-LED strip with plastic film protection and hot-glued ends

Then I simply attached it into the circuit I had already designed. This time I used an Arduino Pro Mini (programmed it using an USB-Serial FTDI cable) and power-supplied it using an old Samsung-phone USB charger of 1A.

Wiring diagram

Using the 3d-printer again, I quickly created a small box for housing the circuit. I put a 3-pin header in it for making it easy to attach/connect the LED strip. With 3 pieces of Dupont wires connected to each other, I managed to create a longer one that can link the LED strip positioned in the top part of the Aquarium till the circuit-case-box hid on its outside.

Housing the circuit

Then I finally installed the LED strip bar in the Aquarium.

This is how my central Raspberry Pi looks like:

Raspberry Pi + nrf24L01 module

In it, I wrote a program which accesses the nrf24L01 and sends RGB signals over the air. As it runs in the raspbian, I can execute it in the terminal. 

ssh connection and remote control

Right now I have it scheduled to run on specific times (turning it on and off) as cronjobs. I also created a (HTML+Javascript) Web interface so I could control it from any browser, even from my mobile phone. As I ended up creating a webservice for this interface, and using browser with a mobile phone is a pain in the butt, I also wrote an Android app to make it faster (this app is supposed to work only when I'm connected to my domestic network, so I don't really expose the control of the LEDs over the Internet so easily).

Control Interfaces

The result:


Source of the software running on the Arduino Pro Mini. Keeps listening on single channel and activates the LED strip when receiving RGB data.
#include <SPI.h>
#include <Adafruit_NeoPixel.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"

#define RF_CE    7
#define RF_CSN   8
#define PIN 6

Adafruit_NeoPixel strip = Adafruit_NeoPixel(6, PIN, NEO_GRB + NEO_KHZ800);

RF24 radio(RF_CE,RF_CSN);

byte myID = 0x01;
byte lastR = 0xFF, lastG = 0xFF, lastB = 0xFF;

struct payload_request_t
  uint8_t number;
  uint8_t destination;
  char message[14];

payload_request_t incoming;

byte last = 0;

void setup() {

  radio.setAutoAck(1); // Ensure autoACK is enabled
  radio.openReadingPipe(1,(uint8_t *) "master");

void setLED()
  for(byte i=0;i<6;i++)
    strip.setPixelColor((uint16_t) i, lastR, lastG, lastB);;

long int temp;

void loop(void)
    {, sizeof(payload_request_t));
        if (incoming.destination==myID)
          temp = (long int) strtol( incoming.message, NULL, 16);
          lastR = temp >> 16;
          lastG = temp >> 8;
          lastB = temp;
Android App source code. Shows an image with a set of colors; identifies and extracts the color of the pixel touched by the user and sends it to a domestic WebService hosted on the Raspberry.
No preview (download only).
Software that runs on the Raspberry and sends information over RF using the nrf24L01 module connected to it.
No preview (download only).
Web Interface (HTML+Javascript) for the ColorPicker + "WebService" (PHP) which invokes the setRGB software
No preview (download only).


Circuit Diagram
Aquarium schem
Boards wiring diagram
Raspberry nrf24 0 o


Similar projects you might like

Controlling LED light intensity using smartphone light senso

Project tutorial by Nikola Travis

  • 5 respects

Arduino Light Controller Using MKR IoT Carrier

Project tutorial by ratack0

  • 3 respects

Pool Controller

Project tutorial by Mike Mackes

  • 142 respects

Making a Cheap Aquarium Parameters Controller

Project tutorial by Boisse Martin

  • 26 respects

WS2812B RC Light Controller

Project showcase by RC Stuff

  • 12 respects

Windows IOT - Automate your power outlets

Project tutorial by Syed Sanoor

  • 56 respects
Add projectSign up / Login