DEV Community

Cover image for Fish Cam : Background, Architecture and Hardware
philbasford for AWS Community Builders

Posted on • Updated on

Fish Cam : Background, Architecture and Hardware

Fish Cam is a ‘pet’ project of mine, it comes from wanting to allow my daughter to see her two goldfish, Goldie and Star in their thank from wherever she is on holiday. In doing so it provided me with a way to play with some of latest technology and AWS services including IoT, Real-Time Data Ingestion and ML @ the Edge.

Fish Background:

So let’s start with what not do to or assume:

  • Goldfish are easy pets for kids to look after
  • It’s very romantic to win them at a funfair
  • Think that a small round bowl or by buying a tank from the fun fair that it will do.

All of this is basically wrong and any respectable pet store will tell you that. I blame cartoons for these falsities. However Goldie and Star where funfair fish that my daughter won about 3 years ago.

In addition I was worried about us becoming Goldfish owners. This was based on myself having previous experience with goldfish whilst growing up. My sister had some and I remembered that they seemed to die very often. So I was very sceptical that they would survive and I kind of knew we had kit them out properly. So we took decision and down to pet store we went to buy a proper tank, filter and pump.

It transpired from the advice given by the store and online research that this experience of fish dying is very common. The reason most goldfish die is due to two basic things:

  • The tank is too small and this stumps their growth
  • The water quality is poor and they suffer disease or suffering, water quality is again related to tank size and regular cleaning

Two very hasty ways two die! Both the owners fault. The reason for this is that goldfish are very “messy” or produce a lot of 💩. Yep it also comes down to the amount of 💩 and how often it is cleaned away. Goldfish need about 35-60 litres (or more) of clean water each, thats a considerable size tank for two fish and it will set you back around £200 in the UK, then your need to clean it roughy every 2-3 weeks. Hence they are not really a low maintenance or child friendly pets. Your pet store will advise all this and in most cases won’t sale you goldfish without an adequate tank and filter.

So what we did was to buy an initial £80 tank (around 45 litres) to get started (that’s still a lot bigger than those round bowls or fairgrounds tanks). Also after a year, once the fish had grown plus we knew what we where doing, then we upgraded to a 65 litre tank (see below).

Alt Text

So my aims of doing the project was also to help monitor the fish and water quality. The fish however gave us their own strong indication that they are happy and healthy fish, as we got eggs this year. Luckily our fish are both female.

Technical Background:

From a young age I have always been into technology and also an inventor of sorts. I am very lucky as lots of my current work is Data, Analytics and ML. However my specific interest in this project and producing a Fish Cam predates this.

In 2017 I worked for another company at the time, leading a cloud migration project and I was lucky enough to go to my first re:invent. It was brilliant and inspiring, lots of what I do today is direct related to those 5 days. For AWS, 2017 was also a big year! And one thing that caught my eye was the DeepLens.

Deeplens from AWS

The DeepLens (as shown in the picture above) is a small device with a camera that allows you to run a computer vision model. You can also connect them to the AWS Cloud as an IoT devices running Linux.

Now at re:invent 2017, according to Andy Jassy, you could go home with one if you did a hands on workshop or if you attended any session of ML track you would get a voucher to buy one when they went GA. So I did a session on SageMaker (also a new 2017 service) and waited for my voucher. It never turned up. Even after asking around my AWS contacts I did not get one and further more it transpired that Amazon would not be able to ship them to UK 😭

That was the end of that! Well until 2019, when my wife and daughters gave me a Raspberry PI 3 for my birthday. I had an old HD webcam in my box of cables, so I wondered if I could build my own DeepLens. So this project is how todo it.


To build your on IoT play device / DeepLens clone you can use a lot of different devices but here is what I used:

Alt Text

Now for future needs you may want to buy a breadboard and some jumpers etc. This will allow you to connect sensors to the PIs GPIO controls and make up circuits. Here is what I purchased (but others will also do)


  • One hair band: My daughters spare hair band to hold the lid on the case

Features and Architecture

Once I had connected up the components I then built the following solution with them and AWS:

Alt Text

The features are:

  • Real Time Video Streaming: One of the key needs from my daughter was that she wanted to able to see her fish swimming their tank from where ever she is on her tablet or my iPhone. For this I used a Kinesis Video Steam, A C++ client to capture the video from the USB camera and send it to the stream, then a client written in HTML 5 Client host in S3, connecting to the stream using HTTP live streaming.

  • Real Time Water Quality: For this I connected a Temperature Sensor DS18B20 to the GPIO interface on my Raspberry PI. I then created an Edge Lambda to read the raw data from the device interface. The lambda then created a JSON message and sent it via IOT Greengrass and IOT Core to a MQTT topic. Then I created an IOT rule for the topic that uses the Cloud Watch Put Metric connector to place the temperature into Cloud Watch. Finally I created a CloudWatch Dashboard that showed the temperature over whatever time period I wanted up to the last minute.

Alt Text

  • Real Time Fish Detection: The ability to detect the fish swimming around a tank in real time. Hay not really a requirement from my daughter, but I was just playing to see how good Rekognition was. So to do this I connected the existing Kinesis Video Steam to Recognition (Real Time) by a subscription that then push its results into a Kinesis Data Steam that I a created. I then created a Kinesis Firehose Delivery Steam pulling data from the Kinesis Data Steam and to save the results every minute to S3.

  • Edge Device and Management: A prerequisite for Real Time Water Quality Dashboards was that I needed to set up my Raspberry PI as a Thing! to do this I had to install Java 11, the IoT GreenGrass V2 software, and run the configuration on my PI and connect it to IOT Core.

  • Remote hands and patching: Lastly I needed the ability to login to the Raspberry PI from a remote location and see what was happening. To be honest VNC cloud works really well for this. Again as this was for fun and for exploring AWS I decided take some advice and also to give the combination of Session Manager in Systems Manager + Fleet Manager (a new toy) ago, therefore I installed the SSM agent on my PI and activated it. This allowed me to access the terminal on the device from AWS and also patch it remotely using Documents and the RunCommand in Systems Manager.


This was a great "pet" project that allowed my daughter to see her fish from anywhere. It also allowed me to explore lots of the capabilities of AWS and linking them together. I am now looking into how to improve the Real Time Water Quality feature to better predict when filters need changing and water cleaning. I also want it to alert me if Goldie and Star are getting too hot (above 26c) or cold (below 20c)

..More blogs to follow that will deep dive into how to do some of the features. However first you need to install your OS and get access therefore see my next blog here

….Finally you can see a demo here

Top comments (1)

pimcliefff profile image

Well, I don't agree with you. Perhaps they are indeed less whimsical than other pets, although this depends on the breed of fish. But at the same time, caring for them is quite difficult. I advise you to read the articles on fun fish tank in order to more or less familiarize yourself with how to properly maintain cleanliness in the aquarium, how to feed the fish, how to care for them.