Programming - C++
IDE-Arduino IDE
Sensors:Ultrasonic sensors
Communication Modules: HTML,CSS,JavaScript
Backend-Node.js
Database systems- MySQL
APIs:Google Maps API
Protocol -HTTP
Library - ESP8266HTTPClient,WiFi.h,MQTT
Implementation
Arduino Setup:
The EWT system consists of two parts. Namely, software systems and hardware systems can be indicated. Smart bin systems can be identified as hardware systems.
<html xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:w="urn:schemas-microsoft-com:office:word"
xmlns:m="http://schemas.microsoft.com/office/2004/12/omml"
xmlns="http://www.w3.org/TR/REC-html40">
Arduino is used to create the smart bin system. A NodeMUC board is used
for programming and two ultrasonic sensors and a servo motor are used as
components. The purpose of the grant is to measure the amount of waste in the
bin. One ultrasonic sensor detects the amount of waste in the bin. The other
sensor detects someone near the bin and automatically opens the bin through the
servo motor. But if the bin is full of garbage,the bin will not open.
The creation of the smart bin system using the above mentioned hardware
components is as follows.
First, the assembly of hardware components is started. Ultrasonic
sensors are connected to the Node MCU board and VCC and GND are used to provide
power, Trigger and Echo connections are used to exchange data. Parallelly,
power, ground and signal pins are used to connect the servo motor to the
NodeMCU. The above pins are connected to the NodeMCU board as follows.
Hardware component | NodeMCU pins
-- | --
Ultrasonic sensors | VCC | 3V3
GND | G
TRIGGER | D1, D3
ECHO | D2, D4
servo motor | POWER (red) | 3V3
GROUND (brown) | G
SIGNAL (orange) | D5
As above, all devices such as sensors and servo motors are connected to
the NodeMCU board and its circuit diagram is as follows.
![image](https://github.com/sandunchathuranga01/EWT_CW2_GroupProject/assets/123801670/289bd485-55cd-4572-b1b5-bf265d8fee1b)
Once the hardware is set up, the next step is to figure out the coding. Arduino IDE is used for coding the NodeMCU board, where the code is written in C++ language. Here , coding is done in accordance with the logic of determining the filling level of the bin and identifying an object near the bin by the sensor and automatically opening the lid of the bin by the servo motor after detecting an object.
Wi-Fi connections are used to transmit data to the EWT application and libraries such as WiFi.h or MQTT are used to publish data collected by the NodeMCU.
After writing the code as above, it is uploaded to the NodeMCU board using the programming platform Arduino IDE. Then by powering up the NodeMCU and observing its performance, the system and all the sensors are checked for logical operation.
Data Processing and Communication:
Processing data in a smart bin takes place in a few steps. Ultrasonic sensors collect data about the fill levels of the bin and this raw data may need to be refined. However this data is stored after processing. The data is uploaded to a cloud server by NodeMCU . Analysing this data can provide insight into bin capacity. These analyses drive decision making. For example, when the bin reaches its capacity limit, alerts are automatically sent to garbage collectors to take necessary actions, such as emptying the bin.
Here the communication between a web application and smart bins is to create a bridge that allows for seamless interaction and data exchange . To accomplish this, a web server acts as the backend for the web application and uses a RESTful API that defines endpoints to perform specific interactions with the smart bin. This endpoint facilitates real-time data retrieval (fill levels) from the bin. The NodeMCU board inside the Smart bin will be programmed to make HTTP requests to these API endpoints.
Protocols such as WebSocket or MQTT are used to stream real-time data . This allows for continuous data flow between the Smart Bin and the web application.
Mapping and Visualization:
Since the smart bins do not move, the fixed locations are entered into a web application. The first step is to collect accurate data about the locations of the smart bins. Then it should be displayed in the system. The Google Maps service is used for that and the Google Maps API is integrated for that. This allows the mapping function to be performed seamlessly on the web application’s interface.
Tools
Programming - C++ IDE-Arduino IDE Sensors:Ultrasonic sensors Communication Modules: HTML,CSS,JavaScript Backend-Node.js Database systems- MySQL APIs:Google Maps API Protocol -HTTP Library - ESP8266HTTPClient,WiFi.h,MQTT
Implementation
Arduino Setup:
The EWT system consists of two parts. Namely, software systems and hardware systems can be indicated. Smart bin systems can be identified as hardware systems. <html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
Arduino is used to create the smart bin system. A NodeMUC board is used for programming and two ultrasonic sensors and a servo motor are used as components. The purpose of the grant is to measure the amount of waste in the bin. One ultrasonic sensor detects the amount of waste in the bin. The other sensor detects someone near the bin and automatically opens the bin through the servo motor. But if the bin is full of garbage,the bin will not open.
The creation of the smart bin system using the above mentioned hardware components is as follows.
First, the assembly of hardware components is started. Ultrasonic sensors are connected to the Node MCU board and VCC and GND are used to provide power, Trigger and Echo connections are used to exchange data. Parallelly, power, ground and signal pins are used to connect the servo motor to the NodeMCU. The above pins are connected to the NodeMCU board as follows.
Hardware component | NodeMCU pins -- | -- Ultrasonic sensors | VCC | 3V3 GND | G TRIGGER | D1, D3 ECHO | D2, D4 servo motor | POWER (red) | 3V3 GROUND (brown) | G SIGNAL (orange) | D5As above, all devices such as sensors and servo motors are connected to the NodeMCU board and its circuit diagram is as follows.
![image](https://github.com/sandunchathuranga01/EWT_CW2_GroupProject/assets/123801670/289bd485-55cd-4572-b1b5-bf265d8fee1b) Once the hardware is set up, the next step is to figure out the coding. Arduino IDE is used for coding the NodeMCU board, where the code is written in C++ language. Here , coding is done in accordance with the logic of determining the filling level of the bin and identifying an object near the bin by the sensor and automatically opening the lid of the bin by the servo motor after detecting an object. Wi-Fi connections are used to transmit data to the EWT application and libraries such as WiFi.h or MQTT are used to publish data collected by the NodeMCU. After writing the code as above, it is uploaded to the NodeMCU board using the programming platform Arduino IDE. Then by powering up the NodeMCU and observing its performance, the system and all the sensors are checked for logical operation. Data Processing and Communication: Processing data in a smart bin takes place in a few steps. Ultrasonic sensors collect data about the fill levels of the bin and this raw data may need to be refined. However this data is stored after processing. The data is uploaded to a cloud server by NodeMCU . Analysing this data can provide insight into bin capacity. These analyses drive decision making. For example, when the bin reaches its capacity limit, alerts are automatically sent to garbage collectors to take necessary actions, such as emptying the bin. Here the communication between a web application and smart bins is to create a bridge that allows for seamless interaction and data exchange . To accomplish this, a web server acts as the backend for the web application and uses a RESTful API that defines endpoints to perform specific interactions with the smart bin. This endpoint facilitates real-time data retrieval (fill levels) from the bin. The NodeMCU board inside the Smart bin will be programmed to make HTTP requests to these API endpoints. Protocols such as WebSocket or MQTT are used to stream real-time data . This allows for continuous data flow between the Smart Bin and the web application. Mapping and Visualization: Since the smart bins do not move, the fixed locations are entered into a web application. The first step is to collect accurate data about the locations of the smart bins. Then it should be displayed in the system. The Google Maps service is used for that and the Google Maps API is integrated for that. This allows the mapping function to be performed seamlessly on the web application’s interface.