Connected Aquarium

The goal of this project is to create a connected aquarium that allows you to check its parameters (temperature, water level, pH) wherever you are with your computer or your smartphone.

You will need the following material to do this project:

Step 1: Set Up the Web App on IBM Cloud

Go to the IBM cloud website and follow the instructions below:

  1. Click on "Create an IBM Cloud account" on the left if you don't have one yet.
  2. Once your account created, log in and click on "Create resource" in the top right corner.
  3. Select "Internet of Things Platform Starter" in the "Starter Kits" tab.
  4. Enter an app name in the correct field and set all plans to Lite (make sure the location field is set to London).
  5. Click on the "Create" button in the bottom right corner when all is ready.

Once the app is created, go to "Resources List" in the top left menu and follow the instructions below:

  1. Select your IBM Watson IoT Platform service in the Cloud Foundry Services section (it should be something like appname-iotf-service).
  2. Click on the Launch button to access the service.
  3. Go to the Apps section in the left menu.
  4. Click on Generate API Key in the top right corner.
  5. Enter a description and an expiration date (not mandatory).
  6. Click on Next and select Standard for the API key type.
  7. Click on Generate Key (!!! Note the token somewhere because you won't be able to retrieve it after).

The API key and the token will be used to connect the Sigfox backend and your user interface that will be set with the following instructions:

  1. In your resources list, select your app in the Cloud Foundry applications section and click on Visit App URL.
  2. Set up the login and the password for the Node-RED editor and access to it.
  3. Erase the current nodes and select Import->Clipboard in the top right menu.
  4. Copy the content of the flow.json file and validate.
  5. Double click on Sigfox data in the App flow and select the pen next to the Sigfox field.
  6. Enter the key and the token you created earlier.
  7. Validate and click on Deploy in the top right corner.
  8. When the deployment is OK, go back to the main page.

On this page, you will get instant values and variation graphs of your aquarium parameters.

Remarks:

  • The default content is in French but you can of course change it in your language by editing the Web page node in the Node-RED editor.
  • At this step, you can't see any value because we haven't set up yet the Sigfox backend and the electronic circuit. It will be done in the next steps.
  • You can change the gauge ranges by editing the script part of the Web page node in the Node-RED editor.

Step 2: Set Up the Sigfox Backend

The goal of this step is to create a link between the aquarium and the IBM Cloud platform. The following instructions will help to set up this link:

  1. Go to the Sigfox Activate website and follow the instructions to activate your Sigfox DevKit (you will need the ID and the PAC numbers provided with the kit)
  2. Once the device registered, login to Sigfox Backend
  3. Click on Device type in the top menu and select the device name
  4. Click on Callbacks and select New in the top right corner (Select IBM Watson IoT Platform for the callback type)
  5. Fill API key and Auth token fields with those generated in the previous step
  6. Fill Custom payload config with temp::int:8 water::int:8 ph::float:32 and set the JSON body with { "temp": {customData#temp}, "water": {customData#water}, "ph": {customData#ph}}

Step 3: Compile the Code for the STM32 Microcontroller

The aim of this step is to program the STM32 Nucleo L432KC board in order to retrieve the data from the sensors and send them to the BRKWS01 Sigfox module. For this, you'll have to follow the instructions below:

  1. Go to the Mbed website and and select Create an Mbed account to get started if don't have one yet.
  2. Log in and select My console in the top right menu.
  3. In the My hardware section, select Add more and search for the Nucleo-L432KC in the Boards menu
  4. Open the Mbed IDE in order to create the program.
  5. Click on New in the bar menu, select Empty Program for the template then click on OK.
  6. Click on Import in the bar menu and the search for the official mbed library in the Libraries section.
  7. Make sure Import as is set to Library, Target path is set to your program name and the update option is enabled. Then, click on Import.
  8. Repeat instruction 7 for the NeoPixel library.
  9. Go to the Upload section and import all the files in this ZIP file to your program.
  10. Go back to your program, click on Compile and download the binary file.
  11. You can now upload the file to your MCU by dropping it to your device with your file navigator.

NB: If you use Windows, you may have to install the Mbed driver if your computer can't detect the device.

Step 4: Make the Box and the Electronic Circuit

The goal of this step is to customize our aquarium and make it connected as shown on the pictures above.

Note that you will need 2 power supplies for the aquarium:

  • For the STM32 board (it will supply the temperature and water level sensors with the 3.3V pin)
  • For the LED strip and the pH sensor

The electronic circuit you have to make is detailed in this picture. (Note that the Arduino Nano used in the schema has the same pinout as the STM32 L432KC, only the USB connector is switched).

For the water sensors, you'll need to follow the instructions below:

  1. Empty your aquarium
  2. Make 2 holes in one of the wall as shown in the 1st picture above
  3. Use silicone or something that can make your holes waterproof
  4. Let dry
  5. Fill your aquarium with water

Once your circuit soldered, you can put it in the box (you'll may have to make holes to plug the sensors later) and paste it against one of the wall of your aquarium. Then paste the LED strip all around the aquarium. Finally, branch all the sensors, the antenna for the Sigfox module and put the pH and temperature sensors in the water.

You can now power on your circuit (branch the LED first, then the microcontroller) and watch the result.

Enjoy!!

Share

    Recommendations

    • Epilog X Contest

      Epilog X Contest
    • Build a Tool Contest

      Build a Tool Contest
    • Tape Contest

      Tape Contest

    Discussions

    0
    None
    audreyobscura

    4 weeks ago

    Thanks for sharing your build!