Smart Fishtank Project Ongoing Build Log


Planned Features

I’m planning a smart fishtank system with these features:

  • detect and record feeding frequency
  • record light intensity and time of lighting inside of tank (through the glass)
  • record temperature

Why Build a Smart Fishtank?

The tank is in my office and there are four possible people that feed the goldfish on a daily basis. As we do not coordinate feeding schedules, it is possible to overfeed or forget to feed the goldfish.

Physical Device Mounting and Power

I’m looking into a mount point on the side of the tank.

There is already a filter there, so it looks like a decent place to maintain the aesthetics of the tank.

I’m using the Renesas battery for initial tests. I charge it with my powered USB hub, then, move it to the tank for testing.

As the tank filter is powered by an AC power source with a AC plug right below the tank, it will be easy to convert the demo to power from an AC adapter.


I’m planning to use these values

  • temp, light, humidity from AMS Environmental Sensor (part of IoT Fast Prototyping Kit)
  • vibration from board

My current tank has a digital temperature sensor.

The current sensor is not smart and doesn’t provide data logging or remote access. It does have the advantage of having the sensor submerged. For the AMS environmental sensor, I’m going to stick it to the outside of the tank so I don’t have to deal with building a case for it. I could just use a test tube and put the sensor in the tube and keep the mouth of the tube above the water. I would still need to mount the test tube to the inside of the tank.

As I have a submerged sensor as a data point, I can compare the temp sensor on the AMS Environmental sensor on the outside of the tank to the values on the sensor inside of the temp. I can then adjust the values with a Python script if I need to.

Based on our last experiments with vibration using the Smart Chef demo as a basis, I’m hoping that the S3A7 board itself can be used to detect the vibration of the door opening. I’m wondering if the velcro on the board will interfere with vibration detection. I plan to have the board on the tank cover and not on the door.


Initial Build Steps

I had to stop the build after the initial setup due to a hectic schedule today. The project looks feasible and I anticipate I’ll finish it this month.

Here’s the initial part of my build guide. I’m using the Smart Chef board binary as the basis of the smart fishtank.

If you haven’t done so already turn off the board and and plug in the BOSCH BMC150 module.

Plug the S3A7 in and click on the blue rectangle to setup the board.

When the provisioning server is running, you will see the SSID and the Key in the upper right-hand corner. This is the information you need for your desktop workstation.

My desktop workstation is Windows 10. First, make sure you open up your email program and have the email from Renesas open with the MQTT and other credentials. It will look like this.

With that tab open, reconfigure your desktop WiFi. You will lose Internet access. Select the WiFi access point indicated on your board.

Input the password shown on the S3A7 screen and connect.

Connect to with a browser and input your credentials. The API Key usually spans two lines in your email. Make sure you copy the entire key with no line breaks. The WiFi SSID is your home or office WiFi router.

You will see an error message. Keep calm and carry on.

Your board will give your more confidence.

Reset board

Go to the Workflow Studio and select Set Vibration Aggregate Windows

Change the aggregation_window to something low like 5000 milliseconds for testing. In this case, I have it set to 100,000 milliseconds, but I suggest you set it lower.

Activate it.

Vibration data starts flowing in.

I’m probably going to put the Renesas BMC150 board on wires and tape it onto the fishtank door.

Smart Door Foot Traffic Analyzer Tutorial

Mounting Board To Get Usable Sensor Readings (BMC150)

For prototyping purposes, I mounted the board to a piece of cardboard. Place board on top of cardboard. Use pencil to mark mount holes. Use screwdriver to punch holes.

Use zip ties to secure the S3A7 to the cardboard.

trim tag ends with wire cutter.

Use daughter’s duct tape to secure the base onto the tank.

Confirm that lid hits board when it opens.

Test with IoT Sandbox - It Failed

Unfortunately, when I logged into Medium One, I wasn’t able to easily detect the opening and closing of the door to feed our fish. I decided to change the mount to make the opening super-obvious.

Mount with Super-Easy to Detect Position Change

I had to sacrifice my daughter’s roll of glowing orange duct tape and even had to rip into her rainbow duct tape stash. In the end, I had a hinge.

This movement is easy to detect. :slight_smile: It’s not subtle at all. No need for fine-tuned edge detection :microscope:

It’s even quite usable. The fish can be feed and the cover is nice and secure.

Z-Axis Detection Obvious Opening

After a few brief tests, I was satisfied that I could detect a change in door position.

The next step will be to go onto Medium One and customize the workflows, alerts, and report of goldfish feeding…


I only had a few minutes to work on my fish tank today. I focused on configuring the alerts just to get familiar with the Medium One workflow.

I have the email alert configured with the subject line Magic Fishtank Speaks.
The email sender is Magic Fishtank Genie.

The default notifications are that the fish tank monitoring system went offline or came back online.

Email and mobile notifications were super-simple to set up with Medium One. It’s so fun and rewarding for little effort. I hope to carve out some time tomorrow to dig into the workflows more.

Just to show you how easy it is, I’ll continue my build log and show you what I did.

In the existing Smart Chef Demo workflow, I went to the Monitor Offline workflow and double-clicked on the Base Python blue rectangle.

Using the online web-based Python editor, I went to the IONode.set_output strings starting at line 57. These are just text strings for your message. You can type anything you want.

Make sure you click Save and Activate

You need to reboot the S3A7 to activate the new workflow.

Before rebooting, I also modified the Send Notifications workflow.

Double-click on the blue Base Python rectangle to open the editor.

Edit line 59 with the text string of your choice.

I also modified the Get Weather workflow to send out weather alerts. I don’t have the AMS Sensor plugged in now, but will mount it tomorrow (hopefully)

Tomorrow, I’ll try and mount the temp sensor and look into getting readings on the board for tank conditions. The text is a bit small :frowning:


I took another look at the AMS Environmental Sensor that came with the S3A7 IoT Fast Prototype Kit and think that the included Grove wiring will work for my project. I’m thinking of using duct tape on the wires and mount the sensor to the top of the lid for prototyping. Once I get it working, I may build a mount for a test tube to submerge the sensor inside the tube to get a more accurate reading.

As I was pondering this, my son walked in to feed the fish. I noticed on my IoT Sandbox dashboard that the existing Chef Demo has impact detection and that I could use this for the readings instead of the z-axis.

Based on this, I modified the workflow to get a working feeder detector.

Now, I have something pretty close to what I want in terms of functionality. I can get email alerts of when the fish were fed that I can use as a log.

In addition to email alerts, I’m also getting mobile alerts of when my goldfish were fed.

I also added the AMS Environmental Sensor to the fish tank lid with some boss duct tape.

Here’s a closeup of the AMS Sensor mount.

The door is still functional. Once the tests operate, I may make a more normal door attachment.

I’ve started to adjust the text on the screen of the S3A7 to make it more fish tank-centric.


I got back from vacation and the big news is that the goldfish are still alive. There are actually three fish in the talk, but the third fish is all black and is camouflaged by the black gravel at the bottom of the tank. It’s like a ghost that flits about the tank.

In order to prepare my son to configure the workflow and optimize the reports and alerts, I asked him to go through the S3A7 Smart Chef Demo. He ran into problems connecting to the S3A7 board in provisioning mode and configuring the board through the web browser on Windows 10. He was able to configure the S3A7 board with his Moto-G phone running Android. Once he rebooted the board, it fired right up, connected to the router, and used MQTT on top of TCP/IP to download stuff from Medium One. I’m not quite sure what that stuff is comprised of right now, but I hope to learn in the coming weeks.

The Smart Chef Demo was easy for him to go through. I’m hoping that since he’s familiar with Python, the learning curve will be easy.

After he finished most of the Smart Chef Demo with his own Renesas IoT Sandbox account, I reconfigured the board to use my account. Right now, I’m sharing the same board with him without problems. If anyone else wants to get their kids involved with learning IoT, I recommend you give it a go. My son is a senior in high school and I think they need to be about this age and able to program.


Fish still alive, woohoo!


I spent a few hours working with my son to start configuring the workflows. He was able to configure notifications and tuned the door opening in the Detect Impact Vibration workflow. He configured the impact_threshold to be 1.5 instead of 2 G. This seems to detect even a gentle closing of the fish tank door. At 1.5 G, there is no problem with false vibration detection. I put the food container on top of the tank or hit the top without triggering an alert that the fish were fed.

He got stuck with the Smart Chef Get Weather Workflow. After we solved the problem, I built a little challenge for him to go through on Sunday.


Modify initial boot screen with custom text on lines 5 and 7. It should look similar to the screen below.

Open GetWeather

Modify the GetWeather workflow. Access it from the Workflow Studio. I changed the name of my workflow to Fishtank Get Weather as a reminder to myself that I modified it.

This is the workflow that has this comment at the top:

This workflow uses the ip address of the board to get the lat/lon, which is then used to get the
local weather condition.  This happends when the board first connects to Medium One.  A 
notification is generated based on the weather conditions.  Limit to 1 look-up hour unless the IP 
address changed.

Edit Python

For testing purposes, change the variable time_between_notifications on line 20.

# set the time between notification (unless IP changed) (default = 3600s = 1hr)
# time_between_notifications = 3600
time_between_notifications = 10

Change the string for LCD screen line 5 with the variable screen_msg

# prepare message for board display
screen_msg = "Aquarium: " + str(current_weather['main']['temp'] - 273.15) + "C " + str(current_weather['main']['humidity']) +"% Humidity " + current_weather['main']['condition']

# send notification to board
IONode.set_output('out3', {"message": screen_msg, "screen":True, "line":5})
IONode.set_output('out4', {"message": "I love goldfish", "screen":True, "line":7})

The max length of the line is pretty short, so the entire string may not fit. Figure out how to make it longer later.

The “I love goldfish” string to LCD screen line 7 is controlled by IONode.set_output('out4'...

out4 does not exist. You need to create it.

Add Output

Click the arrow by Inputs/Outputs at the top of the Python editor.

The Inputs/Outputs section will expand into this:

Use the blue Add Output button to create out4.

Save and Activate

Graphical Workflow Editor

Return to the graphic editor with the green, blue and orange boxes.

On the right hand side, click on the three row hamburger menu.

Select Processed Stream - Single

Use mouse to connect out4 and in1

Double-click on the new Processed Stream. Edit.

Save and Activate

Reboot S3A7 board on top of fish tank.

If it works, change the time_between_notifications variable back to 3600

time_between_notifications = 3600
# time_between_notifications = 10

If you don’t change the variable back, you will consume all of your free Medium One workflow credits and your project will stop working.

You can check your Workflow Credits used in Setup -> Project Info

These are daily limits. Your credits will reset the next day. You have 10,000 free Workflow credits a day. In addition to the dashboard, you will also get an email alert if you exceed the limit today.

Test of Tutorial

My son was able to go through the tutorial above in 10 minutes with no other help. He’s currently working on the custom email reports using the Medium One blog post.


I eventually want to get a custom email report of fish feeding, temp and environmental conditions. Read the article on custom email reports.

As part of the next challenge, use this graphic with customized charts.


I’m about to take a break and eat some poke bowl. The initial test of simple HTML went well. I need to get th graphs working next.


I haven’t completed my fishtank IoT device, but my friend sent me this link to a fishtank monitor.

This is just video data, but I think they really need IoT data. Might be useful for pet shop or a pet fish breeding system.

It’s pretty tempting to integrate this with the Renesas board and incorporate some sensors.


Oh wow, a quick visual check of your fish tank would be a good way to confirm their health status. :slight_smile:


such as whether they’re floating upside down? That’s a definite indicator that they need to be fed.