After hearing the prompt, our group immediately decided we wanted to focus on a tool that allows communities to reduce their total carbon footprint. Additionally, we thought about ways to reduce littering. In do this, we considered all the possible reasons one might litter, and came to the conclusion that littering is almost always caused by the surrounding trashcans being full when someone wants to throw something away. This led us to our idea of an application to track trash can usage and fullness.
What it does
TrashMaps uses an IR break beam to count how many items are thrown away into a trash can, and detect if the trash can is full. It then stores this information in a database which a web interface uses to display the fullness and usage data of trash cans. This interface also integrates a map feature to map trash can ids to locations in the real world.
How we built it
The web interface was built from scratch using React and NextJS. All styling was done by hand (no styled component libraries). The web interface pulls data from a flask api which uses PyMongo to query a MongoDB database hosted via MongoDB Atlas. Finally, the data in this database is populated by a separate Python program which reads in serial binary data from a C process running on an Arduino. This program uses pin level IO to detect and record breaks in an IR beam sensor. These breaks are the objects being thrown away in to a trash can.
Challenges we ran into
Using MongoDB inside of Flask presented an issue due to the lack of thread safety. Additionally, getting binary info off of the Arduino without having a WiFi shield turned out to be quite difficult. Finally, displaying trash cans on an interactive map required a little bit of learning.
Accomplishments that we're proud of
Being able to create a full stack product in less than 24 hours was really impressive to us because individually none of us have ever done this.
What we learned
We learned JSON, MongoDB Atlas, Arduino, Flask, PyMongo, and the react-open-gl map API.
What's next for TrashMaps™
TrashMaps turned out to be a really successful idea and we hope to build out a new UI and back-end for it in the coming year. Additionally, we would love to look at building out a native app version of the UI.
We have a physical component to our application, obviously. So, looking at the GitHub will only give you a partial view of the project. To run the project run the following commands in one terminal window:
git clone https://github.com/AHBruns/minnehack cd client npm i npm run dev
Then in a different terminal window (with the other still open) run these commands (starting at the root directory)
cd src/flaskr export FLASK_APP=bin_getter.py flask run
If at any point you require a dependency, install it. Most of the dependencies are things that someone who develops using flask and mongo would already have.