Following my earlier post on Introducing the Microchip RN2483, I am writing this application blog post to showcase how LoRaWAN can be used for enabling waste management by means of a smart garbage bin. LoRaWAN provides long range wireless communication with ultra-low power consumption that enables very long battery life.
We built a proof of concept for garbage bin level tracking device, based on Raspberry Pi + Arduino Uno, and then optimized it further with a custom circuit to make a production grade bin level sensor(BLS) for smart city use cases. In this post, we will show you how you can quickly hack together a proof-of-concept of a functional smart garbage bin on Raspberry Pi using LoRaWAN. For more details about the custom BLS, please get in touch with us.
Managing Trash as Part of Smart City
Deploying smart trash cans for real time waste management system is one of the key applications of a smart city system. Municipal authorities need an efficient way to clear the trash from all public places before it becomes a mess. And this needs to be achieved with the minimum overhead of cost and impact to the city dwellers. LoRaWAN is one of the earlier LPWAN technologies that envisages a city-wide network for keeping track of public infrastructure assets. Once fitted with a BLS device on a trash can, LoRaWAN allows the city authorities to keep a tab on the bins via wireless connectivity.
LoRaWAN does suffer from some limitations, such as extremely low data rates, higher collision and deteriorated network performance with increasing number of nodes and inability to perform over the air updates to the device. Like every emerging technology, it is also going through an evolutionary phase and is also getting a healthy competition from some of the other emerging standards such as NB-IoT and Weightless. However, at the current state, this technology is well suited for non-mission critical applications, and tracking garbage bins is one such use case.
Solution for Waste Collection using Remote Monitoring
Let’s build a model end-to-end PoC for smart waste collection using LoRaWAN.
[thrive_text_block color=”teal” headline=”Looking For a Real Smart Trash Can/Waste Bin?”]
The setup presented in this blog post is a prototype system. If you are looking for a real product or technology around smart trash can or a smart waste bin then refer to our product R&D page on smart cities.
This solution is ideally suited for waste pickup and management companies, who can optimize their logistics resources while reducing collection costs.
The PoC scope of this solution is to remotely monitor a garbage bin. The bin is fitted with a BLS device coupled with Microchip RN2483 LoRa Module, for tracking the garbage level. And the level is indicated to the user via a mobile app.
Smart Garbage Bin Hardware Setup
There are three functional parts of this solution:
- Node – This is the BLS device fitted in the garbage bin . It has an ultrasonic sensor to sense the garbage level inside the bin and a LoRa module (Microchip RN2483) as the communication interface. The node hardware is based on Arduino Uno.
- Gateway – This is used as an external gateway, which aggregates the data from the nodes and pushes it to cloud. The gateway connects to the nodes using LoRaWAN. The gateway is built upon Raspberry Pi and it is also interfaced with RN2483 for receiving the data from nodes over LoRa physical layer.
- UI App – This is a simple app that shows the current level of the bin. This app is the same one that we used earlier for the IBM Bluemix Smart Trash Can demo. Instead of IBM Bluemix, this time the app is powered by PubNub to establish a real-time link between the gateway and the app.
[thrive_custom_box title=”Get your Microchip RN2483 LoRa Mote” style=”light” type=”color” color=”#5192A8″ border=””]For building this PoC demo, you can use Microchip RN2483 LoRa Mote for both the node and gateway. Make sure to order as per your country’s ISM frequency band.
In this gateway setup, we have used the RN2483 Module with inbuilt CP2102 USB to TTL Converter, to interface with Raspberry Pi.
In the BLS node setup, we have used the RN2483 Module with an ultrasonic sensor (HC-SR04) for level detection.
Node Hardware Connections
Here is the hardware schematic for BLS node.
Smart Garbage Bin Software Setup
Steps to Setup Node Software
[thrive_text_block color=”teal” headline=”Before You Begin”]
Before proceeding, we need to install Arduino IDE on a laptop/computer.
Installing the Arduino IDE
– Download and Install Latest Version of Arduino IDE
– Start Arduino IDE and plug the Arduino development Board to the computer.
You need to be familiar with Arduino IDE. For more details, refer the Getting Started guide.
Step 1: Clone the GitHub repository under your home directory, using the following link
git clone https://github.com/suryasundarraj/lora-based-garbageBin-tracker.git
Step 2: Open the file “/node/loraNode/loraNode.ino” from this repo in Arduino IDE.
Step 3: From Arduino IDE menu, select the Board from Tools – > Board – > Arduino UNO
Step 4: Select the USB Port from Tools menu ( Tools – > Port – > COMXX )
Step 5: Upload the Code to Arduino Uno board. Now the Arduino Uno will start transmitting the bin level through LoRaWAN.
Gateway Software Setup
Follow the procedures below to run the python program on Raspberry Pi gateway.
Step 1: Log on to the Raspberry Pi console and clone this GitHub repository under the home directory.
Step 2: Under the “lora-based-garbageBin-tracker” directory navigate to “gateway” subdirectory.
Step 3: Run the script (Check for permissions, sudo)
You can see the logs to check that the LoRa module gets initialized and starts receiving data from the node.
You can also use a CP2102 USB to Serial Converter module to connect the RN2483 and interface with any serial PC terminal.
[thrive_text_block color=”teal” headline=”Setting up LoRa Stack Commands”]
This setup is developed using the LoRa stack radio commands.
On the Receiver Side (Gateway), the commands are:
mac pause radio rx 0
On the Transmitter Side (Node), the commands are:
mac pause radio tx FF
This LoRa setup is tested under an ideal indoor condition. To try it outdoors and for non line of sight cases, you need to test it by setting LoRa MAC radio parameters (ADR, SF, Channel Frequency) and sending commands manually to RN2483.
You can find all the commands embedded in the code. Refer the official Microchip datasheet for more details.
Since LoRa works in the open ISM band, make sure to adhere to your country specific regulations for testing it outdoors. It is not recommended to use this PoC setup for extended testing.
Checking Bin Level on Mobile App
The mobile app is a standard Cordova-based Android app. It shows the current level of the garbage bin.
The source code of this app is available under the app folder in the GitHub repository. Refer the README file for details on how to compile and run the app.
Functional Demonstration of Smart Garbage Bin
Once the node and gateway setup is up and running, you can see the debug messages on the serial monitor (Arduino) and ssh terminal (Raspberry Pi), indicating the continuous Lora transmission.
Here is the model garbage bin setup fitted with the node device.
As we keep filling the container with trash, the level goes up, and it is indicated in the mobile app.
[clickToTweet tweet=”Now I know how to build smart garbage bin with #LoRaWAN using @MicrochipTech RN2483 for #smartcity” quote=”Now I Know How To Build A Smart Garbage Bin with LoRaWAN using Microchip RN2483″]
Building Production Grade BLS for Smart Waste Management
The PoC setup depicted here is for lab testing only. In reality, this will be too bulky and power inefficient to be installed in an outdoor garbage bin or isolated trash cans that you see in public places.
We have developed this PoC further on a custom built hardware that runs on battery.
It has a compact form factor and the casing can be further modified to suit the bin design and guarded with enhanced protection for environmental damages (IP 65 – 67). We recently tested it in an outdoor location with a LoRa service provider and we achieved one-month battery life even with an hourly trigger of bin level.
Get in touch with us if you want to know more about this BLS device. We also look forward to your comments and inputs on the further use of technology for smarter waste management.