Skip to content

goodbuns/fishmon

Repository files navigation

Fishmon

fishmon is a monitoring system for my home fish tanks. It runs on a Raspberry Pi 2 Model B connected to a set of DS18B20 temperature probes. Fishmon constantly takes readings from those probes and uploads them to feeds on Adafruit.IO.

Usage

Setting up your Raspberry Pi

Fishmon is only tested on Raspbian systems running on Raspberry Pis.

On some systems, you will see failures when trying to load the w1-gpio and w1-therm kernel modules (if you see an error when you modprobe w1-gpio, this probably affects you). On these systems, you need to first enable the 1-Wire GPIO device tree overlay: update /boot/config.txt, ensuring that the dtoverlay=w1-gpio boot option is set (append this to the end of /boot/config.txt). See the Device Tree Overlay documentation for details.

Connecting your temperature probes

The Adafruit DS18B20 lesson is a pretty great tutorial, and should cover everything you need. Note that multiple 1-Wire sensors can be connected on the same data and power connections. For example:

DS18B20 breadboard

Running fishmon

Fishmon requires an Adafruit.IO username and API key. To run Fishmon:

fishmon -aio_username=YOUR_ADAFRUITIO_USERNAME -aio_key=YOUR_ADAFRUITIO_KEY

You can keep fishmon running after your session exits using standard Linux tricks:

nohup fishmon -aio_username=YOUR_ADAFRUITIO_USERNAME -aio_key=YOUR_ADAFRUITIO_KEY &

See fishmon -h for details.

Configuration

In order to upload data to Adafruit.IO, fishmon needs to know which feed to send data to for each probe. This is configured using a JSON file, which fishmon will look for by default at fishmonconfig.json.

You'll need to create your feeds on Adafruit.IO to get the feed keys for configuration.

This file contains configurations for each probe:

{
  "version": "1", // For future-proofing.
  "probes": {
    // Each probe is identified by its device file name.
    "28-02089245bf26": {
      "name": "left tank", // This field is just for personal usage to help you
                           // remember which probe this refers to.
      "feed": "fish.left-tank" // The Adafruit.IO feed key for this probe.
    },
    "28-020b924565c7": {
      "name": "shrimp tank",
      "feed": "fish.shrimp-tank"
    }
  }
}

See the example file at fishmonconfig.example.json for details.

Developing

Run make to build locally. This isn't super useful. There are no current mock implementations of RPI-specific sensors.

Run RPI=RASPBERRY_PI_USER@RASPBERRY_PI_HOST make deploy to deploy. The deployment script just builds an ARM binary and scp's the binary over.

See GoDoc for documentation.

Future work

At some point, I would like to set up uptime alerts (so I know when fishmon dies) and temperature alerts (so I know when to take action).

License

Fishmon is licensed under the terms of the AGPLv3.