Skip to content

Energy Diary connects to your local MQTT server and collects your energy usage and presents it to you in an easy-to-understand and interactive form.

Notifications You must be signed in to change notification settings

LeoLiu5/EnergyDiary

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Energy Diary - Monitoring daily Energy Usage in CE Lab

In the CE lab located in UCL East, various electronic devices have been implemented for teaching and researching purposes. Energy Diary connects to the CE MQTT server and displays real-time energy usage data for these electronic devices, including two Samsung screens, four Prusa printers, and the soldering station.

Instead of directly reading JSON formatted data strings from MQTT, Energy Diary presents energy data in an easy-to-understand, attractive, and interactive form.

The goal is to help the lab technician, staff, or students track daily electricity and energy consumption. This application also has the potential to help users reduce their carbon footprint by reminding them of their electricity and power consumption.

Features

  • When users open the App, they will be introduced to a login page:

    • image
  • If the user does not have an account, they need to click on "Register here" and create an account. Users can switch between the login and the sign-up page freely by clicking the "go back" button:

    • image
  • On the sign-up page, users can enter their email addresses and create a password for their accounts. If the email has been used before, a notification message will appear below to remind the user that the account has already been created:

    • image
  • If the user forgets to enter a password or the password is too short, a notification message will appear below to ask the user to create a new password:

    • image image
  • If the email address is invalid, a notification message will appear below to ask the user to enter a correct email address:

    • image
  • After users signed up, they will be returned to the login page. Now users can log in to their just-created accounts. After clicking the "log in" button, users will be directed to the welcome page:

    • image
  • Users can change the displaying pattern by clicking the icon at the top right corner:

    • image
  • By clicking on one of the images, users will be directed to the corresponding electronic device's information page. However, users have to wait until the application connects to the CE MQTT server:

    • image
  • After successfully connecting to the CE MQTT server, energy data for this electronic device will be displayed on its unique information page:

    • image image
  • Each information page contains:

    • A "Power Consumption" section: showing information on "Active Power (the power which is consumed or utilized in an AC circuit)", "Reactive Power (the power associated with Inductors and Capacitors of the circuit)", and "Apparent Power (the combination of Active Power and Reactive Power)"
    • An "Energy Usage" section: showing information on "Total Energy Consumption", "Today's Energy Consumption", "Yesterday’s Energy Consumption", and "Change in Energy Consumption"
    • An "⚡️ Electricity" section: showing information on "Voltage" and "Current"
    • A "⚡️ Graph" section: displaying daily energy usage on a line chart
  • There is an information page for each of the following electronic devices from the CE lab:

    • Peter, Prusa MMU2S Multi-Filament Printer 1
    • Pertuina, Prusa MMU2S Single-Filament Printer 2
    • Paul, Prusa MMU2S Single-Filament Printer 3
    • Penelope, Prusa MMU2S Multi-Filament Printer 4
    • Sally, Samsung Screen 1
    • Sammy, Samsung Screen 2
    • Sandy, the Soldering Station

Demo Videos:

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

IMAGE ALT TEXT HERE

Data Feed and Database

  • Three GOSUND Smart Plugs are implemented around the CE Lab. They are responsible for collecting the energy data and publishing them to the CE MQTT Server.

image

  • Then, the CE MQTT Server provides the energy data directly to Energy Diary.

image

  • In addition, the backend of the app connects to Cloud Firestore and pushes the energy consumption data directly to the collection called "Date".

image

  • Finally, the app fetches energy consumption data based on the specific date and electronic device. The "monthly energy usage" graphs from the information pages are generated using the fetched data from Cloud Firestore.

Key Packages and Libraries Used

  • firebase_auth 4.2.6
    Used for the purpose of authentication users, links with firebase within Google Cloud Platform

  • firebase_core 2.6.1
    A Flutter plugin to use the Firebase Core API, which enables connecting to multiple Firebase apps

  • cloud_firestore: ^4.5.2
    A Flutter plugin to use the Cloud Firestore API.

  • hexcolor 3.0.1
    Used in converting material colors to hex colors.

  • mqtt_client 9.7.4

  • material library
    Implementing Material Design to Flutter widgets.

  • services library
    Used in preventing device orientation changes and forcing portrait up and down, and changing the status bar colour to transparent.

  • foundation library
    Used in detecting if the app the app is running on the web.

  • dart:io library
    Providing information about the environment in which the current program is running.

  • dart:math library
    Providing mathematical constants and functions.

  • vector_math 2.1.4
    Providing constant factor to convert angle from degrees to radians.

  • widgets library
    Providing the Flutter widgets framework.

  • dart:convert library
    Providing encoders and decoders for converting JSON data fetched from MQTT.

  • screen_loader 4.0.1
    Providing easy to use mixin ScreenLoader, which will handle the loading on the screen without using state or navigation stack.

  • syncfusion_flutter_charts: ^21.1.41 Creating various types of cartesian, circular and spark charts with seamless interaction, responsiveness, and smooth animation. It has a rich set of features, and it is completely customizable and extendable.

Helpful Resources and Tutorials

Below is a list of links to resources and tutorials that helped in the development of the app:

How To Install The App

  1. For developers who want to refine or extend the App, please download the files and open them in Android Studio or Visual Studio Code.

  2. Please install Flutter and IOS Simulator or run the app using Android Emulator from Android Studio.

  3. The App uses multiple Packages and Libraries as highlighted above. They can be installed through the terminal or manually added to Flutter dependencies.

  4. Enter your MQTT client username and password in the "mqtt receiver.dart" file.

  5. The App uses the Firebase Authentication service. Please create a Firebase project and register your App on Firebase by providing your applicationID in android>app>build.grade for Android devices. After registration, download the "google-services.json" configuration file and implement it in the Android app module root directory. Finally, generate the "firebase_options.dart" File generated by FlutterFire CLI. The original "google-services.json", "firebase_app_id_file.json", and "firebase_options.dart" files for this app have been removed for security purposes. To set up Firebase in your Flutter App, please refer to here.

License

MIT License

Copyright (c) Leo Liu liuxiaochen11@gmail.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contact Details

About

Energy Diary connects to your local MQTT server and collects your energy usage and presents it to you in an easy-to-understand and interactive form.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Dart 81.6%
  • C++ 8.4%
  • CMake 7.5%
  • HTML 0.7%
  • Swift 0.6%
  • C 0.6%
  • Other 0.6%