As mentioned before, a Raspberry Zero W (Raspi) is used as the computer. It runs Raspbian which has the need feature of an overlay file system in its config. This makes it very robust if a voltage drop occurs. This happens once every week when the extension cable with the heater, the filter-pump, and the lights, is deliberately unplugged for a water change or filter clean-up. In the beginning I wanted to have

  • One temperature sensor
  • Webcam
  • Light
  • Cooling fan
  • Dashboard to set the on-off-time
  • Send information per e-mail

In the end I skipped the fan. It was not necessary, and I needed the spare relays for more lights. I “programmed” everything in Node-RED. It is very easy to use and usually there is a node for everything. The flow of the whole system is attached to this project.

Temperature sensor:

For the temperature sensor I used the ds18b20 which is connected to the one-wire bus of the Raspi. The usage and the connection are straightforward. You need a 4k7 resistor between the 3v3 and the data signal. The data wire is then connected with the GPIO 4 of the Raspi. When the one-wire bus is enabled in the raspi-config, a device can be found under /sys/bus/w1/devices/<device_address>. The temperature is read with “cat /sys/bus/w1/devices/<device_address>/temperature” and added to the e-mail.


Here I had the problem that the cam node was too fast when taking a picture of the aquarium, so the picture was too bright. The cam needed more time to adapt to the light conditions, so I put a delay in the file usbcamera.js of node-red-contrib-usbcamera:  

   function sleep(ms) {
      return new Promise(resolve => setTimeout(resolve, ms));
module.exports = function(RED) {
    const sleepWork = async () => {
        await sleep(200000)
var retry = 0;
            (function () {
                var callee = arguments.callee;
                var Webcam = NodeWebcam.create( opts );
                //Will automatically append location output type 
                Webcam.capture( filefqn, function( err, data ) {


In the beginning I wanted to have just the main light (back then, the only light) turned off and on. This, however, causes an abrupt change from bright light to total darkness if the room around is already dark (in winter, this is the case in the late afternoon). This might be stressful for the fish, so I made an additional softer white and yellow light which can be controlled separately to simulate dawn and dusk.

In the morning it starts with yellow, followed by soft white and the main light. After some minutes, the additional light is turned off. In the evening, the procedure is reversed. For this task, a relay HAT with 3 relays was used.