Fish Tank Monitor

This page describes how to set up a fish tank monitoring system. It measure water temperature, pH, air temperature, and light levels. It transmits the data into a ManyLabs data set. Take a look at the data set from our fish tank.

Note There are two versions of this system. One uses a SODAQ and WiFi Bee to send the data, the other uses an Arduino Uno and Ethernet Shield. In each section below, if there are differences in the setup they'll be noted. Make sure you're following the instructions for the hardware you have.

Materials

  • fish tank and accessories
  • fish (our tank has small goldfish)
  • temperature probe (DS18B20)
  • pH probe and controller board (not included with kit)
  • DHT22 temperature and humidity sensor
  • digital light sensor
  • OLED display
  • Grove cables

Sodaq Version

  • Sodaq
  • WiFi bee

Arduino Uno Version

  • Arduino Uno
  • Ethernet Shield
  • Ethernet cable
  • Grove Shield

Steps

Calibrate pH Sensor

If you're not using a pH Probe, you can skip this section and start at Prepare Hardware

  1. Connect your pH sensor to the the SCL/SDA socket (Always On) on the Sodaq board.
  2. Connect the Sodaq board to the computer.
  3. Open the Sensor Plotter.
  4. If the Sensor Plotter prompts you to select your microcontroller, select PDR / Sodaq in the Microcontroller drop-down. Then select the port and click Send to Arduino
  5. Click More Actions, then Add Sensor.
  6. Search for and select Mini pH Sensor.
  7. Click Add. You will be prompted to reprogram your microcontroller.
  8. Click I'm Done. The Sodaq will be reprogrammed.
  9. Place the end of your pH probe in pH 7 calibration fluid. When the value stabilizes, make a note of it.
  10. Rinse the probe with distilled water.
  11. Place the end of your pH probe in pH 4 calibration fluid. When the value stabilizes, make a note of it.
  12. Disconnect your pH Sensor from the Sodaq.

Prepare Hardware

Sodaq Version

  1. Place the WiFi Bee onto the Sodaq board.
  2. Connect the temperature probe to D2/D3 (Always On).
  3. Connect the DHT22 temperature/humidity sensor to D4/D5 (Always On).
  4. Connect the OLED to SCL/SDA (Always On).
  5. If you have a pH probe, connect it to the other SCL/SDA socket (Switched).
  6. Place the temperature probe and pH probe in the fish tank. Secure them with a binder clip.

Arduino Uno Version

  1. Attach the Ethernet shield to the Uno.
  2. Connect the ethernet cable.
  3. Attach the Grove shield on top of the Ethernet shield.
  4. Connect the temperature probe to D2.
  5. Connect the DHT22 temperature/humidity sensor to D6.
  6. Connect the OLED to an I2C socket.
  7. If you have a pH probe, connect it to another I2C socket.
  8. Place the temperature probe and pH probe in the fish tank. Secure them with a binder clip.

Prepare Data Set

  1. Use the data hub to create a data set with these fields (in this order):

    Field Name Field Type
    timestamp timestamp
    pH numeric
    water_temp_c numeric
    air_temp_c numeric
    light numeric

  2. While still in the data set editor, select Remotely Updated.

  3. Make sure the Data Entry Mode is set to anyone can enter data. You can set the Sharing Mode to any of the values.
  4. Save your data set.
  5. Find you data set in the data hub and click view. The URL of the page will be something like: https://www.manylabs.org/tool/dataLab/?dataSet=464. The number at the end of the URL is your data set id. Make a note of this.

Prepare Arduino Sketch

Sodaq Version

  1. Make a copy of the Fish Tank Monitor Sketch.
  2. Replace the PH_7_VALUE of 2048 with the value you noted earlier for pH 7 calibration fluid.
  3. Replace the PH_4_VALUE of 1286 with the value you noted earlier for pH 4 calibration fluid.
  4. Replace the network, password, and dataSetId values. The network and password values are strings and should be surrounded by quotes. The dataSetId value should be a number without quotes.
  5. Plug the Sodaq board into your computer. Turn it on using the small sliding switch.
  6. Send your sketch to the Sodaq board. Be sure to select PDR / SODAQ from the microcontroller list, then click Send to Arduino.

    Note You will have to disconnect the WiFi bee from the Sodaq board to send the sketch. Gently pull up on the bee until it separates from the board.

Arduino Uno Version

  1. Make a copy of the Fish Tank Monitor - Uno and Ethernet Shield Sketch.
  2. Replace the PH_7_VALUE of 2048 with the value you noted earlier for pH 7 calibration fluid.
  3. Replace the PH_4_VALUE of 1286 with the value you noted earlier for pH 4 calibration fluid.
  4. Replace the dataSetId value. The dataSetId value should be a number without quotes.
  5. Connect the Uno to your computer.
  6. Send your sketch to the Uno. Be sure to select Arduino Uno from the microcontroller list, then click Send to Arduino.

Exploration Questions

  • How does the fish tank temperature change with time of day?
  • Does the temperature change with day of the week?
  • What is a safe range of temperatures for your fish?
  • What is the relationship between temperature and light?
  • How does light change with time of day? Does sunlight or indoor lighting cause a bigger change?
  • How does pH change with time of day? What could cause changes in pH?
  • What is a safe range of pH values for your fish?