Introduction
Waste collection boats have been widely used for the purpose of cleaning up water bodies. So, as a solution to this problem, smaller sized garbage collection boats have been designed to collect garbage and floating solids in narrow and small areas such as streams and drainage systems.
Water is the most important resource for living organisms. Therefore, clean water is a basic need. But the water in the lake or river is polluted by man, most of the waste is dumped into the lake and river. The wastes are thrown into the water so it pollutes the lakes and rivers, because of this we cannot use this water for daily use. So, to overcome this water pollution, our project "Garbage Collecting Boat" is very helpful by collecting garbage floating on the water.
Manual Cleaning Process
Youtube project link:
Design and Implementation:
Components Connections:
- Raspberry Pi
- 5V to 12V DC Step-up Converter
- Motor Drive with DC Motor
- Pi Camera
- Power Supply
Use of Raspberry Pi:
The proposed model can be built on the control of the Raspberry Pi, the Raspberry Pi is a component of the microprocessor where all the instructions of the application are translated into actions on the hardware. The Raspberry Pi can be powered through a USB connection or an external power source. It is the main processing element of the robot.
Raspberry Pi is available in different models and form factors. This model has a relatively small form factor and requires less power to operate than other models. It needs 5V to work and can be powered by a regular battery. It has a 40-pin GPIO section that can be used to communicate with external devices.
Raspberry Pi 4
Use of L293D Motor Drive Module:
A L293D IC expansion board is called the L293D Motor Driver Module. The board has the capacity to operate up to two DC motors at varied speeds and in both directions. To build a robot, it may be interfaced with a Raspberry P. Switching the logic on the M1 and M2 pins changes the direction of the motor. By sending the appropriate PWM signal to the EN pins, the speed of the motors may be changed.
Motor Drive Module
Use of Pi Camera:
This Raspberry Pi camera module board has a 5 Megapixel camera with good resolution and excellent photo- taking capabilities. In addition to taking images, it can also record and stream movies, making it ideal for Raspberry Pi projects like drones and CCTV. The Raspberry Pi Camera Board is adaptable and may be used as a covert camera also.
Features: The Raspberry Pi 5MP Camera Board is a custom camera board that comes with a flexible ribbon cable and is compatible with Raspberry Pi boards. The camera board incorporates a fixed lens with a resolution of 5 megapixels. This camera board can capture moments with a resolution of 2592 x 1944 pixels and record high-quality videos supporting 1080p@30fps, 720p@60fps and 640x480p 60/90 formats.
Pi Camera
Use of DC Motors:
Here we use 2 DC motors - right thruster, left thruster. A 12V power supply is provided for these 3 motors.
DC Motor
Use of MT3608 5V to 12V step-up Converter:
A cheap DC-DC step-up converter, the MT3608 module can step-up a 2V to 24V input voltage to a 5V to 28V output at up-to 2A. It is utilized to create the 12 V DC supply needed to power the DC motors in the Boat.
Step-up Converter
Objectives:
- To carry out the literature survey on existing garbage collection system in
- To arrive at the functional block diagram of garbage collection water boat for
- To develop the hardware for garbage detection and the system for collection and assess the water
- To integrate the functionalities of
- To test and validate the developed
Design and Development:
Block Diagram
We have divided our Project into 3 Parts: Garbage Detection, Boat Movement and Garbage Collection
In waste collection part we have 3 Important blocks they are
- Conveyer
- Pi camera
- Garbage container
Here the Pi camera will detect the waste materials which are floating on the water using transmitting and receiving signal, then the Raspberry receives the signal and gives the command to the propellers. The conveyor starts rotating which will collect the garbage through water, and then the garbage present on the conveyor belt will transfer the garbage to the garbage container.
Circuit Diagram:
Circuit Diagram
- Motor driver circuit is used for the motion of the
- Power supply to get the sufficient power for the
- The boat requires a motion controlling unit e., Raspberry Pi
- Motion of boat is obtained by using Webpage.
Software Implementation:
Web streaming:
We have used a much simpler format: MJPEG, For live video Streaming over the web. The following script uses Python’s open source built-in “http.server” module to make a simple video streaming server. Once the script is running, we can go to, http://your-pi-address:8000/ with your web- browser to view the video stream.
import io
import picamera
import logging
import socketserver
from threading import Condition
from http import server
PAGE="""\
<html>
<head>
<title>Rpi Cam-Server</title>
<script src="js/jquery.min.js"></script>
<script src="js/earthrover.js"></script>
<script>
function button_reload()
{
location.reload();
}
</script>
</head>
<body>
<!--<center><h1>Raspberry Pi - Surveillance Camera</h1></center>-->
<center><img src="stream.mjpg" width="640" height="480"></center>
<!--<input type='submit' onclick=button_reload(); value='refresh'/>-->
</body>
</html>
"""
class StreamingOutput(object):
def __init__(self):
self.frame = None
self.buffer = io.BytesIO()
self.condition = Condition()
def write(self, buf):
if buf.startswith(b'\xff\xd8'):
# New frame, copy the existing buffer's content and notify all
# clients it's available
self.buffer.truncate()
with self.condition:
self.frame = self.buffer.getvalue()
self.condition.notify_all()
self.buffer.seek(0)
return self.buffer.write(buf)
class StreamingHandler(server.BaseHTTPRequestHandler):
def do_GET(self):
if self.path == '/':
self.send_response(301)
self.send_header('Location', '/index.html')
self.end_headers()
elif self.path == '/index.html':
content = PAGE.encode('utf-8')
self.send_response(200)
self.send_header('Content-Type', 'text/html')
self.send_header('Content-Length', len(content))
self.end_headers()
self.wfile.write(content)
elif self.path == '/stream.mjpg':
self.send_response(200)
self.send_header('Age', 0)
self.send_header('Cache-Control', 'no-cache, private')
self.send_header('Pragma', 'no-cache')
self.send_header('Content-Type', 'multipart/x-mixed-replace; boundary=FRAME')
self.end_headers()
try:
while True:
with output.condition:
output.condition.wait()
frame = output.frame
self.wfile.write(b'--FRAME\r\n')
self.send_header('Content-Type', 'image/jpeg')
self.send_header('Content-Length', len(frame))
self.end_headers()
self.wfile.write(frame)
self.wfile.write(b'\r\n')
except Exception as e:
logging.warning(
'Removed streaming client %s: %s',
self.client_address, str(e))
else:
self.send_error(404)
self.end_headers()
class StreamingServer(socketserver.ThreadingMixIn, server.HTTPServer):
allow_reuse_address = True
daemon_threads = True
with picamera.PiCamera(resolution='640x480', framerate=24) as camera:
output = StreamingOutput()
#Uncomment the next line to change your Pi's Camera rotation (in degrees)
#camera.rotation = 180
camera.start_recording(output, format='mjpeg')
try:
address = ('', 8000)
server = StreamingServer(address, StreamingHandler)
server.serve_forever()
finally:
camera.stop_recording()
1. Webpage PHP Server side Code:
Index.php:
The file Index.php inside control_panel folder having the following PHP and HTML code with styling gives us a basic webpage having the address
http://pi-address/waterboat/control_panel
from which we can see the live video stream and control the boat
<html> <head> <title>Control Panel</title> <link href="css/cp.css" rel="stylesheet" type="text/css"> <script src="js/jquery.min.js"></script> <script src="js/cp.js"></script> <script> </script> </head> <body> <?php printf("<div align='center' id='box_outer'>");//------------------------ echo"<div align='center' id='box_title'>"; echo"<h1 style='color:#0000b3'>Earth Rover</h1>"; echo"<div class='box_controls'>"; echo"<zz>"; echo"<label class='floatLabel'>Camera</label><br>"; echo"<input id='cam_on' type='submit' onclick=camera('on'); value='ON'/>"; echo"<input id='cam_off' type='submit' onclick=camera('off'); value='OFF'/>"; echo"<br>"; echo"<txt> .</txt>"; echo"</zz>"; echo"</div>"; echo"<div class='box_controls'>"; echo"<zz>"; echo"<label class='floatLabel'>Lights</label><br>"; echo"<input id='camlight' style='background-color:lightgray' type='submit' onclick=toggle_light('camlight'); value='OFF'/>"; echo"<input id='headlight' style='background-color:lightgray' type='submit' onclick=toggle_light('headlight'); value='OFF'/>"; echo"<br>"; echo"<txt>Camera</txt>"; echo"<txt>Front</txt>"; echo"</zz>"; echo"</div>"; echo"<div class='box_controls'>"; echo"<zz>"; echo"<label class='floatLabel'>Range Sensor</label><br>"; echo"<b id='range' style='float:right;color:blue;font-size:30px'></b>"; echo"<input id='range_button' type='submit' onclick=toggle_rangeSensor('range_button'); value='OFF'/>"; echo"<script src='range_sensor/web/rangesensor.js'></script>"; echo"</zz>"; echo"</div>"; echo"</div>"; //**************************************************************************** $host=$_SERVER['SERVER_ADDR'];//192.168.1.20 $path=rtrim(dirname($_SERVER["PHP_SELF"]), "/\\"); //earthrover $link_remote= 'http://'.$host.$path.'/'."remote.php";//http://192.168.1.20/earthrover/remote.php $link_vid= 'http://'.$host.':8000';//http://192.168.1.20:8000 echo" <iframe src='$link_vid' id='box_video'></iframe> <iframe src= '$link_remote' id='box_remote'></iframe> "; //**************************************************************************** echo"</div>";//------------------------------------------------------ ?> </body> </html>
Remote.php:
Integrating the JavaScript code for the control of the boat from remote.php with index.php. The 'remote.php' code starts by importing a few files. The CSS file used for the look and feel of the GUI. The jquery file is used for communication between client and server through ajax. The javaScript processes that are called when the GUI buttons are pressed are implemented in the "remote.js" file.
<html>
<head>
<title>Remote</title>
<link href="css/remote.css" rel="stylesheet" type="text/css">
<script src="js/jquery.min.js"></script>
<script src="js/remote.js"></script>
</head>
<body>
<?php
include_once 'vars.php';
gpio_initialise(); // initialising the GPIO pins
?>
<div align="center" id='box_outer'>
<!-- =================Direction Buttons=================================================== -->
<div class='box_row'>
<input class="button" type="submit" onclick="button_direction('f');" value="FWD"/>
</div>
<br />
<div class='box_row'>
<input class="button" style="float:left" type="submit" onclick="button_direction('l');" value="LEFT"/>
<input class="button" type="submit" onclick="button_direction('s');" value="STOP"/>
<input class="button" style="float:right" type="submit" onclick="button_direction('r');" value="RIGHT"/>
</div>
<br />
<div class='box_row'>
<input class="button" type="submit" onclick="button_direction('b');" value="BACK"/>
</div>
<!-- ================================================================================= -->
<br><br>
<!-- =============Range Slider for speed==============================================-->
<div class='box_row'>
<div class="slidecontainer">
<input type="range" min="0" max="100" value="50" class="slider" id="myRange" step="5">
<p>Speed: <span id="speed">50</span></p>
</div>
<script>
var slider = document.getElementById("myRange");
var output = document.getElementById("speed");
output.innerHTML = slider.value;
speed_slider(slider.value);
slider.oninput = function() {
output.innerHTML = this.value;
speed_slider(this.value);
}
</script>
</div>
<!-- ================================================================================== -->
</div>
</body>
</html>
Javascript:
Remote.js:
The first lines of code in 'remote.php' import a few files. The look and feel of the GUI is controlled by a CSS file. The jquery file is used for ajax based client and server communication. The javascript processes that are called when the GUI buttons are pressed are implemented in the "remote.js" file.
HTML <input> elements used to display buttons and speed sliders. The "onclick" javascript method for each button is specified in the "remote.js" file. When the speed slider is moved, the value of the slider is passed to the function below. This function sends this pointer value to the php file (ajax_speed.php) in the server via an ajax call in the background.
//---------DIRECTION---------------------------------
function button_direction(val)
{
console.log("button val:" + val);
$.post("ajax_direction.php",
{
direction: val
}
);
}
//---------SPEED--------------------------------------
function speed_slider(val)
{
console.log("slider val:" + val);
$.post("ajax_speed.php",
{
speed:val
}
);
}
PHP Server side Code for Boat Movement Control:
Ajax_direction.php:
This file receives direction value from client as a post parameter and moves the robot in the desired direction. The function 'move ()' is defined in a utility file 'vars.php'.
<?php
include_once 'vars.php';
$dir=$_POST["direction"];
move($dir);
echo"Dir: \" $dir \" <br>";
?>
vars.php:
This is a file for control of motors the file works with the Raspberry Pi's hardware to manage its GPIO pins. The robot may be moved in four directions using the functions in this file: forward, backward, right, and left.
We can similarly do for backward () and Stop ()
<?php
global $m1_1,$m1_2,$m2_1,$m2_2;
$m1_1 = 8; //motor 1
$m1_2 = 11; //motor 1
$m2_1 = 14; //motor 2
$m2_2 = 15; //motor 2
$headlight_right = 18; //head light Right
$headlight_left = 27; //head light Left
$cameralight = 17; //camera light
//pwm pins are 20 & 21 (seperately handled in python).
//Rpi's Hardware PWM interferes with audio port.
function gpio_initialise(){
//echo"init<br>";
global $m1_1,$m1_2,$m2_1,$m2_2;
//====motors=================
set_gpio($m1_1,'output');
set_gpio($m1_2,'output');
set_gpio($m2_1,'output');
set_gpio($m2_2,'output');
set_gpio($m1_1,'0');
set_gpio($m1_2,'0');
set_gpio($m2_1,'0');
set_gpio($m2_2,'0');
global $cameralight,$headlight_left,$headlight_right;
//====Lights============
set_gpio($headlight_right,'output');
set_gpio($headlight_left,'output');
set_gpio($cameralight,'output');
set_gpio($headlight_right,'0');
set_gpio($headlight_left,'0');
set_gpio($cameralight,'0');
}
function set_speed($pwm_val){
$myFile = "/var/www/html/earthrover/pwm/pwm1.txt";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $pwm_val);
fclose($fh);
/* append following lines in /etc/sudoers file for launching python script from PHP:-
pi ALL=(ALL) NOPASSWD: ALL
www-data ALL=(ALL) NOPASSWD: ALL
*/
exec("sudo python /var/www/html/earthrover/pwm/pwm_control.py");# launch Python script
}
function move($dir){
switch ($dir) {
case 'f': forward(); break;
case 'b': back(); break;
case 'r': right(); break;
case 'l': left(); break;
case 's': stop(); break;
}
}
function right(){
global $m1_1,$m1_2,$m2_1,$m2_2;
set_gpio($m1_1,'1');
set_gpio($m1_2,'0');
set_gpio($m2_1,'1');
set_gpio($m2_2,'0');
}
function left(){
global $m1_1,$m1_2,$m2_1,$m2_2;
set_gpio($m1_1,'0');
set_gpio($m1_2,'1');
set_gpio($m2_1,'0');
set_gpio($m2_2,'1');
}
function forward(){
global $m1_1,$m1_2,$m2_1,$m2_2;
set_gpio($m1_1,'1');
set_gpio($m1_2,'0');
set_gpio($m2_1,'0');
set_gpio($m2_2,'1');
//echo"fwd<br>";
}
function back(){
global $m1_1,$m1_2,$m2_1,$m2_2;
set_gpio($m1_1,'0');
set_gpio($m1_2,'1');
set_gpio($m2_1,'1');
set_gpio($m2_2,'0');
}
function stop(){
global $m1_1,$m1_2,$m2_1,$m2_2;
set_gpio($m1_1,'0');
set_gpio($m1_2,'0');
set_gpio($m2_1,'0');
set_gpio($m2_2,'0');
}
function set_gpio($pin,$x){
switch($x){
case '1': $z='dh';break;
case '0': $z='dl';break;
case 'output': $z='op';break;
}
$cmd="sudo raspi-gpio set $pin $z";
system($cmd);
//echo"$x: $cmd <br>";
}
?>
Generate_pwm:
DC motor speed may be managed using a technique called pulse width modulation. The Raspberry Pi offers a very easy method for producing PWM on a specified GPIO pin. PWM creation in this project is handled by the Python program "generate pwm.py" that is located in the "pwm" folder as shown.
import RPi.GPIO as GPIO
from time import sleep # import sleep function from time module
GPIO.setmode(GPIO.BCM) # choose BCM numbering scheme
GPIO.setup(20, GPIO.OUT)# set GPIO 20 as output pin
GPIO.setup(21, GPIO.OUT)# set GPIO 21 as output pin
pin20 = GPIO.PWM(20, 100) # create object pin20 for PWM on port 20 at 100 Hertz
pin21 = GPIO.PWM(21, 100) # create object pin21 for PWM on port 21 at 100 Hertz
pin20.start(0) # start pin20 on 0 percent duty cycle (off)
pin21.start(0) # start pin21 on 0 percent duty cycle (off)
###### read the disk file pwm1.txt for speed value#########################
f0 = open("/var/www/html/earthrover/pwm/pwm1.txt", "r+")
str0 = f0.read(5)
f0.close()
str0=str0.strip()
duty = float(str0)
pin20.ChangeDutyCycle(duty)
pin21.ChangeDutyCycle(duty) #same for pin21
print("duty= ",duty)
while True:
sleep(1)
Flow Chart:
Flow Chart
Algorithm:
- The boat will start and its propellers and Conveyor Belt will be
- Its motion will be controlled remotely by use of circuitry on the Raspberry Pi through a
- The boat will then collect all the garbage and dump it in the collecting tub using Conveyor
- The boat will move towards the polluted area by use of
- We can see the live video Web streaming on the Webpage using Pi
Results:
The outputs which are observed for our working project.
Working Model
- Thus, the required and expected outputs are observed for our working
- The Boat can greatly reduce the problem due to floating
- Hence by using water collecting garbage boat we can clean the river water surface, and maintain the water without trash and waste
Conclusion:
- Waterbodies are being polluted by Floating garbage like unwanted weeds, Floating dead leaves, debris plastic and paper, sewage, effluents and toxic materials from industries, ,
- Water pollution with the floating garbage is a serious issue that needs immediate attention in developing The developed cleaning Garbage boat can be used in all Lakes and other static waterbodies to clean waste. This helps in decreasing the water pollution and thus providing a balanced environment and ecosystem.
- More developed products in the future may also be designed to operate in flowing water. It will also help create a balanced aquatic population in the sand of the lake by using water resources
- We can reduce manual intervention, Our Project defines an innovative way to cover a large area for cleaning waste in the rivers, lakes etc. Hence by using water collecting garbage boat we can clean the river water surface, and maintain the water without trash and waste
- Created the project using hardware and used a microprocessor to control all the parts of the machine using the Raspberry pi.
- Greatly reduce the problems caused by floating waste. In addition, it can be effectively used for surveillance purposes
- In our proposed system, it automatically shows the display and controls. Using this we can determine the water quality for aquatic Therefore, using a garbage collecting boat we can clean the river's surface, keeping the water free of garbage and waste.
Suggestion for Future Scope:
- Our future work focuses to improve the project by developing the boat in any water bodies like rivers, oceans,
- We can Integrate water monitoring system for determining Ph, Turbidity, Temperature, etc., of the
- Automating the whole process of Garbage detection and Collection using Image Processing and Machine
- In future wastes can be segregated as biodegradable and non-biodegradable by the addition of multiple sensors. This will help to protect the aquatic animals, thus maintaining a balanced
- System would be designed to detect hardness of water by using sensors and by spraying the chemicals wherever needed, water is made soft and germs free, so it will help to reduce water borne diseases to a certain
- Number of parameters to be sensed can be increased by the addition of multiple sensors to measured is solved oxygen, chemical oxygen demand, ammonia nitrate,
- The project can be further improved by adding a GPS and wireless communication capability to give information to respective authority about the place where the wastes are being.