# A Distributed Architecture for Smart Recycling Using Machine Learning
## 4 System Architecture  
To improve the waste classification efficiency, we present a multi-layered cloud supported architecture, depicted in Figure 1. The proposed system consists of several embedded devices distributed in different waste collection facilities that capture photos of waste in real time and send them to a cloud server for classification. The goal of our work is to instruct in real time a distributed number of robotic systems to extract and sort the materials in proper bins. The robotic system is out of the scope of this paper and will not be presented. The embedded devices located in waste collection facilities can have different hardware configurations and can differ with each other. The only requirement is that they have a camera module attached and a high speed Internet Connection. The embedded devices are low-cost and low-power Single Board Computers (SBC). In our prototype, we used an embedded system that consists of a Raspberry Pi 3B+ and a Raspberry Pi camera module version 2.1. The Raspberry Pi 3B+ board is very suitable for our prototype needs for three reasons: (a) It has very low cost, which is necessary for our project, (b) it is very energy efficient since it consumes less than 200 mA under normal load and (c) it has a very small form factor (Dimensions: 65 mm \(\times\) 30 mm \(\times\) 5 mm). It is equipped with a 1.4 GHz quad-core ARMv8 CPU (BCM2837B0) and has integrated WiFi (802.11n wireless LAN) and Bluetooth 4.0. The computing power of the Raspberry Pi 3B+ is more than enough for our project needs, since the waste classification will only be performed on our server on the cloud. The other main component of our prototype is the camera module version 2.1 which features an ultra high quality 8 megapixel Sony IMX219 image sensor (up from 5 megapixel on the version 1 camera board), and a fixed focus camera lens. The version 2.1 camera module is capable of capturing pixel static images up to 3280 \(\times\) 2464 resolution and also supports video capturing in three configurations,1080p at 30 Frames Per Second (FPS), 720p at 60 FPS and 480p at 90 FPS. Of course, instead of this embedded system, we can utilize any x86, x86-64 or ARM Cortex system that operates with Linux, because our software is not architecture specific and can be noted easily to various platforms. The server which is located on the cloud hosts the neural network that processes images and classifies them based on their characteristics. The five categories of waste are: Paper, glass, plastic, metal, carton and garbage. Because images may contain sensitive information, all data transmitted between the cloud server and the embedded devices is encrypted. The proposed system uses the AES (Advanced Encryption Standard) algorithm in order to encrypt and protect all the transmitted data from malicious attackers. The AES algorithm is currently supported on all the popular Operating Systems (OS), like Windows, FreeBSD and Linux distributions. The cloud server that we are using for processing offloading to the cloud uses the open source operating system Red Hat Enterprise Linux Server 7.4 x86_64. Using PHP and MySQL, we have developed a web platform that allows supervisors to monitor and reconfigure the system in an easy and efficient manner. The platform allows supervisors to view the results of the classification process, fine tune the classification algorithm or even retrain the algorithm using a different dataset. The platform also shows real time information about the embedded systems, such as CPU load, CPU temperature, bandwidth metrics and more. Finally, by using HTTPS, communication between the client's browser and the platform is always encrypted, minimizing the risk of Man In The Middle (MITM) attacks. The software architecture of our system consists of 5 stages: (a) In the first stage, the embedded system installed in the waste processing facility opens a TCP stream to the cloud server. This TCP stream is used to send the captured images for processing.