Project Code

This is a spiritual successor to my fish light controller from 2018

GobyBox is my aquarium light control box which adds remote control, smart scheduling, and other IoT features to otherwise bog-standard DC light bars. Not for use in actual bogs. This is an express overview of the build process for the GobyBox project:

  1. I first developed custom board around the ESP-32 and IRLB8721PBF mosfets
  2. I modeled and 3D printed a simple chassis for it
  3. I wrote firmware in C to communicate controls and state changes over MQTT
  4. I finally created a mobile app in React Native to control and monitor the box remotely

Each step of the process is detailed below in their own repo with accompanying code. An extremely rough “store” page can be found on gobybox.org

Hardware

I used easyeda to design the board, and had it printed (several times, with revisions…) at JLCPCB.

A few minutes after reading what mosfets do, I bought a dozen of the IRLB8721PBF, after discovering it could handle the amperage going to the 12V-24V DC light bars.

I don’t have a passion for board design. If I had a reflow machine, I’d ensure the body of the mosfets were soldered to the board for better heat dissipation. But I won’t own a reflow machine.

The 3D box model is relatively simple, with a knurled knob for spinning and pressing. I enjoyed making the decorative scales that surround the box.

box.png

Firmware

The firmware for the GobyBox is built for the ESP-32 on the PlatformIO project. It includes several libraries for handling various hardware features/sensors, but implements a fairly custom MQTT service.

All control / status updates are made over MQTT. This ensures a single encrypted connection maintained to the server, rather than making a flurry of requests that the ESP would unlikely handle reliably.

The most interesting code would be in main.cpp, where MQTT messages are handled.

App


The mobile app for GobyBox gives the user control and information over the custom hardware. It allows setting light schedules, lighting effects, and more. Specific light timings allow gradually turning the aquarium lights on, instead of an instant-on which would shock the fish.

It utilizes the React Native MQTT library to control the board without much overhead, beyond the mosquitto instance already operating on the server.

There’s an opaque instance of user auth running on the server as well, which is used here to log users in by email. Everything else is handled by MQTT, this app and the board itself share the same MQTT schema.

If I were to do things differently, I’d use Firebase (or supabase) for user auth and settings.