Aquarium LED Control System

Posted on Posted in Electronics

Control System

At first, I was going to use ATMega to control the system since it can support 6 PWM channels and include multiple ADC pins which would allow direct control through the use of potentiometers.  A DS1302 real time clock would support scheduling and persisting the time during power outages.  This plan was perfect, but then I received another requirement.  It should also allow control from mobile devices.  It’s certainly possible to connect it to the web, but the price starts to jump and it becomes considerably more complex.

Back to the drawing board…  The new design would use a Raspberry Pi connected to the home network (via wifi) to serve up a web UI and control the lights.  It definitely makes the web control part easier.  On the other hand, I was hit with another paradox of choice.  Which language should it use?  Which web server should be installed?

In the end, I decided to use NodeJS because it would allow development and debugging to be performed on almost any platform (plus I want to try it out).  The web application is built using Locomotive (, which builds on Express (  PWM Control is handled by using pi-blaster (  The module that controls PWM detects the system to emulate PWM if it is not running on the Pi.  In order to communicate between the process, I chose to use Redis Pubsub instead of sockets because it would allow easy integration with other systems (even distributed), and Redis would serve as a the persistence layer to save settings and schedules.

System Diagram
System Diagram


The software is coming along, but it’s still a work in progress.  Direct control of the lights is available through the following interface.  The swatch on the right is  supposed to emulate the calculated light color, but it doesn’t really seem accurate.  The software supports up to 6 channels, but the hardware only has 5 channels so far.  Eventually, the remaining channel will probably be used for ultraviolet.

DirectEach channel can be individually defined and the lights update in real time as the sliders are changed by queuing AJAX posts back to the controller.  From there, the controller publishes a message via Redis, and the PWM driver receives the message and updates the lights.


The direct control is kind of nice because it provides instant gratification, but the real star of the show is the ability to schedule the light settings.  The light schedule is defined by placing individual settings on a 24 hour visualization.  The representation blends the light settings, again to

Schedule ChannelSettings