Skip to content

SnickeyX/htb-ix-bear-force-one

 
 

Repository files navigation

HTB IX - Bear Force One

Bear-ly Sustainable

flag contributors_badge GitHub commit activity GitHub closed pull requests aws typescript python arduino

Overview

With a focus on the UN's Sustainable Development Goals, our project is a serverless solution provided to Universities for measuring, monitoring, and improving sustainability across multiple campuses. Data is gathered by a series of Arduino-based modules which upload gathered data to an online dashboard hosted with AWS.

The project allows for a high degree of scalability across universities of different sizes, with any number of possible sensor connections and configurations supported.

Please note that no servers were harmed in the making of this project.

Our Focuses:

Software Overview

software_architecture

The project employs a serverless architecture leveraging AWS Lambda and AWS DynamoDB to create rest APIs which are used by both our IOT enabled sensing platforms (described below) as well as the management frontend. The lambda functions are written in Javascript with the AWS-SDK and deployed as REST APIs using AWS's Web API gateway.

While we were able to design our hardware systems, due to the time constraints we weren't enable to create it physically. Therefore, we implemented some random data generation script for testing nominal behaviour using uniform random data as well as critical and failure conditions using out of bounds values.

Our frontend is powered by Next.js as well as Tailwind CSS and deployed by Vercel to a serverless cloud provider. We picked this stack due to familiarity but also ease of use, which was demonstrated when several members of our team with almost no frontend experience were able to prototype and design components with relative ease.

To avoid possible cybersecurity failures as well as reduce complexity, we used Auth0 as our authentication and authorisation platforms. We used Auth0 to implement login, registering and authorisation middleware. This also allows out platform to scale with relative ease when a potential user growth spike occurs.

We are firm believers in open source data and would prioritise the data dashboard being public for democratisation of data but also holding universities accountable to their self assigned goals as well as international standards.

Scoring Algorithm

The algorithm measures how close our sensor reading is to the goal set by the user. It uses dynamic weightage based on how near the reading is to the goal set. If the reading is below the goal, we made it so that the actual distance (% difference) to the goal is multiplied by a decreasing weightage as the reading gets near the goal. The motivation behind this is essentially getting users to push closer towards their goal regardless of how far away they are at the moment - the actual increase in sustainability gives a bigger rise in the sustainability score when the gap between current readings and goal is wide.

On the other hand, if the readings are greater than the goal, the weightage applied increases as the reading gets further away from the goal. This penalty enforces the idea that values beyond the possible goal values indicate a less than desirable circumstance. For example, in the case of our CO2 sensors, values above 2000 indicate possible adverse health effects which should definitely be avoided.

For the overall sustainable score, we simply average scores across all sensors for an organization.

Hardware Overview

draw.io_summary

This project deploys several IoT microcontrollers to measure and collect data to be served online. All modules share a common design of:

  • An ESP32 WiFi enabled microcontroller
  • An LCD Display
  • A micro SD card
  • A sensor for monitoring the surrounding enviroment

This sensor can be customised and easily configured for use in the module prior to installation. An example of the module schematic is shown below. Once powered, the module maintains its internet connection and sends any gathered data to the internet for analysis. However, in case the module is unable to connect to the internet, all data values (and debug logs, if enabled) will be saved to the local micro SD card. The ESP32 was chosen both for its ease of use and familiarity, being programmable in C++, and also for having WiFi capabilities included out-the-box. The LCD display allows users to observe the real time measurements from the sensor on the module itself. If values become critical, a buzzer sounds to alert nearby users of the problem.

The current implementation supports measuring CO2 levels, generating a VOC Index, measuring the quality of drinking water from water fountains, and monitoring power usage. However, as stated before, code for any additional type of sensor can be implemented with ease.

schematic

SGD Innovation Goals:

Innovation / Creativity:

We make use of the current best and affordable tech. The specifics about the software and hardware have been mentioned above!

Impact:

Our idea and implementation can be picked up by any university but it is not necessarily limited to it. Since we monitor buildings themselves, anyone, anywhere can use our solution and check their sustainability score easily. Our hope is to push for a more sustainable city in general and we hope by being able to track scores (and filter by the different factors affecting it), we incentivise our users to strive for a more sustainable environment.

Feasability:

We strived to make our solution as afforadable as possible, and with that in mind, provide a breakdown of potential costs below:

Additional Costs (estimates):

  • setting up cost / building - £25
  • travel cost - £20 (based on current petrol prices and considering max travel distance to roughly 150km) (assuming 10.58km/L of tank can be travelled at 147.56 pence per litre)
  • AWS hosting cost - depends on user-base (ignoring in calculation)

Results:
Assuming each building takes 4 sensor packs and there are 4 buildings on one campus, the total price for a campus would be £1,583.68 (4 * 4 * 91.48 + 4 * 25 + 20) - rounding up -> £1,600

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 53.1%
  • Python 17.0%
  • C++ 13.8%
  • JavaScript 13.6%
  • SCSS 2.2%
  • C 0.2%
  • Other 0.1%