Auto-Pilot Boat Collects Trash in the Water

Plastic waste is a very severe pollution on earth. A lot of projects are trying to collect the plastic waste on the land. I come out an idea to collect plastic bottle floating in the water.
The basic idea is to use a self-piloted boat with net to collect plastic bottles. Because there are different things floating on the water surface. The boat needs to be smart enough to distinguish plastic bottles from others, such as ducks or another boat.

Mechanic Part:

I purchased a medium size toy boat and installed an open-mouse net in the front. The boat has 2 propellers. By making them in different speed the boat can make turns.

Each propeller is driven by a dedicated motor.

Electrical Part:

Pulse Waveform To locate plastic bottles, the boat needs “eye” to see the things around it. I purchased an action camera with 1080 pixels. After the boat sees objects, it needs to make a decision whether the object is a plastic bottle or not. I did some research online, Tensorflow from Google provides object detection API and library for free. To make the object detection fast enough, usually Tensorflow library requires GPU support. The boat too small to hold a regular PC computer with GPU. I decided to use Raspberry Pi 4 as the brain of the boat plus Coral Edge Tensorflow Processor Unit (TPU) as accelerator. The reason to pick Rpi-4 is because it has USB-3 interface which makes it much faster to communicate with Coral. RPi-4 generates IO signal to control the motor. IO signal only has 2 states, LOW and HIGH. In ordet to control motor’s speed in a continuously way, we can generate Pulse Waveform on the IO pin. The duty cycle of the waveform determines the speed of the waveform.

Usually motor requires more than 5 V. However, RPi IO pins has weak 3V high. Hence, we need at least 2 channels of motor drivers. The motor drive is to convert low voltage IO signal to high voltage motor power. The waveform (frequency and duty cycle) remains the same.

The flow:

Action Camera is connected to Rpi-4 with USB cables. Camera is set to video stream mode. The program on the Rpi-4 repeatedly reads the video frame (picture) from the camera. After simple pre-process, the image data is sent to Tensorflow API and library to detect the objects in the picture. Tensorflow API returns all objects detected in the picture with their locations in the picture. The program checks each of object detected and judge whether it is a target (plastic bottle). If there is a target found, the program calculates its position. Then it generates appropriate pulse waveform to drive the boat straight forward or make turns.